Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-ivona committed Aug 21, 2023
1 parent 69630de commit 7c1a045
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
26 changes: 8 additions & 18 deletions tests/NativeFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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();
4 changes: 1 addition & 3 deletions tests/ToBeUsedIn.php
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 7c1a045

Please sign in to comment.