Repository navigation
Expand file tree
/
Copy pathRunEnvironmentCest.php
More file actions
130 lines (115 loc) · 5.22 KB
/
Copy pathRunEnvironmentCest.php
File metadata and controls
130 lines (115 loc) · 5.22 KB
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
<?php
class RunEnvironmentCest
{
public function testDevEnvironment(CliGuy $I)
{
$I->wantTo('execute test in --dev environment');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run dummy --env=dev');
$I->seeInShellOutput("OK (");
}
public function testProdEnvironment(CliGuy $I)
{
$I->wantTo('execute test in non existent --prod environment');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run dummy --env=prod');
$I->dontSeeInShellOutput("OK (");
$I->seeInShellOutput("No tests executed");
}
public function testEnvironmentParams(CliGuy $I)
{
$I->wantTo('execute check that env params applied');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run powers PowerIsRisingCept.php --env=dev -vv --steps');
$I->seeInShellOutput('I got the power');
$I->seeInShellOutput("PASSED");
$I->seeInShellOutput("OK (");
}
public function testWithoutEnvironmentParams(CliGuy $I)
{
$I->wantTo('execute check that env params applied');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run powers PowerIsRisingCept.php -vv --no-exit');
$I->seeInShellOutput("I have no power");
$I->seeInShellOutput("FAIL");
}
public function runTestForSpecificEnvironment(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run powers MageGuildCest.php --env whisky');
$I->seeInShellOutput('Red label (MageGuildCest:redLabel)');
$I->seeInShellOutput('Black label (MageGuildCest:blackLabel)');
$I->seeInShellOutput('Power of the universe (MageGuildCest:powerOfTheUniverse)');
$I->seeInShellOutput('OK (3 tests, 3 assertions)');
}
public function runTestForNotIncludedEnvironment(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run powers MageGuildCest.php --env dev');
$I->seeInShellOutput('Power of the universe (MageGuildCest:powerOfTheUniverse)');
$I->seeInShellOutput('OK (1 test, 1 assertion)');
}
public function testEnvFileLoading(CliGuy $I)
{
$I->wantTo('test that env configuration files are loaded correctly');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run messages MessageCest.php:allMessages -vv --env env2');
$I->seeInShellOutput('message1: MESSAGE1 FROM ENV2-DIST.');
$I->seeInShellOutput('message2: MESSAGE2 FROM ENV2.');
$I->seeInShellOutput('message3: MESSAGE3 FROM SUITE.');
$I->seeInShellOutput('message4: DEFAULT MESSAGE4.');
}
public function testEnvMerging(CliGuy $I)
{
$I->wantTo('test that given environments are merged properly');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run messages MessageCest.php:allMessages -vv --env env1,env2');
$I->seeInShellOutput('message1: MESSAGE1 FROM ENV2-DIST.');
$I->seeInShellOutput('message4: MESSAGE4 FROM SUITE-ENV1.');
$I->executeCommand('run messages MessageCest.php:allMessages -vv --env env2,env1');
$I->seeInShellOutput('message1: MESSAGE1 FROM SUITE-ENV1.');
$I->seeInShellOutput('message4: MESSAGE4 FROM SUITE-ENV1.');
}
public function runTestForMultipleEnvironments(CliGuy $I)
{
$I->wantTo('check that multiple required environments are taken into account');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run messages MessageCest.php:multipleEnvRequired -vv --env env1');
$I->dontSeeInShellOutput('Multiple env given');
$I->executeCommand('run messages MessageCest.php:multipleEnvRequired -vv --env env2');
$I->dontSeeInShellOutput('Multiple env given');
$I->executeCommand('run messages MessageCest.php:multipleEnvRequired -vv --env env1,env2');
$I->seeInShellOutput('Multiple env given');
$I->executeCommand('run messages MessageCest.php:multipleEnvRequired -vv --env env2,env1');
$I->seeInShellOutput('Multiple env given');
}
public function generateEnvConfig(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('g:env firefox');
$I->seeInShellOutput('firefox config was created');
$I->seeFileFound('tests/_envs/firefox.yml');
}
public function runEnvironmentForCept(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run messages --env email');
$I->seeInShellOutput('Test emails');
$I->dontSeeInShellOutput('Multiple env given');
$I->executeCommand('run messages --env env1');
$I->dontSeeInShellOutput('Test emails');
}
public function showExceptionForUnconfiguredEnvironment(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run skipped NoEnvironmentCept --no-exit');
$I->seeInShellOutput("Environment nothing was not configured but used");
$I->seeInShellOutput('WARNING');
}
public function environmentsFromSubfolders(CliGuy $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run messages MessageCest.php:allMessages -vv --env env3');
$I->seeInShellOutput('MESSAGE2 FROM ENV3');
}
}