From e103623ecbcd154633542ed82554e47b58d3bc53 Mon Sep 17 00:00:00 2001 From: Fabio Ivona Date: Fri, 18 Feb 2022 18:00:55 +0100 Subject: [PATCH] adds failing test --- tests/Features/Expect/toThrow.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/Features/Expect/toThrow.php b/tests/Features/Expect/toThrow.php index 434ced44..9264a232 100644 --- a/tests/Features/Expect/toThrow.php +++ b/tests/Features/Expect/toThrow.php @@ -58,3 +58,15 @@ test('closure missing parameter', function () { test('closure missing type-hint', function () { expect(function () {})->toThrow(function ($e) {}); })->throws(InvalidArgumentException::class, 'The given closure\'s parameter must be type-hinted as the class string.'); + +it('can handle a non-defined exception', function () { + expect(function () { + throw new NonExistingException(); + })->toThrow(NonExistingException::class); +})->throws(Error::class); + +it('can handle a class not found Error', function () { + expect(function () { + throw new NonExistingException(); + })->toThrow(Error::class); +});