@@ -125,6 +125,9 @@ discard block |
||
| 125 | 125 | return $value; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | + /** |
|
| 129 | + * @param string $setting |
|
| 130 | + */ |
|
| 128 | 131 | public function getModuleSetting($setting) |
| 129 | 132 | { |
| 130 | 133 | // what are we doing? |
@@ -154,7 +157,7 @@ discard block |
||
| 154 | 157 | * We've standardised on 'getConfig()' as the documented name for this |
| 155 | 158 | * functionality across all three of the config-related modules. |
| 156 | 159 | * |
| 157 | - * @return object |
|
| 160 | + * @return string |
|
| 158 | 161 | */ |
| 159 | 162 | public function getAllSettings() |
| 160 | 163 | { |
@@ -132,7 +132,7 @@ |
||
| 132 | 132 | |
| 133 | 133 | // get the details |
| 134 | 134 | $fullPath = 'target.moduleSettings.' . $setting; |
| 135 | - $config = $this->st->getConfig(); |
|
| 135 | + $config = $this->st->getConfig(); |
|
| 136 | 136 | |
| 137 | 137 | $value = null; |
| 138 | 138 | if ($config->hasData($fullPath)) { |
@@ -114,6 +114,9 @@ discard block |
||
| 114 | 114 | return $result; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | + /** |
|
| 118 | + * @param string $command |
|
| 119 | + */ |
|
| 117 | 120 | public function runCommandAndIgnoreErrors($command) |
| 118 | 121 | { |
| 119 | 122 | // what are we doing? |
@@ -156,6 +159,9 @@ discard block |
||
| 156 | 159 | return $result; |
| 157 | 160 | } |
| 158 | 161 | |
| 162 | + /** |
|
| 163 | + * @param string $commandLine |
|
| 164 | + */ |
|
| 159 | 165 | public function startInScreen($sessionName, $commandLine) |
| 160 | 166 | { |
| 161 | 167 | // what are we doing? |
@@ -242,7 +242,7 @@ |
||
| 242 | 242 | |
| 243 | 243 | // has this worked? |
| 244 | 244 | $isStopped = $log->addStep("wait for process to terminate", function() use($pid, $grace, $log) { |
| 245 | - for($i = 0; $i < $grace; $i++) { |
|
| 245 | + for ($i = 0; $i < $grace; $i++) { |
|
| 246 | 246 | if (!fromHost($this->args[0])->getPidIsRunning($pid)) { |
| 247 | 247 | return true; |
| 248 | 248 | } |
@@ -62,6 +62,10 @@ |
||
| 62 | 62 | */ |
| 63 | 63 | class UsingPDODB extends Prose |
| 64 | 64 | { |
| 65 | + /** |
|
| 66 | + * @param \DataSift\Storyplayer\PlayerLib\StoryTeller $st |
|
| 67 | + * @param PDO[] $args |
|
| 68 | + */ |
|
| 65 | 69 | public function __construct($st, $args) |
| 66 | 70 | { |
| 67 | 71 | // call our parent first |
@@ -81,8 +81,7 @@ discard block |
||
| 81 | 81 | // what are we doing? |
| 82 | 82 | $log = usingLog()->startAction(["run SQL query:", $sql, "/ with params:", $params, "and driver params:", $driverParams]); |
| 83 | 83 | |
| 84 | - try |
|
| 85 | - { |
|
| 84 | + try { |
|
| 86 | 85 | // create a prepared statement |
| 87 | 86 | // |
| 88 | 87 | // we do this so that we can inject the $params into the SQL statement |
@@ -95,8 +94,7 @@ discard block |
||
| 95 | 94 | $log->endAction(); |
| 96 | 95 | return $stmt; |
| 97 | 96 | } |
| 98 | - catch (Exception $e) |
|
| 99 | - { |
|
| 97 | + catch (Exception $e) { |
|
| 100 | 98 | throw new E5xx_ActionFailed(__METHOD__, $e->getMessage()); |
| 101 | 99 | } |
| 102 | 100 | } |
@@ -106,8 +104,7 @@ discard block |
||
| 106 | 104 | // what are we doing? |
| 107 | 105 | $log = usingLog()->startAction(["run raw SQL query:", $sql, "with driver params: ", $driverParams]); |
| 108 | 106 | |
| 109 | - try |
|
| 110 | - { |
|
| 107 | + try { |
|
| 111 | 108 | // execute the prepared statement |
| 112 | 109 | // |
| 113 | 110 | // we do this directly so that you can (hopefully) attempt |
@@ -118,8 +115,7 @@ discard block |
||
| 118 | 115 | $log->endAction(); |
| 119 | 116 | return $stmt; |
| 120 | 117 | } |
| 121 | - catch (Exception $e) |
|
| 122 | - { |
|
| 118 | + catch (Exception $e) { |
|
| 123 | 119 | throw new E5xx_ActionFailed(__METHOD__, $e->getMessage()); |
| 124 | 120 | } |
| 125 | 121 | } |
@@ -129,15 +125,13 @@ discard block |
||
| 129 | 125 | // what are we doing? |
| 130 | 126 | $log = usingLog()->startAction("begin PDO database transaction"); |
| 131 | 127 | |
| 132 | - try |
|
| 133 | - { |
|
| 128 | + try { |
|
| 134 | 129 | $this->args[0]->beginTransaction(); |
| 135 | 130 | |
| 136 | 131 | // all done |
| 137 | 132 | $log->endAction(); |
| 138 | 133 | } |
| 139 | - catch (Exception $e) |
|
| 140 | - { |
|
| 134 | + catch (Exception $e) { |
|
| 141 | 135 | throw new E5xx_ActionFailed(__METHOD__, $e->getMessage()); |
| 142 | 136 | } |
| 143 | 137 | } |
@@ -147,15 +141,13 @@ discard block |
||
| 147 | 141 | // what are we doing? |
| 148 | 142 | $log = usingLog()->startAction("commit PDO database transaction"); |
| 149 | 143 | |
| 150 | - try |
|
| 151 | - { |
|
| 144 | + try { |
|
| 152 | 145 | $this->args[0]->commit(); |
| 153 | 146 | |
| 154 | 147 | // all done |
| 155 | 148 | $log->endAction(); |
| 156 | 149 | } |
| 157 | - catch (Exception $e) |
|
| 158 | - { |
|
| 150 | + catch (Exception $e) { |
|
| 159 | 151 | throw new E5xx_ActionFailed(__METHOD__, $e->getMessage()); |
| 160 | 152 | } |
| 161 | 153 | } |
@@ -165,15 +157,13 @@ discard block |
||
| 165 | 157 | // what are we doing? |
| 166 | 158 | $log = usingLog()->startAction("rollback PDO database transaction"); |
| 167 | 159 | |
| 168 | - try |
|
| 169 | - { |
|
| 160 | + try { |
|
| 170 | 161 | $this->args[0]->rollBack(); |
| 171 | 162 | |
| 172 | 163 | // all done |
| 173 | 164 | $log->endAction(); |
| 174 | 165 | } |
| 175 | - catch (Exception $e) |
|
| 176 | - { |
|
| 166 | + catch (Exception $e) { |
|
| 177 | 167 | throw new E5xx_ActionFailed(__METHOD__, $e->getMessage()); |
| 178 | 168 | } |
| 179 | 169 | } |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | * the group that we belong to |
| 70 | 70 | * @param string $hostId |
| 71 | 71 | * the alias for this host |
| 72 | - * @return object |
|
| 72 | + * @return Vagrant_VirtualboxHostDefinition |
|
| 73 | 73 | * a host definition to populate |
| 74 | 74 | */ |
| 75 | 75 | public function newHostDefinition(TestEnvironment_GroupDefinition $groupDef, $hostId) |
@@ -62,18 +62,18 @@ |
||
| 62 | 62 | |
| 63 | 63 | class Vagrant_VirtualboxHostAdapter extends Vagrant_HostAdapter |
| 64 | 64 | { |
| 65 | - /** |
|
| 66 | - * create an empty host definition for this kind of host |
|
| 67 | - * |
|
| 68 | - * @param TestEnvironment_GroupDefinition $groupDef |
|
| 69 | - * the group that we belong to |
|
| 70 | - * @param string $hostId |
|
| 71 | - * the alias for this host |
|
| 72 | - * @return object |
|
| 73 | - * a host definition to populate |
|
| 74 | - */ |
|
| 75 | - public function newHostDefinition(TestEnvironment_GroupDefinition $groupDef, $hostId) |
|
| 76 | - { |
|
| 77 | - return new Vagrant_VirtualboxHostDefinition($groupDef, $hostId, $this); |
|
| 78 | - } |
|
| 65 | + /** |
|
| 66 | + * create an empty host definition for this kind of host |
|
| 67 | + * |
|
| 68 | + * @param TestEnvironment_GroupDefinition $groupDef |
|
| 69 | + * the group that we belong to |
|
| 70 | + * @param string $hostId |
|
| 71 | + * the alias for this host |
|
| 72 | + * @return object |
|
| 73 | + * a host definition to populate |
|
| 74 | + */ |
|
| 75 | + public function newHostDefinition(TestEnvironment_GroupDefinition $groupDef, $hostId) |
|
| 76 | + { |
|
| 77 | + return new Vagrant_VirtualboxHostDefinition($groupDef, $hostId, $this); |
|
| 78 | + } |
|
| 79 | 79 | } |
| 80 | 80 | \ No newline at end of file |
@@ -121,11 +121,11 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | protected $tagTypes = array( |
| 123 | 123 | 'button' => array('input', 'button'), |
| 124 | - 'buttons' => array('input','button'), |
|
| 124 | + 'buttons' => array('input', 'button'), |
|
| 125 | 125 | 'cell' => 'td', |
| 126 | 126 | 'cells' => 'td', |
| 127 | - 'heading' => array('h1', 'h2', 'h3', 'h4', 'h5','h6'), |
|
| 128 | - 'headings' => array('h1', 'h2', 'h3', 'h4', 'h5','h6'), |
|
| 127 | + 'heading' => array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'), |
|
| 128 | + 'headings' => array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'), |
|
| 129 | 129 | 'link' => 'a', |
| 130 | 130 | 'links' => 'a', |
| 131 | 131 | 'orderedlist' => 'ol', |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | 'unorderedlist' => self::SINGLE_TARGET |
| 155 | 155 | ); |
| 156 | 156 | |
| 157 | - protected $searchTypes = array ( |
|
| 157 | + protected $searchTypes = array( |
|
| 158 | 158 | 'id' => 'ById', |
| 159 | 159 | 'label' => 'ByLabel', |
| 160 | 160 | 'labelled' => 'ByLabel', |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | { |
| 297 | 297 | // we need to know which element they want |
| 298 | 298 | $words = $this->convertMethodNameToWords($methodName); |
| 299 | - $indexType = $this->determineIndexType($words); |
|
| 299 | + $indexType = $this->determineIndexType($words); |
|
| 300 | 300 | |
| 301 | 301 | // get all the elements that match |
| 302 | 302 | $elements = $this->retrieveElements($methodName, $methodArgs); |
@@ -323,7 +323,8 @@ |
||
| 323 | 323 | $searchTerm = $methodArgs[0]; |
| 324 | 324 | |
| 325 | 325 | $searchType = $this->determineSearchType($words); |
| 326 | - if ($searchType === null) { // we do not understand how to find the target field |
|
| 326 | + if ($searchType === null) { |
|
| 327 | +// we do not understand how to find the target field |
|
| 327 | 328 | throw new E5xx_ActionFailed(__CLASS__ . '::' . $methodName, "could not work out how to find the target to action upon"); |
| 328 | 329 | } |
| 329 | 330 | |
@@ -245,8 +245,7 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | // search all of the label elements to find an associated input |
| 247 | 247 | // element that we can safely use |
| 248 | - foreach ($labelElements as $labelElement) |
|
| 249 | - { |
|
| 248 | + foreach ($labelElements as $labelElement) { |
|
| 250 | 249 | try { |
| 251 | 250 | // add each element that matches this label |
| 252 | 251 | $retval[] = $this->getElementAssociatedWithLabelElement($labelElement, $labelText); |
@@ -289,8 +288,7 @@ discard block |
||
| 289 | 288 | } |
| 290 | 289 | |
| 291 | 290 | // what do we do next? |
| 292 | - if ($inputElementId !== null) |
|
| 293 | - { |
|
| 291 | + if ($inputElementId !== null) { |
|
| 294 | 292 | // where does the 'for' attribute go? |
| 295 | 293 | try { |
| 296 | 294 | $inputElement = $log->addStep("find the input element with the id '{$inputElementId}'", function() use($topElement, $inputElementId) { |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | $words = $this->convertMethodNameToWords($methodName); |
| 88 | 88 | |
| 89 | 89 | // how many elements are we searching for? |
| 90 | - $countType = $this->determineCountType($words); |
|
| 90 | + $countType = $this->determineCountType($words); |
|
| 91 | 91 | |
| 92 | 92 | // get the elements we need |
| 93 | 93 | $elements = $this->retrieveElements($methodName, $methodArgs); |
@@ -302,7 +302,7 @@ |
||
| 302 | 302 | // do we skip destroying the test environment? |
| 303 | 303 | if ($this->st->getPersistTestEnvironment()) { |
| 304 | 304 | echo PHP_EOL . "* Warning: NOT destroying test environment" . PHP_EOL |
| 305 | - . " --reuse-target flag is set" . PHP_EOL; |
|
| 305 | + . " --reuse-target flag is set" . PHP_EOL; |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | // cleanup |
@@ -218,8 +218,7 @@ |
||
| 218 | 218 | // $this->playerList contains one or more things to play |
| 219 | 219 | // |
| 220 | 220 | // let's play each of them in order |
| 221 | - foreach ($this->playerList as $player) |
|
| 222 | - { |
|
| 221 | + foreach ($this->playerList as $player) { |
|
| 223 | 222 | // execute each player in turn |
| 224 | 223 | // |
| 225 | 224 | // they may also have their own list of nested players |
@@ -231,7 +231,7 @@ |
||
| 231 | 231 | |
| 232 | 232 | // setup signal handling |
| 233 | 233 | pcntl_signal(SIGTERM, array($this, 'sigtermHandler')); |
| 234 | - pcntl_signal(SIGINT , array($this, 'sigtermHandler')); |
|
| 234 | + pcntl_signal(SIGINT, array($this, 'sigtermHandler')); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | public function __construct() |
| 62 | 62 | { |
| 63 | 63 | $msg = "You need to use -s to specify which system to test." . PHP_EOL . PHP_EOL |
| 64 | - . "Use 'storyplayer --list-systems' to see the list of known systems under test."; |
|
| 64 | + . "Use 'storyplayer --list-systems' 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 |