nunomaduro / pest

This repository contains an old version of PEST. A new and better version is being coded in private and will be out soon: https://github.com/pestphp/pest.
343 stars 3 forks source link

expectException() doesn't seem to work properly #28

Open madnowruzi opened 5 years ago

madnowruzi commented 5 years ago

this is the way i wrote my test:

it('throws an exception', function() {
    $this->expectException(\Exception::class);

    throw new \Exception('some message');
});

and it will fail just showing the exception class and message when it shouldn't fail at all.

nunomaduro commented 5 years ago

Any ideas on how to fix that? I would love a global expectException instead.

olivernybroe commented 5 years ago

@nunomaduro We prob. just have to create our own exception handler?

nunomaduro commented 5 years ago

I don't think so, I would see something like:

function expectException(callable $callback): void
// a try catch inside.