-
-
Notifications
You must be signed in to change notification settings - Fork 312
/
Depends.php
38 lines (28 loc) · 1.04 KB
/
Depends.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
$runCounter = 0;
test('first', function () use (&$runCounter) {
expect(true)->toBeTrue();
$runCounter++;
return 'first';
});
test('second', function () use (&$runCounter) {
expect(true)->toBeTrue();
$runCounter++;
return 'second';
});
test('depends', function () {
expect(func_get_args())->toBe(['first', 'second']);
})->depends('first', 'second');
test('depends with ...params', function (string ...$params) {
expect(func_get_args())->toBe($params);
})->depends('first', 'second');
test('depends with defined arguments', function (string $first, string $second) {
expect($first)->toBe('first');
expect($second)->toBe('second');
})->depends('first', 'second');
test('depends run test only once', function () use (&$runCounter) {
expect($runCounter)->toBe(2);
})->depends('first', 'second');
// Regression tests. See https://github.com/pestphp/pest/pull/216
it('asserts true is true')->assertTrue(true);
test('depends works with the correct test name')->assertTrue(true)->depends('it asserts true is true');