-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
OrderCest.php
140 lines (126 loc) · 4.91 KB
/
OrderCest.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
declare(strict_types=1);
final class OrderCest
{
public function checkOneFile(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run order LoadingOrderCept.php');
$I->expect('global bootstrap, initialization, beforeSuite, before, bootstrap(B), test(T), after, afterSuite');
$I->seeFileFound('order.txt', 'tests/_output');
$I->seeFileContentsEqual("BIB([ST])");
}
public function checkForFails(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run order FailedCept.php --no-exit');
$I->seeFileFound('order.txt', 'tests/_output');
$I->expect('global bootstrap, initialization, beforeSuite, before, bootstrap, test, fail, after, afterSuite');
$I->seeFileContentsEqual("BIB([STF])");
}
public function checkForCanCantFails(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run order CanCantFailCept.php --no-exit');
$I->seeFileFound('order.txt', 'tests/_output');
$I->expect(
'global bootstrap, initialization, beforeSuite, before, bootstrap, test,'
. ' fail, fail, test, after, afterSuite'
);
$I->seeFileContentsEqual("BIB([STFFT])");
}
public function checkForCanCantFailsInCest(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run order CanCantFailCest.php --no-exit');
$I->seeFileFound('order.txt', 'tests/_output');
$I->expect(
'global bootstrap, initialization, beforeSuite, before, bootstrap, test,'
. ' fail, fail, test, test, fail, fail, test, after, afterSuite'
);
$I->seeFileContentsEqual("BIB([TFT][TFT])");
}
public function checkForCanCantFailsInTest(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run order CanCantFailTest.php --no-exit');
$I->seeFileFound('order.txt', 'tests/_output');
$I->expect(
'global bootstrap, initialization, beforeSuite, before, bootstrap, test,'
. ' fail, fail, test, test, fail, fail, test, after, afterSuite'
);
$I->seeFileContentsEqual("BIB([TFT][TFT])");
}
public function checkSimpleFiles(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run order --no-exit --group simple');
$I->seeFileFound('order.txt', 'tests/_output');
$I->seeFileContentsEqual("BIBP([ST][STFFT][STF][ST])");
}
public function checkCestOrder(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run tests/order/ReorderCest.php --no-exit');
$I->seeFileFound('order.txt', 'tests/_output');
$I->seeFileContentsEqual("BIB([0123456])");
}
public function checkFailingCestOrder(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run tests/order/FailedCest.php --no-exit -vvv');
$I->seeFileFound('order.txt', 'tests/_output');
$I->seeFileContentsEqual("BIB([a%F])");
}
public function checkCodeceptionTest(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run order CodeTest.php --no-exit');
$I->seeFileFound('order.txt', 'tests/_output');
$I->expect('
global bootstrap,
initialization,
beforeSuite,
beforeClass,
@beforeClass,
bootstrap,
before,
@before
test,
after,
@after,
afterSuite,
afterClass,
@afterClass');
$I->seeFileContentsEqual("BIB({{[<C>]}})");
}
public function checkAfterBeforeClassInTests(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run order BeforeAfterClassTest.php');
$I->seeFileFound('order.txt', 'tests/_output');
$I->seeInThisFile('BIB({[1][2]})');
}
public function checkAfterBeforeClassInTestWithDataProvider(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run order BeforeAfterClassWithDataProviderTest.php');
$I->seeFileFound('order.txt', 'tests/_output');
$I->seeInThisFile('BIB({[A][B][C]})');
}
public function checkBootstrapIsLoadedBeforeTests(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run order ParsedLoadedTest.php');
$I->seeFileFound('order.txt', 'tests/_output');
# Module before and after hooks are executed for unit tests now
$I->seeInThisFile('BIBP([T])');
}
public function checkAfterBeforeHooksAreExecutedOnlyOnce(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run math,order,scenario,skipped :BeforeAfterClassTest');
$I->seeFileFound('order.txt', 'tests/_output');
$I->seeInThisFile('BIBP({[1][2]})');
}
}