adds a failing test

This commit is contained in:
Fabio Ivona
2022-02-18 16:40:17 +01:00
parent 04663e0c8e
commit 36130eb7a0

View File

@ -58,3 +58,19 @@ 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, 'Class "NonExistingException" not found');
it('can handle a class not found Error', function () {
expect(function () {
throw new NonExistingException();
})->toThrow('Class "NonExistingException" not found');
expect(function () {
throw new NonExistingException();
})->toThrow(Error::class, 'Class "NonExistingException" not found');
});