|
1
|
|
|
<?php |
|
2
|
|
|
use Robo\Robo; |
|
3
|
|
|
|
|
4
|
|
|
use Robo\Config\YamlConfigLoader; |
|
5
|
|
|
|
|
6
|
|
|
class RunnerTest extends \Codeception\TestCase\Test |
|
|
|
|
|
|
7
|
|
|
{ |
|
8
|
|
|
/** |
|
9
|
|
|
* @var \Robo\Runner |
|
10
|
|
|
*/ |
|
11
|
|
|
private $runner; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* @var \CodeGuy |
|
15
|
|
|
*/ |
|
16
|
|
|
protected $guy; |
|
17
|
|
|
|
|
18
|
|
|
public function _before() |
|
19
|
|
|
{ |
|
20
|
|
|
$this->runner = new \Robo\Runner('\Robo\RoboFileFixture'); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
public function testHandleError() |
|
24
|
|
|
{ |
|
25
|
|
|
$tmpLevel = error_reporting(); |
|
26
|
|
|
|
|
27
|
|
|
$this->assertFalse($this->runner->handleError()); |
|
28
|
|
|
error_reporting(0); |
|
29
|
|
|
$this->assertTrue($this->runner->handleError()); |
|
30
|
|
|
|
|
31
|
|
|
error_reporting($tmpLevel); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public function testErrorIsHandled() |
|
35
|
|
|
{ |
|
36
|
|
|
$tmpLevel = error_reporting(); |
|
37
|
|
|
|
|
38
|
|
|
// Set error_get_last to a known state. Note that it can never be |
|
39
|
|
|
// reset; see http://php.net/manual/en/function.error-get-last.php |
|
40
|
|
|
@trigger_error('control'); |
|
|
|
|
|
|
41
|
|
|
$error_description = error_get_last(); |
|
42
|
|
|
$this->assertEquals('control', $error_description['message']); |
|
43
|
|
|
@trigger_error(''); |
|
|
|
|
|
|
44
|
|
|
$error_description = error_get_last(); |
|
45
|
|
|
$this->assertEquals('', $error_description['message']); |
|
46
|
|
|
|
|
47
|
|
|
// Set error_reporting to a non-zero value. In this instance, |
|
48
|
|
|
// 'trigger_error' would abort our test script, so we use |
|
49
|
|
|
// @trigger_error so that execution will continue. With our |
|
50
|
|
|
// error handler in place, the value of error_get_last() does |
|
51
|
|
|
// not change. |
|
52
|
|
|
error_reporting(E_USER_ERROR); |
|
53
|
|
|
set_error_handler(array($this->runner, 'handleError')); |
|
54
|
|
|
@trigger_error('test error', E_USER_ERROR); |
|
|
|
|
|
|
55
|
|
|
$error_description = error_get_last(); |
|
56
|
|
|
$this->assertEquals('', $error_description['message']); |
|
57
|
|
|
|
|
58
|
|
|
// Set error_reporting to zero. Now, even 'trigger_error' |
|
59
|
|
|
// does not abort execution. The value of error_get_last() |
|
60
|
|
|
// still does not change. |
|
61
|
|
|
error_reporting(0); |
|
62
|
|
|
trigger_error('test error 2', E_USER_ERROR); |
|
63
|
|
|
$error_description = error_get_last(); |
|
64
|
|
|
$this->assertEquals('', $error_description['message']); |
|
65
|
|
|
|
|
66
|
|
|
error_reporting($tmpLevel); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function testThrowsExceptionWhenNoContainerAvailable() |
|
70
|
|
|
{ |
|
71
|
|
|
\PHPUnit_Framework_TestCase::setExpectedExceptionRegExp( |
|
|
|
|
|
|
72
|
|
|
'\RuntimeException', |
|
73
|
|
|
'/container is not initialized yet.*/' |
|
74
|
|
|
); |
|
75
|
|
|
Robo::unsetContainer(); |
|
76
|
|
|
Robo::getContainer(); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function testRunnerNoSuchCommand() |
|
80
|
|
|
{ |
|
81
|
|
|
$argv = ['placeholder', 'no-such-command']; |
|
82
|
|
|
$this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
83
|
|
|
$this->guy->seeInOutput('Command "no-such-command" is not defined.'); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
public function testRunnerList() |
|
87
|
|
|
{ |
|
88
|
|
|
$argv = ['placeholder', 'list']; |
|
89
|
|
|
$this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
90
|
|
|
$this->guy->seeInOutput('test:array-args'); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
public function testRunnerTryArgs() |
|
94
|
|
|
{ |
|
95
|
|
|
$argv = ['placeholder', 'test:array-args', 'a', 'b', 'c']; |
|
96
|
|
|
$this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
97
|
|
|
|
|
98
|
|
|
$expected = <<<EOT |
|
99
|
|
|
> The parameters passed are: |
|
100
|
|
|
array ( |
|
101
|
|
|
0 => 'a', |
|
102
|
|
|
1 => 'b', |
|
103
|
|
|
2 => 'c', |
|
104
|
|
|
) |
|
105
|
|
|
|
|
106
|
|
|
EOT; |
|
107
|
|
|
$this->guy->seeOutputEquals($expected); |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
public function testSymfonyStyle() |
|
111
|
|
|
{ |
|
112
|
|
|
$argv = ['placeholder', 'test:symfony-style']; |
|
113
|
|
|
$this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
114
|
|
|
$this->guy->seeInOutput('Some text in section one.'); |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
View Code Duplication |
public function testCommandEventHook() |
|
|
|
|
|
|
118
|
|
|
{ |
|
119
|
|
|
$argv = ['placeholder', 'test:command-event']; |
|
120
|
|
|
$this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
121
|
|
|
|
|
122
|
|
|
$expected = <<<EOT |
|
123
|
|
|
This is the command-event hook for the test:command-event command. |
|
124
|
|
|
This is the main method for the test:command-event command. |
|
125
|
|
|
This is the post-command hook for the test:command-event command. |
|
126
|
|
|
EOT; |
|
127
|
|
|
$this->guy->seeInOutput($expected); |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
View Code Duplication |
public function testCustomEventHook() |
|
|
|
|
|
|
131
|
|
|
{ |
|
132
|
|
|
$argv = ['placeholder', 'test:custom-event']; |
|
133
|
|
|
$this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
134
|
|
|
|
|
135
|
|
|
$expected = 'one,two'; |
|
136
|
|
|
$this->guy->seeInOutput($expected); |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
public function testRoboStaticRunMethod() |
|
140
|
|
|
{ |
|
141
|
|
|
$argv = ['placeholder', 'test:symfony-style']; |
|
142
|
|
|
$commandFiles = ['\Robo\RoboFileFixture']; |
|
143
|
|
|
Robo::run($argv, $commandFiles, 'MyApp', '1.2.3', $this->guy->capturedOutputStream()); |
|
|
|
|
|
|
144
|
|
|
$this->guy->seeInOutput('Some text in section one.'); |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
View Code Duplication |
public function testDeploy() |
|
|
|
|
|
|
148
|
|
|
{ |
|
149
|
|
|
$argv = ['placeholder', 'test:deploy', '--simulate']; |
|
150
|
|
|
$this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
151
|
|
|
$this->guy->seeInOutput('[Simulator] Simulating Remote\\Ssh(\'mysite.com\', null)'); |
|
152
|
|
|
$this->guy->seeInOutput('[Simulator] Running ssh mysite.com \'cd "/var/www/somesite" && git pull\''); |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
View Code Duplication |
public function testRunnerTryError() |
|
|
|
|
|
|
156
|
|
|
{ |
|
157
|
|
|
$argv = ['placeholder', 'test:error']; |
|
158
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
159
|
|
|
|
|
160
|
|
|
$this->guy->seeInOutput('[Exec] Running ls xyzzy'); |
|
161
|
|
|
$this->assertTrue($result > 0); |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
View Code Duplication |
public function testRunnerTrySimulatedError() |
|
|
|
|
|
|
165
|
|
|
{ |
|
166
|
|
|
$argv = ['placeholder', 'test:error', '--simulate']; |
|
167
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
168
|
|
|
|
|
169
|
|
|
$this->guy->seeInOutput('Simulating Exec'); |
|
170
|
|
|
$this->assertEquals(0, $result); |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
View Code Duplication |
public function testRunnerTryException() |
|
|
|
|
|
|
174
|
|
|
{ |
|
175
|
|
|
$argv = ['placeholder', 'test:exception', '--task']; |
|
176
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
177
|
|
|
|
|
178
|
|
|
$this->guy->seeInOutput('Task failed with an exception'); |
|
179
|
|
|
$this->assertEquals(1, $result); |
|
180
|
|
|
} |
|
181
|
|
|
|
|
182
|
|
|
public function testInitCommand() |
|
183
|
|
|
{ |
|
184
|
|
|
$container = \Robo\Robo::getContainer(); |
|
185
|
|
|
$app = $container->get('application'); |
|
186
|
|
|
$app->addInitRoboFileCommand(getcwd() . '/testRoboFile.php', 'RoboTestClass'); |
|
187
|
|
|
|
|
188
|
|
|
$argv = ['placeholder', 'init']; |
|
189
|
|
|
$status = $this->runner->run($argv, $this->guy->capturedOutputStream(), $app); |
|
|
|
|
|
|
190
|
|
|
$this->guy->seeInOutput('testRoboFile.php will be created in the current directory'); |
|
191
|
|
|
$this->assertEquals(0, $status); |
|
192
|
|
|
|
|
193
|
|
|
$this->assertTrue(file_exists('testRoboFile.php')); |
|
194
|
|
|
$commandContents = file_get_contents('testRoboFile.php'); |
|
195
|
|
|
unlink('testRoboFile.php'); |
|
196
|
|
|
$this->assertContains('class RoboTestClass', $commandContents); |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
View Code Duplication |
public function testTasksStopOnFail() |
|
|
|
|
|
|
200
|
|
|
{ |
|
201
|
|
|
$argv = ['placeholder', 'test:stop-on-fail']; |
|
202
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
203
|
|
|
|
|
204
|
|
|
$this->guy->seeInOutput('['); |
|
205
|
|
|
$this->assertTrue($result > 0); |
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
View Code Duplication |
public function testInvalidRoboDirectory() |
|
|
|
|
|
|
209
|
|
|
{ |
|
210
|
|
|
$runnerWithNoRoboFile = new \Robo\Runner(); |
|
211
|
|
|
|
|
212
|
|
|
$argv = ['placeholder', 'list', '-f', 'no-such-directory']; |
|
213
|
|
|
$result = $runnerWithNoRoboFile->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
|
|
|
|
|
214
|
|
|
|
|
215
|
|
|
$this->guy->seeInOutput('Path `no-such-directory` is invalid; please provide a valid absolute path to the Robofile to load.'); |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
View Code Duplication |
public function testUnloadableRoboFile() |
|
|
|
|
|
|
219
|
|
|
{ |
|
220
|
|
|
$runnerWithNoRoboFile = new \Robo\Runner(); |
|
221
|
|
|
|
|
222
|
|
|
$argv = ['placeholder', 'list', '-f', dirname(__DIR__) . '/src/RoboFileFixture.php']; |
|
223
|
|
|
$result = $runnerWithNoRoboFile->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
|
|
|
|
|
224
|
|
|
|
|
225
|
|
|
// We cannot load RoboFileFixture.php via -f / --load-from because |
|
226
|
|
|
// it has a namespace, and --load-from does not support that. |
|
227
|
|
|
$this->guy->seeInOutput('Class RoboFileFixture was not loaded'); |
|
228
|
|
|
} |
|
229
|
|
|
|
|
230
|
|
View Code Duplication |
public function testRunnerQuietOutput() |
|
|
|
|
|
|
231
|
|
|
{ |
|
232
|
|
|
$argv = ['placeholder', 'test:verbosity', '--quiet']; |
|
233
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
234
|
|
|
|
|
235
|
|
|
$this->guy->doNotSeeInOutput('This command will print more information at higher verbosity levels'); |
|
236
|
|
|
$this->guy->doNotSeeInOutput('This is a verbose message (-v).'); |
|
237
|
|
|
$this->guy->doNotSeeInOutput('This is a very verbose message (-vv).'); |
|
238
|
|
|
$this->guy->doNotSeeInOutput('This is a debug message (-vvv).'); |
|
239
|
|
|
$this->guy->doNotSeeInOutput(' [warning] This is a warning log message.'); |
|
240
|
|
|
$this->guy->doNotSeeInOutput(' [notice] This is a notice log message.'); |
|
241
|
|
|
$this->guy->doNotSeeInOutput(' [debug] This is a debug log message.'); |
|
242
|
|
|
$this->assertEquals(0, $result); |
|
243
|
|
|
} |
|
244
|
|
|
|
|
245
|
|
View Code Duplication |
public function testRunnerVerboseOutput() |
|
|
|
|
|
|
246
|
|
|
{ |
|
247
|
|
|
$argv = ['placeholder', 'test:verbosity', '-v']; |
|
248
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
249
|
|
|
|
|
250
|
|
|
$this->guy->seeInOutput('This command will print more information at higher verbosity levels'); |
|
251
|
|
|
$this->guy->seeInOutput('This is a verbose message (-v).'); |
|
252
|
|
|
$this->guy->doNotSeeInOutput('This is a very verbose message (-vv).'); |
|
253
|
|
|
$this->guy->doNotSeeInOutput('This is a debug message (-vvv).'); |
|
254
|
|
|
$this->guy->seeInOutput(' [warning] This is a warning log message.'); |
|
255
|
|
|
$this->guy->seeInOutput(' [notice] This is a notice log message.'); |
|
256
|
|
|
$this->guy->doNotSeeInOutput(' [debug] This is a debug log message.'); |
|
257
|
|
|
$this->assertEquals(0, $result); |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
View Code Duplication |
public function testRunnerVeryVerboseOutput() |
|
|
|
|
|
|
261
|
|
|
{ |
|
262
|
|
|
$argv = ['placeholder', 'test:verbosity', '-vv']; |
|
263
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
264
|
|
|
|
|
265
|
|
|
$this->guy->seeInOutput('This command will print more information at higher verbosity levels'); |
|
266
|
|
|
$this->guy->seeInOutput('This is a verbose message (-v).'); |
|
267
|
|
|
$this->guy->seeInOutput('This is a very verbose message (-vv).'); |
|
268
|
|
|
$this->guy->doNotSeeInOutput('This is a debug message (-vvv).'); |
|
269
|
|
|
$this->guy->seeInOutput(' [warning] This is a warning log message.'); |
|
270
|
|
|
$this->guy->seeInOutput(' [notice] This is a notice log message.'); |
|
271
|
|
|
$this->guy->doNotSeeInOutput(' [debug] This is a debug log message.'); |
|
272
|
|
|
$this->assertEquals(0, $result); |
|
273
|
|
|
} |
|
274
|
|
|
|
|
275
|
|
View Code Duplication |
public function testRunnerVerbosityThresholdVerbose() |
|
|
|
|
|
|
276
|
|
|
{ |
|
277
|
|
|
$argv = ['placeholder', 'test:verbosity-threshold', '-v']; |
|
278
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
279
|
|
|
|
|
280
|
|
|
$this->guy->seeInOutput('This command will print more information at higher verbosity levels'); |
|
281
|
|
|
$this->guy->seeInOutput("Running echo verbose or higher\nverbose or higher"); |
|
282
|
|
|
$this->guy->doNotSeeInOutput('very verbose or higher'); |
|
283
|
|
|
$this->assertEquals(0, $result); |
|
284
|
|
|
} |
|
285
|
|
|
|
|
286
|
|
View Code Duplication |
public function testRunnerVerbosityThresholdVeryVerbose() |
|
|
|
|
|
|
287
|
|
|
{ |
|
288
|
|
|
$argv = ['placeholder', 'test:verbosity-threshold', '-vv']; |
|
289
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
290
|
|
|
|
|
291
|
|
|
$this->guy->seeInOutput('This command will print more information at higher verbosity levels'); |
|
292
|
|
|
$this->guy->seeInOutput("Running echo verbose or higher\nverbose or higher"); |
|
293
|
|
|
$this->guy->seeInOutput("Running echo very verbose or higher\nvery verbose or higher"); |
|
294
|
|
|
$this->assertEquals(0, $result); |
|
295
|
|
|
} |
|
296
|
|
|
|
|
297
|
|
View Code Duplication |
public function testRunnerDebugOutput() |
|
|
|
|
|
|
298
|
|
|
{ |
|
299
|
|
|
$argv = ['placeholder', 'test:verbosity', '-vvv']; |
|
300
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
301
|
|
|
|
|
302
|
|
|
$this->guy->seeInOutput('This command will print more information at higher verbosity levels'); |
|
303
|
|
|
$this->guy->seeInOutput('This is a verbose message (-v).'); |
|
304
|
|
|
$this->guy->seeInOutput('This is a very verbose message (-vv).'); |
|
305
|
|
|
$this->guy->seeInOutput('This is a debug message (-vvv).'); |
|
306
|
|
|
$this->guy->seeInOutput(' [warning] This is a warning log message.'); |
|
307
|
|
|
$this->guy->seeInOutput(' [notice] This is a notice log message.'); |
|
308
|
|
|
$this->guy->seeInOutput(' [debug] This is a debug log message.'); |
|
309
|
|
|
$this->assertEquals(0, $result); |
|
310
|
|
|
} |
|
311
|
|
|
|
|
312
|
|
View Code Duplication |
public function testNoOptionsNoConfiguration() |
|
|
|
|
|
|
313
|
|
|
{ |
|
314
|
|
|
// Run without any config and without any options |
|
315
|
|
|
$argv = ['placeholder', 'test:simple-list']; |
|
316
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
|
|
|
|
|
317
|
|
|
|
|
318
|
|
|
$this->guy->seeInOutput("a: '1'"); |
|
319
|
|
|
$this->guy->seeInOutput("b: '2'"); |
|
320
|
|
|
} |
|
321
|
|
|
|
|
322
|
|
View Code Duplication |
public function testOptionsButNoConfiguration() |
|
|
|
|
|
|
323
|
|
|
{ |
|
324
|
|
|
// Set one option, but provide no config |
|
325
|
|
|
$argv = ['placeholder', 'test:simple-list', '--b=3']; |
|
326
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
|
|
|
|
|
327
|
|
|
|
|
328
|
|
|
$this->guy->seeInOutput("a: '1'"); |
|
329
|
|
|
$this->guy->seeInOutput("b: '3'"); |
|
330
|
|
|
} |
|
331
|
|
|
|
|
332
|
|
View Code Duplication |
public function testWithConfigurationButNoOptions() |
|
|
|
|
|
|
333
|
|
|
{ |
|
334
|
|
|
\Robo\Robo::config()->set('command.test.simple-list.options.a', '4'); |
|
335
|
|
|
\Robo\Robo::config()->set('command.test.simple-list.options.b', '5'); |
|
336
|
|
|
|
|
337
|
|
|
$argv = ['placeholder', 'test:simple-list']; |
|
338
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
|
|
|
|
|
339
|
|
|
|
|
340
|
|
|
$this->guy->seeInOutput("a: '4'"); |
|
341
|
|
|
$this->guy->seeInOutput("b: '5'"); |
|
342
|
|
|
} |
|
343
|
|
|
|
|
344
|
|
View Code Duplication |
public function testWithConfigurationAndOptionOverride() |
|
|
|
|
|
|
345
|
|
|
{ |
|
346
|
|
|
\Robo\Robo::config()->set('command.test.simple-list.options.a', '4'); |
|
347
|
|
|
\Robo\Robo::config()->set('command.test.simple-list.options.b', '5'); |
|
348
|
|
|
|
|
349
|
|
|
$argv = ['placeholder', 'test:simple-list', '--b=6']; |
|
350
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
|
|
|
|
|
351
|
|
|
|
|
352
|
|
|
$this->guy->seeInOutput("a: '4'"); |
|
353
|
|
|
$this->guy->seeInOutput("b: '6'"); |
|
354
|
|
|
} |
|
355
|
|
|
|
|
356
|
|
View Code Duplication |
public function testSettingConfigurationFromCommandOptions() |
|
|
|
|
|
|
357
|
|
|
{ |
|
358
|
|
|
$argv = ['placeholder', 'test:simple-list', '-D', 'config.key=value']; |
|
359
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
|
|
|
|
|
360
|
|
|
|
|
361
|
|
|
$this->guy->seeInOutput("a: '1'"); |
|
362
|
|
|
$this->guy->seeInOutput("b: '2'"); |
|
363
|
|
|
|
|
364
|
|
|
$actual = \Robo\Robo::config()->get('config.key'); |
|
365
|
|
|
$this->assertEquals('value', $actual); |
|
366
|
|
|
} |
|
367
|
|
|
|
|
368
|
|
View Code Duplication |
public function testWithConfigLoader() |
|
|
|
|
|
|
369
|
|
|
{ |
|
370
|
|
|
$loader = new YamlConfigLoader(); |
|
371
|
|
|
$loader->load(dirname(__DIR__) . '/_data/robo.yml'); |
|
372
|
|
|
|
|
373
|
|
|
\Robo\Robo::config()->extend($loader); |
|
374
|
|
|
|
|
375
|
|
|
$argv = ['placeholder', 'test:simple-list']; |
|
376
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
|
|
|
|
|
377
|
|
|
|
|
378
|
|
|
$this->guy->seeInOutput("a: '12'"); |
|
379
|
|
|
$this->guy->seeInOutput("b: '13'"); |
|
380
|
|
|
} |
|
381
|
|
|
|
|
382
|
|
|
|
|
383
|
|
View Code Duplication |
public function testWithConfigLoaderAndCliOverride() |
|
|
|
|
|
|
384
|
|
|
{ |
|
385
|
|
|
$loader = new YamlConfigLoader(); |
|
386
|
|
|
$loader->load(dirname(__DIR__) . '/_data/robo.yml'); |
|
387
|
|
|
|
|
388
|
|
|
\Robo\Robo::config()->extend($loader); |
|
389
|
|
|
|
|
390
|
|
|
$argv = ['placeholder', 'test:simple-list', '--b=3']; |
|
391
|
|
|
$result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
|
|
|
|
|
392
|
|
|
|
|
393
|
|
|
$this->guy->seeInOutput("a: '12'"); |
|
394
|
|
|
$this->guy->seeInOutput("b: '3'"); |
|
395
|
|
|
} |
|
396
|
|
|
} |
|
397
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.