-
Notifications
You must be signed in to change notification settings - Fork 1
/
DependsTest.php
61 lines (52 loc) · 1.26 KB
/
DependsTest.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
class DependsTest extends \PHPUnit\Framework\TestCase {
/* * * * * * * *
* *
* 单个依赖 *
* *
* * * * * * * */
public function testEmpty() {
$stack = [];
$this->assertEmpty($stack);
return $stack;
}
/**
* @depends testEmpty
*/
public function testPush(array $stack) {
array_push($stack, 'foo');
$this->assertEquals('foo', $stack[count($stack)-1]);
$this->assertNotEmpty($stack);
return $stack;
}
/**
* @depends testPush
*/
public function testPop(array $stack) {
$this->assertEquals('foo', array_pop($stack));
$this->assertEmpty($stack);
}
/* * * * * * * *
* *
* 多重依赖 *
* *
* * * * * * * */
public function testProducerFirst() {
$this->assertTrue(true);
return 'first';
}
public function testProducerSecond() {
$this->assertTrue(true);
return 'second';
}
/**
* @depends testProducerFirst
* @depends testProducerSecond
*/
public function testConsumer() {
$this->assertEquals(
['first', 'second'],
func_get_args()
);
}
}