From 7c1a0450ce08e15d2ccf029a9d4ad09e2c0f4092 Mon Sep 17 00:00:00 2001 From: Fabio Ivona Date: Mon, 21 Aug 2023 16:58:18 +0200 Subject: [PATCH] fix tests --- tests/NativeFunctions.php | 26 ++++++++------------------ tests/ToBeUsedIn.php | 4 +--- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/tests/NativeFunctions.php b/tests/NativeFunctions.php index 22e117e..95a4b64 100644 --- a/tests/NativeFunctions.php +++ b/tests/NativeFunctions.php @@ -4,22 +4,19 @@ test('native functions', function () { expect('Tests')->toUse('sleep'); - expect('Tests')->not->toUse('die'); - - expect('die')->not->toBeUsed(); - expect('die')->toBeUsedInNothing(); + expect('Tests')->toUse('die'); expect('sleep')->toBeUsedIn('Tests') - ->and('die')->not->toBeUsedIn('Tests'); + ->and('die')->toBeUsedIn('Tests'); expect('die')->toOnlyBeUsedIn('Tests'); }); test('failure 1', function () { - expect('Tests')->toUse('die'); + expect('Tests')->not->toUse('die'); })->throws( ExpectationFailedException::class, - "Expecting 'Tests' to use 'die'." + "Expecting 'Tests' not to use 'die'." ); test('failure 2', function () { @@ -33,26 +30,19 @@ expect('sleep')->not->toBeUsed(); })->throws( \Pest\Arch\Exceptions\ArchExpectationFailedException::class, - 'Expecting \'sleep\' not to be used on \'Tests\Fixtures\Misc\HasSleepFunction\'.' + 'Expecting \'sleep\' not to be used on \'Tests\Fixtures\Misc\HasNativeFunctions\'.' ); test('failure 4', function () { expect('sleep')->toBeUsedInNothing(); })->throws( \Pest\Arch\Exceptions\ArchExpectationFailedException::class, - 'Expecting \'sleep\' not to be used on \'Tests\Fixtures\Misc\HasSleepFunction\'.' -); - -test('failure 5', function () { - expect('die')->toBeUsedIn('Tests\Fixtures\Misc\HasNativeFunctions'); -})->throws( - ExpectationFailedException::class, - 'Expecting \'Tests\Fixtures\Misc\HasSleepFunction\' to use \'die\'.', + 'Expecting \'sleep\' not to be used on \'Tests\Fixtures\Misc\HasNativeFunctions\'.' ); test('failure 6', function () { expect('sleep')->not->toBeUsedIn('Tests\Fixtures\Misc\HasNativeFunctions'); })->throws( ExpectationFailedException::class, - 'Expecting \'sleep\' not to be used in \'Tests\Fixtures\Misc\HasSleepFunction\'.', -); + 'Expecting \'sleep\' not to be used in \'Tests\Fixtures\Misc\HasNativeFunctions\'.', +)->only(); diff --git a/tests/ToBeUsedIn.php b/tests/ToBeUsedIn.php index 55cec01..71e5dea 100644 --- a/tests/ToBeUsedIn.php +++ b/tests/ToBeUsedIn.php @@ -18,9 +18,7 @@ ExpectationFailedException::class, "Expecting '$function' not to be used in 'Tests\Fixtures\Misc\HasNativeFunctions'." ); -})->with([ - 'sleep', 'die', 'eval', 'exit', 'clone', 'empty', 'isset', 'print', -]); +})->with(['sleep', 'die', 'eval', 'exit', 'clone', 'empty', 'isset', 'print']); it('fails 1', function () { expect([Fooable::class])