@@ -92,7 +92,7 @@ |
||
92 | 92 | $log = usingLog()->startAction('provision new VM'); |
93 | 93 | |
94 | 94 | // make sure we like the provided details |
95 | - foreach(array('name', 'osName', 'homeFolder') as $param) { |
|
95 | + foreach (array('name', 'osName', 'homeFolder') as $param) { |
|
96 | 96 | if (!isset($vmDetails->$param)) { |
97 | 97 | throw new E5xx_ActionFailed(__METHOD__, "missing vmDetails['{$param}']"); |
98 | 98 | } |
@@ -115,8 +115,7 @@ |
||
115 | 115 | getenv("HOME") . "/.vagrant.d/insecure_private_key" |
116 | 116 | ]; |
117 | 117 | |
118 | - foreach ($keyFilenames as $keyFilename) |
|
119 | - { |
|
118 | + foreach ($keyFilenames as $keyFilename) { |
|
120 | 119 | usingLog()->writeToLog("checking if {$keyFilename} exists"); |
121 | 120 | if (file_exists($keyFilename)) { |
122 | 121 | $log->endAction($keyFilename); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $baseFolder = $this->getVagrantDir($groupDef); |
139 | 139 | |
140 | 140 | // make sure we're happy with details about the machine |
141 | - foreach($groupDef->details->machines as $hostId => $machine) { |
|
141 | + foreach ($groupDef->details->machines as $hostId => $machine) { |
|
142 | 142 | // TODO: it would be great to autodetect this one day |
143 | 143 | if (!isset($machine->osName)) { |
144 | 144 | throw new E5xx_ActionFailed(__METHOD__, "missing groupDef->details->machines['$hostId']->osName"); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | // make sure the VM is stopped, if it is running |
152 | - $log->addStep('stop vagrant VM in '.$baseFolder.' if already running', function() use($baseFolder) { |
|
152 | + $log->addStep('stop vagrant VM in ' . $baseFolder . ' if already running', function() use($baseFolder) { |
|
153 | 153 | $command = "vagrant destroy --force"; |
154 | 154 | $this->runCommandAgainstHostManager($baseFolder, $command); |
155 | 155 | }); |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | // let's start the VM |
169 | 169 | $command = "vagrant up"; |
170 | - $result = $log->addStep('create vagrant VM(s) in '.$baseFolder, function() use($baseFolder, $command) { |
|
170 | + $result = $log->addStep('create vagrant VM(s) in ' . $baseFolder, function() use($baseFolder, $command) { |
|
171 | 171 | return $this->runCommandAgainstHostManager($baseFolder, $command); |
172 | 172 | }); |
173 | 173 | |
@@ -180,14 +180,14 @@ discard block |
||
180 | 180 | // yes it did!! |
181 | 181 | |
182 | 182 | // store the details |
183 | - foreach($groupDef->details->machines as $hostId => $machine) |
|
183 | + foreach ($groupDef->details->machines as $hostId => $machine) |
|
184 | 184 | { |
185 | 185 | // we want all the details from the config file |
186 | 186 | $vmDetails = clone $machine; |
187 | 187 | |
188 | 188 | // this allows the story to perform actions against a single |
189 | 189 | // machine if required |
190 | - $vmDetails->type = 'VagrantVm'; |
|
190 | + $vmDetails->type = 'VagrantVm'; |
|
191 | 191 | |
192 | 192 | // new in v2.x: |
193 | 193 | // |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | */ |
420 | 420 | public function setVagrantBridgedInterface() { |
421 | 421 | $bridgedIface = $this->determineBridgedInterface(); |
422 | - putenv('VAGRANT_BRIDGE_ADAPTER='.$bridgedIface); |
|
423 | - putenv('VIRTUALBOX_BRIDGE_ADAPTER='.$bridgedIface); |
|
422 | + putenv('VAGRANT_BRIDGE_ADAPTER=' . $bridgedIface); |
|
423 | + putenv('VIRTUALBOX_BRIDGE_ADAPTER=' . $bridgedIface); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | // e.g.: "moduleSettings":{"vagrant":{"bridgedIface":"eth0"}} |
437 | 437 | $vagrantSettings = fromStoryplayer()->getModuleSetting('vagrant'); |
438 | 438 | if (!empty($vagrantSettings->bridgedIface)) { |
439 | - $log->endAction('Returning configured '.$vagrantSettings->bridgedIface.' interface'); |
|
439 | + $log->endAction('Returning configured ' . $vagrantSettings->bridgedIface . ' interface'); |
|
440 | 440 | return $vagrantSettings->bridgedIface; |
441 | 441 | } |
442 | 442 | } catch (E5xx_ActionFailed $e) { |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | // now we just need to make sense of it all |
467 | 467 | $lines = explode("\n", $result->output); |
468 | 468 | $iface = null; |
469 | - foreach($lines as $line) { |
|
469 | + foreach ($lines as $line) { |
|
470 | 470 | $matches = []; |
471 | 471 | if (preg_match("|Name:[\s]+(.*)|", $line, $matches)) { |
472 | 472 | $iface = $matches[1]; |
@@ -180,8 +180,7 @@ discard block |
||
180 | 180 | // yes it did!! |
181 | 181 | |
182 | 182 | // store the details |
183 | - foreach($groupDef->details->machines as $hostId => $machine) |
|
184 | - { |
|
183 | + foreach($groupDef->details->machines as $hostId => $machine) { |
|
185 | 184 | // we want all the details from the config file |
186 | 185 | $vmDetails = clone $machine; |
187 | 186 | |
@@ -417,7 +416,8 @@ discard block |
||
417 | 416 | * Set the VAGRANT_BRIDGE_ADAPTER and VIRTUALBOX_BRIDGE_ADAPTER |
418 | 417 | * environmental variables. |
419 | 418 | */ |
420 | - public function setVagrantBridgedInterface() { |
|
419 | + public function setVagrantBridgedInterface() |
|
420 | + { |
|
421 | 421 | $bridgedIface = $this->determineBridgedInterface(); |
422 | 422 | putenv('VAGRANT_BRIDGE_ADAPTER='.$bridgedIface); |
423 | 423 | putenv('VIRTUALBOX_BRIDGE_ADAPTER='.$bridgedIface); |
@@ -439,7 +439,8 @@ discard block |
||
439 | 439 | $log->endAction('Returning configured '.$vagrantSettings->bridgedIface.' interface'); |
440 | 440 | return $vagrantSettings->bridgedIface; |
441 | 441 | } |
442 | - } catch (E5xx_ActionFailed $e) { |
|
442 | + } |
|
443 | + catch (E5xx_ActionFailed $e) { |
|
443 | 444 | // ignore errors as this setting may not exist |
444 | 445 | } |
445 | 446 | |
@@ -502,8 +503,7 @@ discard block |
||
502 | 503 | getenv("HOME") . "/.vagrant.d/insecure_private_key" |
503 | 504 | ]; |
504 | 505 | |
505 | - foreach ($keyFilenames as $keyFilename) |
|
506 | - { |
|
506 | + foreach ($keyFilenames as $keyFilename) { |
|
507 | 507 | usingLog()->writeToLog("checking if {$keyFilename} exists"); |
508 | 508 | if (file_exists($keyFilename)) { |
509 | 509 | $log->endAction($keyFilename); |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | */ |
58 | 58 | trait ActiveSystemUnderTestConfigSupport |
59 | 59 | { |
60 | - public $activeSystemUnderTestName; |
|
60 | + public $activeSystemUnderTestName; |
|
61 | 61 | public $activeSystemUnderTestConfig; |
62 | 62 | |
63 | - public function initActiveSystemUnderTestConfigSupport($sutName, $injectables) |
|
64 | - { |
|
63 | + public function initActiveSystemUnderTestConfigSupport($sutName, $injectables) |
|
64 | + { |
|
65 | 65 | // does the system-under-test exist? |
66 | 66 | if (!$injectables->knownSystemsUnderTestList->hasEntry($sutName)) { |
67 | 67 | throw new E4xx_NoSuchSystemUnderTest($sutName); |
@@ -73,5 +73,5 @@ discard block |
||
73 | 73 | |
74 | 74 | // we need to merge the 'roles' section into our chosen test environment |
75 | 75 | $injectables->activeTestEnvironmentConfig->mergeSystemUnderTestConfig($this->activeSystemUnderTestConfig); |
76 | - } |
|
76 | + } |
|
77 | 77 | } |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | */ |
58 | 58 | trait ActiveTestEnvironmentConfigSupport |
59 | 59 | { |
60 | - public $activeTestEnvironmentName; |
|
60 | + public $activeTestEnvironmentName; |
|
61 | 61 | public $activeTestEnvironmentConfig; |
62 | 62 | |
63 | - public function initActiveTestEnvironmentConfigSupport($envName, $injectables) |
|
64 | - { |
|
63 | + public function initActiveTestEnvironmentConfigSupport($envName, $injectables) |
|
64 | + { |
|
65 | 65 | // does the test environment exist? |
66 | 66 | if (!$injectables->knownTestEnvironmentsList->hasEntry($envName)) { |
67 | 67 | throw new E4xx_NoSuchTestEnvironment($envName); |
@@ -72,5 +72,5 @@ discard block |
||
72 | 72 | |
73 | 73 | // remember the environment name |
74 | 74 | $this->activeTestEnvironmentName = $envName; |
75 | - } |
|
75 | + } |
|
76 | 76 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | public function __construct($sutName) |
62 | 62 | { |
63 | 63 | $msg = "Unknown system under test '{$sutName}'; we have no config for it" . PHP_EOL . PHP_EOL |
64 | - . "Use 'storyplayer --list-sut' to see the list of known systems under test"; |
|
64 | + . "Use 'storyplayer --list-sut' to see the list of known systems under test"; |
|
65 | 65 | parent::__construct(400, $msg, $msg); |
66 | 66 | } |
67 | 67 | } |
68 | 68 | \ No newline at end of file |
@@ -61,7 +61,7 @@ |
||
61 | 61 | public function __construct($envName) |
62 | 62 | { |
63 | 63 | $msg = "Unknown test environment '{$envName}'; we have no config for it" . PHP_EOL . PHP_EOL |
64 | - . "Use 'storyplayer list-test-environments' to see the list of known test environments"; |
|
64 | + . "Use 'storyplayer list-test-environments' to see the list of known test environments"; |
|
65 | 65 | parent::__construct(400, $msg, $msg); |
66 | 66 | } |
67 | 67 | } |
68 | 68 | \ No newline at end of file |
@@ -221,7 +221,7 @@ |
||
221 | 221 | |
222 | 222 | // SSH in and have a look |
223 | 223 | $command = "ps -ef | grep '{$pid}'"; |
224 | - $result = $this->runCommand($hostDetails, $command); |
|
224 | + $result = $this->runCommand($hostDetails, $command); |
|
225 | 225 | |
226 | 226 | // what did we find? |
227 | 227 | if ($result->didCommandFail() || empty($result->output)) { |
@@ -76,8 +76,7 @@ |
||
76 | 76 | // how do we do this? |
77 | 77 | if (isset($hostDetails->hostname)) { |
78 | 78 | $ipAddress = gethostbyname($hostDetails->hostname); |
79 | - if ($ipAddress != $hostDetails->hostname) |
|
80 | - { |
|
79 | + if ($ipAddress != $hostDetails->hostname) { |
|
81 | 80 | $log->endAction(["IP address is", $ipAddress]); |
82 | 81 | return $ipAddress; |
83 | 82 | } |
@@ -128,7 +128,7 @@ |
||
128 | 128 | // |
129 | 129 | // most of the world uses 127.0.0.1 |
130 | 130 | // ubuntu uses 127.0.1.1 (no idea why) |
131 | - $validIps = [ '127.0.0.1', '127.0.1.1' ]; |
|
131 | + $validIps = ['127.0.0.1', '127.0.1.1']; |
|
132 | 132 | if (!in_array($hostDetails->ipAddress, $validIps)) { |
133 | 133 | // this hostname is *not* safe |
134 | 134 | // |
@@ -258,10 +258,10 @@ discard block |
||
258 | 258 | public function startStoryplayer($version, $url, $copyright, $license) |
259 | 259 | { |
260 | 260 | // enforce our inputs |
261 | - Contract::RequiresValue($version, is_string($version)); |
|
262 | - Contract::RequiresValue($url, is_string($url)); |
|
261 | + Contract::RequiresValue($version, is_string($version)); |
|
262 | + Contract::RequiresValue($url, is_string($url)); |
|
263 | 263 | Contract::RequiresValue($copyright, is_string($copyright)); |
264 | - Contract::RequiresValue($license, is_string($license)); |
|
264 | + Contract::RequiresValue($license, is_string($license)); |
|
265 | 265 | |
266 | 266 | // call all of our plugins |
267 | 267 | foreach ($this->plugins as $plugin) |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | { |
299 | 299 | // ensure our inputs! |
300 | 300 | Contract::RequiresValue($activity, is_string($activity)); |
301 | - Contract::RequiresValue($name, is_string($name)); |
|
301 | + Contract::RequiresValue($name, is_string($name)); |
|
302 | 302 | |
303 | 303 | // call our plugins |
304 | 304 | foreach ($this->plugins as $plugin) |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | |
365 | 365 | // inject the captured activity into the phase |
366 | 366 | $phaseResult->activityLog = $this->activityLog; |
367 | - $this->activityLog=[]; |
|
367 | + $this->activityLog = []; |
|
368 | 368 | |
369 | 369 | // pass the phase on |
370 | 370 | foreach ($this->plugins as $plugin) |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | { |
448 | 448 | // enforce our inputs |
449 | 449 | Contract::RequiresValue($phaseName, is_string($phaseName)); |
450 | - Contract::RequiresValue($msg, is_string($msg)); |
|
450 | + Contract::RequiresValue($msg, is_string($msg)); |
|
451 | 451 | |
452 | 452 | // keep track of what was attempted, in case we need to show |
453 | 453 | // the user what was attempted |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | { |
478 | 478 | // enforce our inputs |
479 | 479 | Contract::RequiresValue($phaseName, is_string($phaseName)); |
480 | - Contract::RequiresValue($msg, is_string($msg)); |
|
480 | + Contract::RequiresValue($msg, is_string($msg)); |
|
481 | 481 | |
482 | 482 | // keep track of what was attempted, in case we need to show |
483 | 483 | // the user what was attempted |
@@ -179,8 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function resetSilentMode() |
181 | 181 | { |
182 | - foreach ($this->plugins as $plugin) |
|
183 | - { |
|
182 | + foreach ($this->plugins as $plugin) { |
|
184 | 183 | $plugin->resetSilentMode(); |
185 | 184 | } |
186 | 185 | } |
@@ -196,8 +195,7 @@ discard block |
||
196 | 195 | */ |
197 | 196 | public function setSilentMode() |
198 | 197 | { |
199 | - foreach ($this->plugins as $plugin) |
|
200 | - { |
|
198 | + foreach ($this->plugins as $plugin) { |
|
201 | 199 | $plugin->setSilentMode(); |
202 | 200 | } |
203 | 201 | } |
@@ -209,8 +207,7 @@ discard block |
||
209 | 207 | */ |
210 | 208 | public function disableColourSupport() |
211 | 209 | { |
212 | - foreach ($this->plugins as $plugin) |
|
213 | - { |
|
210 | + foreach ($this->plugins as $plugin) { |
|
214 | 211 | $plugin->disableColourSupport(); |
215 | 212 | } |
216 | 213 | } |
@@ -222,8 +219,7 @@ discard block |
||
222 | 219 | */ |
223 | 220 | public function enforceColourSupport() |
224 | 221 | { |
225 | - foreach ($this->plugins as $plugin) |
|
226 | - { |
|
222 | + foreach ($this->plugins as $plugin) { |
|
227 | 223 | $plugin->enforceColourSupport(); |
228 | 224 | } |
229 | 225 | } |
@@ -240,8 +236,7 @@ discard block |
||
240 | 236 | */ |
241 | 237 | public function enableColourSupport() |
242 | 238 | { |
243 | - foreach ($this->plugins as $plugin) |
|
244 | - { |
|
239 | + foreach ($this->plugins as $plugin) { |
|
245 | 240 | $plugin->enableColourSupport(); |
246 | 241 | } |
247 | 242 | } |
@@ -264,8 +259,7 @@ discard block |
||
264 | 259 | Contract::RequiresValue($license, is_string($license)); |
265 | 260 | |
266 | 261 | // call all of our plugins |
267 | - foreach ($this->plugins as $plugin) |
|
268 | - { |
|
262 | + foreach ($this->plugins as $plugin) { |
|
269 | 263 | $plugin->startStoryplayer($version, $url, $copyright, $license); |
270 | 264 | } |
271 | 265 | } |
@@ -279,8 +273,7 @@ discard block |
||
279 | 273 | */ |
280 | 274 | public function endStoryplayer($duration) |
281 | 275 | { |
282 | - foreach ($this->plugins as $plugin) |
|
283 | - { |
|
276 | + foreach ($this->plugins as $plugin) { |
|
284 | 277 | $plugin->endStoryplayer($duration); |
285 | 278 | } |
286 | 279 | } |
@@ -301,8 +294,7 @@ discard block |
||
301 | 294 | Contract::RequiresValue($name, is_string($name)); |
302 | 295 | |
303 | 296 | // call our plugins |
304 | - foreach ($this->plugins as $plugin) |
|
305 | - { |
|
297 | + foreach ($this->plugins as $plugin) { |
|
306 | 298 | $plugin->startPhaseGroup($activity, $name); |
307 | 299 | } |
308 | 300 | } |
@@ -323,8 +315,7 @@ discard block |
||
323 | 315 | Contract::Requires($result instanceof PhaseGroup_Result); |
324 | 316 | |
325 | 317 | // call our plugins |
326 | - foreach ($this->plugins as $plugin) |
|
327 | - { |
|
318 | + foreach ($this->plugins as $plugin) { |
|
328 | 319 | $plugin->endPhaseGroup($result); |
329 | 320 | } |
330 | 321 | } |
@@ -341,8 +332,7 @@ discard block |
||
341 | 332 | // enforce our input type |
342 | 333 | Contract::Requires($phase instanceof Phase); |
343 | 334 | |
344 | - foreach ($this->plugins as $plugin) |
|
345 | - { |
|
335 | + foreach ($this->plugins as $plugin) { |
|
346 | 336 | $plugin->startPhase($phase); |
347 | 337 | } |
348 | 338 | } |
@@ -367,8 +357,7 @@ discard block |
||
367 | 357 | $this->activityLog=[]; |
368 | 358 | |
369 | 359 | // pass the phase on |
370 | - foreach ($this->plugins as $plugin) |
|
371 | - { |
|
360 | + foreach ($this->plugins as $plugin) { |
|
372 | 361 | $plugin->endPhase($phase, $phaseResult); |
373 | 362 | } |
374 | 363 | } |
@@ -400,8 +389,7 @@ discard block |
||
400 | 389 | ]; |
401 | 390 | |
402 | 391 | // call all of our plugins |
403 | - foreach ($this->plugins as $plugin) |
|
404 | - { |
|
392 | + foreach ($this->plugins as $plugin) { |
|
405 | 393 | $plugin->logPhaseActivity($msg, $codeLine); |
406 | 394 | } |
407 | 395 | } |
@@ -428,8 +416,7 @@ discard block |
||
428 | 416 | ]; |
429 | 417 | |
430 | 418 | // call all of our plugins |
431 | - foreach ($this->plugins as $plugin) |
|
432 | - { |
|
419 | + foreach ($this->plugins as $plugin) { |
|
433 | 420 | $plugin->logPhaseSubprocessOutput($msg); |
434 | 421 | } |
435 | 422 | } |
@@ -458,8 +445,7 @@ discard block |
||
458 | 445 | ]; |
459 | 446 | |
460 | 447 | // call all of our plugins |
461 | - foreach ($this->plugins as $plugin) |
|
462 | - { |
|
448 | + foreach ($this->plugins as $plugin) { |
|
463 | 449 | $plugin->logPhaseError($phaseName, $msg); |
464 | 450 | } |
465 | 451 | } |
@@ -488,8 +474,7 @@ discard block |
||
488 | 474 | ]; |
489 | 475 | |
490 | 476 | // call all of our plugins |
491 | - foreach ($this->plugins as $plugin) |
|
492 | - { |
|
477 | + foreach ($this->plugins as $plugin) { |
|
493 | 478 | $plugin->logPhaseSkipped($phaseName, $msg); |
494 | 479 | } |
495 | 480 | } |
@@ -508,8 +493,7 @@ discard block |
||
508 | 493 | Contract::RequiresValue($codeLine, is_array($codeLine)); |
509 | 494 | |
510 | 495 | // pass it on to all of our plugins |
511 | - foreach ($this->plugins as $plugin) |
|
512 | - { |
|
496 | + foreach ($this->plugins as $plugin) { |
|
513 | 497 | $plugin->logPhaseCodeLine($codeLine); |
514 | 498 | } |
515 | 499 | } |
@@ -528,8 +512,7 @@ discard block |
||
528 | 512 | Contract::RequiresValue($msg, is_string($msg)); |
529 | 513 | |
530 | 514 | // pass it on to our plugins |
531 | - foreach ($this->plugins as $plugin) |
|
532 | - { |
|
515 | + foreach ($this->plugins as $plugin) { |
|
533 | 516 | $plugin->logCliError($msg); |
534 | 517 | } |
535 | 518 | } |
@@ -550,8 +533,7 @@ discard block |
||
550 | 533 | Contract::RequiresValue($e, $e instanceof Exception); |
551 | 534 | |
552 | 535 | // pass this on to our plugins |
553 | - foreach ($this->plugins as $plugin) |
|
554 | - { |
|
536 | + foreach ($this->plugins as $plugin) { |
|
555 | 537 | $plugin->logCliErrorWithException($msg, $e); |
556 | 538 | } |
557 | 539 | } |
@@ -570,8 +552,7 @@ discard block |
||
570 | 552 | Contract::RequiresValue($msg, is_string($msg)); |
571 | 553 | |
572 | 554 | // pass this on to our plugins |
573 | - foreach ($this->plugins as $plugin) |
|
574 | - { |
|
555 | + foreach ($this->plugins as $plugin) { |
|
575 | 556 | $plugin->logCliWarning($msg); |
576 | 557 | } |
577 | 558 | } |
@@ -590,8 +571,7 @@ discard block |
||
590 | 571 | Contract::RequiresValue($msg, is_string($msg)); |
591 | 572 | |
592 | 573 | // pass this on to our plugins |
593 | - foreach ($this->plugins as $plugin) |
|
594 | - { |
|
574 | + foreach ($this->plugins as $plugin) { |
|
595 | 575 | $plugin->logCliInfo($msg); |
596 | 576 | } |
597 | 577 | } |
@@ -614,8 +594,7 @@ discard block |
||
614 | 594 | // $var can be anything, so there is no contract to enforce |
615 | 595 | |
616 | 596 | // pass this on to our plugins |
617 | - foreach ($this->plugins as $plugin) |
|
618 | - { |
|
597 | + foreach ($this->plugins as $plugin) { |
|
619 | 598 | $plugin->logVardump($name, $var); |
620 | 599 | } |
621 | 600 | } |