mirror of
https://github.com/pestphp/pest.git
synced 2026-04-21 06:27:28 +02:00
feat(expect): updates test suite to use expectation api
This commit is contained in:
@ -3,38 +3,32 @@
|
||||
$runCounter = 0;
|
||||
|
||||
test('first', function () use (&$runCounter) {
|
||||
assertTrue(true);
|
||||
expect(true)->toBeTrue();
|
||||
$runCounter++;
|
||||
|
||||
return 'first';
|
||||
});
|
||||
|
||||
test('second', function () use (&$runCounter) {
|
||||
assertTrue(true);
|
||||
expect(true)->toBeTrue();
|
||||
$runCounter++;
|
||||
|
||||
return 'second';
|
||||
});
|
||||
|
||||
test('depends', function () {
|
||||
assertEquals(
|
||||
['first', 'second'],
|
||||
func_get_args()
|
||||
);
|
||||
expect(func_get_args())->toBe(['first', 'second']);
|
||||
})->depends('first', 'second');
|
||||
|
||||
test('depends with ...params', function (string ...$params) {
|
||||
assertEquals(
|
||||
['first', 'second'],
|
||||
$params
|
||||
);
|
||||
expect(func_get_args())->toBe($params);
|
||||
})->depends('first', 'second');
|
||||
|
||||
test('depends with defined arguments', function (string $first, string $second) {
|
||||
assertEquals('first', $first);
|
||||
assertEquals('second', $second);
|
||||
expect($first)->toBe('first');
|
||||
expect($second)->toBe('second');
|
||||
})->depends('first', 'second');
|
||||
|
||||
test('depends run test only once', function () use (&$runCounter) {
|
||||
assertEquals(2, $runCounter);
|
||||
expect($runCounter)->toBe(2);
|
||||
})->depends('first', 'second');
|
||||
|
||||
Reference in New Issue
Block a user