@@ -72,17 +72,17 @@ |
||
72 | 72 | // defaults for Chrome, running locally |
73 | 73 | $config = $this->newConfig('chrome')->getConfig(); |
74 | 74 | $config->adapter = 'LocalWebDriver'; |
75 | - $config->browser = 'chrome'; |
|
75 | + $config->browser = 'chrome'; |
|
76 | 76 | |
77 | 77 | // defaults for Firefox, running locally |
78 | 78 | $config = $this->newConfig('firefox')->getConfig(); |
79 | 79 | $config->adapter = 'LocalWebDriver'; |
80 | - $config->browser = 'firefox'; |
|
80 | + $config->browser = 'firefox'; |
|
81 | 81 | |
82 | 82 | // defaults for Safari, running locally |
83 | 83 | $config = $this->newConfig('safari')->getConfig(); |
84 | 84 | $config->adapter = 'LocalWebDriver'; |
85 | - $config->browser = 'safari'; |
|
85 | + $config->browser = 'safari'; |
|
86 | 86 | |
87 | 87 | // ---------------------------------------------------------------- |
88 | 88 | // |
@@ -70,17 +70,17 @@ |
||
70 | 70 | // defaults for Chrome, running locally |
71 | 71 | $this->chrome = new BaseObject; |
72 | 72 | $this->chrome->adapter = 'LocalWebDriver'; |
73 | - $this->chrome->browser = 'chrome'; |
|
73 | + $this->chrome->browser = 'chrome'; |
|
74 | 74 | |
75 | 75 | // defaults for Firefox, running locally |
76 | 76 | $this->firefox = new BaseObject; |
77 | 77 | $this->firefox->adapter = 'LocalWebDriver'; |
78 | - $this->firefox->browser = 'firefox'; |
|
78 | + $this->firefox->browser = 'firefox'; |
|
79 | 79 | |
80 | 80 | // defaults for Safari, running locally |
81 | 81 | $this->safari = new BaseObject; |
82 | 82 | $this->safari->adapter = 'LocalWebDriver'; |
83 | - $this->safari->browser = 'safari'; |
|
83 | + $this->safari->browser = 'safari'; |
|
84 | 84 | |
85 | 85 | // ---------------------------------------------------------------- |
86 | 86 | // |
@@ -73,10 +73,10 @@ |
||
73 | 73 | |
74 | 74 | // build the Sauce Labs url |
75 | 75 | $url = "http://" |
76 | - . urlencode($this->browserDetails->saucelabs->username) |
|
77 | - . ':' |
|
78 | - . urlencode($this->browserDetails->saucelabs->accesskey) |
|
79 | - . '@ondemand.saucelabs.com/wd/hub'; |
|
76 | + . urlencode($this->browserDetails->saucelabs->username) |
|
77 | + . ':' |
|
78 | + . urlencode($this->browserDetails->saucelabs->accesskey) |
|
79 | + . '@ondemand.saucelabs.com/wd/hub'; |
|
80 | 80 | |
81 | 81 | // build the Sauce Labs capabilities array |
82 | 82 | $desiredCapabilities = $this->browserDetails->desiredCapabilities; |
@@ -87,7 +87,7 @@ |
||
87 | 87 | // due to encoding errors at SauceLabs, we can't use '>' as a |
88 | 88 | // delimiter in the story's name |
89 | 89 | $story = $st->getStory(); |
90 | - $desiredCapabilities['name'] = $st->getTestEnvironmentName() . ' / ' . $st->getCurrentPhase() . ': ' . $st->getCurrentPhaseName() . ' / '. $story->getName(); |
|
90 | + $desiredCapabilities['name'] = $st->getTestEnvironmentName() . ' / ' . $st->getCurrentPhase() . ': ' . $st->getCurrentPhaseName() . ' / ' . $story->getName(); |
|
91 | 91 | |
92 | 92 | // create the browser session |
93 | 93 | $webDriver = new WebDriverClient($url); |
@@ -104,15 +104,13 @@ |
||
104 | 104 | public function stop() |
105 | 105 | { |
106 | 106 | // stop the web browser |
107 | - if (is_object($this->browserSession)) |
|
108 | - { |
|
107 | + if (is_object($this->browserSession)) { |
|
109 | 108 | $this->browserSession->close(); |
110 | 109 | $this->browserSession = null; |
111 | 110 | } |
112 | 111 | |
113 | 112 | // now stop the proxy |
114 | - if (is_object($this->proxySession)) |
|
115 | - { |
|
113 | + if (is_object($this->proxySession)) { |
|
116 | 114 | try { |
117 | 115 | $this->proxySession->close(); |
118 | 116 | } |
@@ -140,8 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | }); |
142 | 142 | } |
143 | - catch (Exception $e) |
|
144 | - { |
|
143 | + catch (Exception $e) { |
|
145 | 144 | // something went wrong |
146 | 145 | $log->endAction("VM failed to provision :("); |
147 | 146 | throw new E5xx_ActionFailed(__METHOD__, $e->getMessage()); |
@@ -163,8 +162,7 @@ discard block |
||
163 | 162 | $vmDetails->ec2Instance = $response['Instances'][0]; |
164 | 163 | }); |
165 | 164 | } |
166 | - catch (Exception $e) |
|
167 | - { |
|
165 | + catch (Exception $e) { |
|
168 | 166 | // something went wrong |
169 | 167 | $log->endAction("VM failed to start :("); |
170 | 168 | throw new E5xx_ActionFailed(__METHOD__, $e->getMessage()); |
@@ -236,8 +234,7 @@ discard block |
||
236 | 234 | $vmDetails->ec2Instance = $response['Instances'][0]; |
237 | 235 | }); |
238 | 236 | } |
239 | - catch (Exception $e) |
|
240 | - { |
|
237 | + catch (Exception $e) { |
|
241 | 238 | // something went wrong |
242 | 239 | $log->endAction("VM failed to start :("); |
243 | 240 | throw new E5xx_ActionFailed(__METHOD__, $e->getMessage()); |
@@ -299,8 +296,7 @@ discard block |
||
299 | 296 | $vmDetails->ec2Instance = $response['Instances'][0]; |
300 | 297 | }); |
301 | 298 | } |
302 | - catch (Exception $e) |
|
303 | - { |
|
299 | + catch (Exception $e) { |
|
304 | 300 | // something went wrong |
305 | 301 | $log->endAction("VM failed to stop :("); |
306 | 302 | throw new E5xx_ActionFailed(__METHOD__, $e->getMessage()); |
@@ -374,8 +370,7 @@ discard block |
||
374 | 370 | )); |
375 | 371 | }); |
376 | 372 | } |
377 | - catch (Exception $e) |
|
378 | - { |
|
373 | + catch (Exception $e) { |
|
379 | 374 | // something went wrong |
380 | 375 | $log->endAction("VM failed to terminate :("); |
381 | 376 | throw new E5xx_ActionFailed(__METHOD__, $e->getMessage()); |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | public function createHost($vmDetails, $provisioningVars = array()) |
90 | 90 | { |
91 | 91 | // what are we doing? |
92 | - $log =Log::usingLog()->startAction('provision new VM'); |
|
92 | + $log = Log::usingLog()->startAction('provision new VM'); |
|
93 | 93 | |
94 | 94 | // make sure we like the provided details |
95 | - foreach(array('name', 'environment', 'osName', 'amiId', 'securityGroup') as $param) { |
|
95 | + foreach (array('name', 'environment', 'osName', 'amiId', 'securityGroup') as $param) { |
|
96 | 96 | if (!isset($vmDetails->$param)) { |
97 | 97 | throw Exceptions::newActionFailedException(__METHOD__, "missing vmDetails['{$param}']"); |
98 | 98 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $client->createTags(array( |
133 | 133 | 'Resources' => array($response['Instances'][0]['InstanceId']), |
134 | 134 | 'Tags' => array( |
135 | - array ( |
|
135 | + array( |
|
136 | 136 | 'Key' => 'Name', |
137 | 137 | 'Value' => $vmDetails->ec2Name |
138 | 138 | ) |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | public function startHost($vmDetails) |
200 | 200 | { |
201 | 201 | // what are we doing? |
202 | - $log =Log::usingLog()->startAction("start VM"); |
|
202 | + $log = Log::usingLog()->startAction("start VM"); |
|
203 | 203 | |
204 | 204 | // is the VM actually running? |
205 | 205 | if ($this->isRunning($vmDetails)) { |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | public function stopHost($vmDetails) |
265 | 265 | { |
266 | 266 | // what are we doing? |
267 | - $log =Log::usingLog()->startAction("stop VM"); |
|
267 | + $log = Log::usingLog()->startAction("stop VM"); |
|
268 | 268 | |
269 | 269 | // is the VM actually running? |
270 | 270 | if (!$this->isRunning($vmDetails)) { |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | public function restartHost($vmDetails) |
320 | 320 | { |
321 | 321 | // what are we doing? |
322 | - $log =Log::usingLog()->startAction("restart VM"); |
|
322 | + $log = Log::usingLog()->startAction("restart VM"); |
|
323 | 323 | |
324 | 324 | // stop and start |
325 | 325 | $this->stopHost($vmDetails); |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | public function destroyHost($vmDetails) |
351 | 351 | { |
352 | 352 | // what are we doing? |
353 | - $log =Log::usingLog()->startAction("destroy VM"); |
|
353 | + $log = Log::usingLog()->startAction("destroy VM"); |
|
354 | 354 | |
355 | 355 | // get our Ec2 client from the SDK |
356 | 356 | $client = fromAws()->getEc2Client(); |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | public function isRunning($vmDetails) |
420 | 420 | { |
421 | 421 | // what are we doing? |
422 | - $log =Log::usingLog()->startAction("determine status of EC2 VM '{$vmDetails->hostId}'"); |
|
422 | + $log = Log::usingLog()->startAction("determine status of EC2 VM '{$vmDetails->hostId}'"); |
|
423 | 423 | |
424 | 424 | // get the instance data |
425 | 425 | $instance = fromEc2()->getInstance($vmDetails->hostId); |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | public function determineIpAddress($vmDetails) |
447 | 447 | { |
448 | 448 | // what are we doing? |
449 | - $log =Log::usingLog()->startAction("determine IP address of EC2 VM '{$vmDetails->hostId}'"); |
|
449 | + $log = Log::usingLog()->startAction("determine IP address of EC2 VM '{$vmDetails->hostId}'"); |
|
450 | 450 | |
451 | 451 | // we need to get a fresh copy of the instance details |
452 | 452 | $dnsName = fromEc2Instance($vmDetails->hostId)->getPublicDnsName(); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | if (empty($groupDef->details->machines)) { |
100 | 100 | throw new E5xx_ActionFailed(__METHOD__, "groupDef->details->machines cannot be empty"); |
101 | 101 | } |
102 | - foreach($groupDef->details->machines as $hostId => $machine) { |
|
102 | + foreach ($groupDef->details->machines as $hostId => $machine) { |
|
103 | 103 | // TODO: it would be great to autodetect this one day |
104 | 104 | if (!isset($machine->roles)) { |
105 | 105 | throw new E5xx_ActionFailed(__METHOD__, "missing groupDef->details->machines['$hostId']->roles"); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | // if it is not, that is NOT our responsibility |
124 | 124 | |
125 | 125 | // store the details |
126 | - foreach($groupDef->details->machines as $hostId => $machine) |
|
126 | + foreach ($groupDef->details->machines as $hostId => $machine) |
|
127 | 127 | { |
128 | 128 | // we want all the details from the config file |
129 | 129 | $vmDetails = clone $machine; |
@@ -123,8 +123,7 @@ discard block |
||
123 | 123 | // if it is not, that is NOT our responsibility |
124 | 124 | |
125 | 125 | // store the details |
126 | - foreach($groupDef->details->machines as $hostId => $machine) |
|
127 | - { |
|
126 | + foreach($groupDef->details->machines as $hostId => $machine) { |
|
128 | 127 | // we want all the details from the config file |
129 | 128 | $vmDetails = clone $machine; |
130 | 129 | |
@@ -205,8 +204,7 @@ discard block |
||
205 | 204 | $log = usingLog()->startAction("de-register blackbox(es)"); |
206 | 205 | |
207 | 206 | // de-register all the hosts |
208 | - foreach ($groupDef->details->machines as $hostId => $machine) |
|
209 | - { |
|
207 | + foreach ($groupDef->details->machines as $hostId => $machine) { |
|
210 | 208 | foreach ($machine->roles as $role) { |
211 | 209 | usingRolesTable()->removeHostFromAllRoles($hostId); |
212 | 210 | } |
@@ -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]; |
@@ -181,8 +181,7 @@ discard block |
||
181 | 181 | // yes it did!! |
182 | 182 | |
183 | 183 | // store the details |
184 | - foreach($groupDef->details->machines as $hostId => $machine) |
|
185 | - { |
|
184 | + foreach($groupDef->details->machines as $hostId => $machine) { |
|
186 | 185 | // we want all the details from the config file |
187 | 186 | $vmDetails = clone $machine; |
188 | 187 | |
@@ -418,7 +417,8 @@ discard block |
||
418 | 417 | * Set the VAGRANT_BRIDGE_ADAPTER and VIRTUALBOX_BRIDGE_ADAPTER |
419 | 418 | * environmental variables. |
420 | 419 | */ |
421 | - public function setVagrantBridgedInterface() { |
|
420 | + public function setVagrantBridgedInterface() |
|
421 | + { |
|
422 | 422 | $bridgedIface = $this->determineBridgedInterface(); |
423 | 423 | putenv('VAGRANT_BRIDGE_ADAPTER='.$bridgedIface); |
424 | 424 | putenv('VIRTUALBOX_BRIDGE_ADAPTER='.$bridgedIface); |
@@ -440,7 +440,8 @@ discard block |
||
440 | 440 | $log->endAction('Returning configured '.$vagrantSettings->bridgedIface.' interface'); |
441 | 441 | return $vagrantSettings->bridgedIface; |
442 | 442 | } |
443 | - } catch (Exception $e) { |
|
443 | + } |
|
444 | + catch (Exception $e) { |
|
444 | 445 | // ignore errors as this setting may not exist |
445 | 446 | } |
446 | 447 | |
@@ -503,8 +504,7 @@ discard block |
||
503 | 504 | getenv("HOME") . "/.vagrant.d/insecure_private_key" |
504 | 505 | ]; |
505 | 506 | |
506 | - foreach ($keyFilenames as $keyFilename) |
|
507 | - { |
|
507 | + foreach ($keyFilenames as $keyFilename) { |
|
508 | 508 | usingLog()->writeToLog("checking if {$keyFilename} exists"); |
509 | 509 | if (file_exists($keyFilename)) { |
510 | 510 | $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 | } |