@@ -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 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $log = usingLog()->startAction('provision new VM'); |
| 92 | 92 | |
| 93 | 93 | // make sure we like the provided details |
| 94 | - foreach(array('name', 'environment', 'osName', 'amiId', 'securityGroup') as $param) { |
|
| 94 | + foreach (array('name', 'environment', 'osName', 'amiId', 'securityGroup') as $param) { |
|
| 95 | 95 | if (!isset($vmDetails->$param)) { |
| 96 | 96 | throw new E5xx_ActionFailed(__METHOD__, "missing vmDetails['{$param}']"); |
| 97 | 97 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $client->createTags(array( |
| 132 | 132 | 'Resources' => array($response['Instances'][0]['InstanceId']), |
| 133 | 133 | 'Tags' => array( |
| 134 | - array ( |
|
| 134 | + array( |
|
| 135 | 135 | 'Key' => 'Name', |
| 136 | 136 | 'Value' => $vmDetails->ec2Name |
| 137 | 137 | ) |
@@ -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()); |
@@ -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]; |
@@ -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 | } |