@@ -105,11 +105,17 @@ |
||
105 | 105 | $activeConfig->roles = $rolesTable->$testEnvName; |
106 | 106 | } |
107 | 107 | |
108 | + /** |
|
109 | + * @param Injectables $injectables |
|
110 | + */ |
|
108 | 111 | public function mergeStoryplayerConfig($injectables, $spConf) |
109 | 112 | { |
110 | 113 | $this->mergeData('storyplayer', $spConf); |
111 | 114 | } |
112 | 115 | |
116 | + /** |
|
117 | + * @param Injectables $injectables |
|
118 | + */ |
|
113 | 119 | public function mergeSystemUnderTestConfig($injectables, SystemUnderTestConfig $sutConfig = null) |
114 | 120 | { |
115 | 121 | // do we have a system under test? |
@@ -75,43 +75,43 @@ discard block |
||
75 | 75 | */ |
76 | 76 | class ActiveConfig extends WrappedConfig |
77 | 77 | { |
78 | - public function init(Injectables $injectables) |
|
79 | - { |
|
80 | - // we start off with the built-in config |
|
81 | - $this->mergeData('storyplayer', $injectables->defaultConfig); |
|
82 | - |
|
83 | - // these are the initial variables we want |
|
84 | - $this->setData('storyplayer.ipAddress', $this->getHostIpAddress()); |
|
85 | - $this->setData('storyplayer.currentDir', getcwd()); |
|
86 | - $this->setData('storyplayer.user.home', getenv('HOME')); |
|
87 | - |
|
88 | - // we also want to link in the hosts and roles tables, to make |
|
89 | - // it a lot easier for Prose modules |
|
90 | - $activeConfig = $this->getConfig(); |
|
78 | + public function init(Injectables $injectables) |
|
79 | + { |
|
80 | + // we start off with the built-in config |
|
81 | + $this->mergeData('storyplayer', $injectables->defaultConfig); |
|
82 | + |
|
83 | + // these are the initial variables we want |
|
84 | + $this->setData('storyplayer.ipAddress', $this->getHostIpAddress()); |
|
85 | + $this->setData('storyplayer.currentDir', getcwd()); |
|
86 | + $this->setData('storyplayer.user.home', getenv('HOME')); |
|
87 | + |
|
88 | + // we also want to link in the hosts and roles tables, to make |
|
89 | + // it a lot easier for Prose modules |
|
90 | + $activeConfig = $this->getConfig(); |
|
91 | 91 | $runtimeConfig = $injectables->getRuntimeConfig(); |
92 | 92 | $runtimeConfigManager = $injectables->getRuntimeConfigManager(); |
93 | 93 | $testEnvName = $injectables->activeTestEnvironmentName; |
94 | 94 | |
95 | - $hostsTable = $runtimeConfigManager->getTable($runtimeConfig, 'hosts'); |
|
95 | + $hostsTable = $runtimeConfigManager->getTable($runtimeConfig, 'hosts'); |
|
96 | 96 | if (!isset($hostsTable->$testEnvName)) { |
97 | 97 | $hostsTable->$testEnvName = new BaseObject; |
98 | 98 | } |
99 | 99 | $activeConfig->hosts = $hostsTable->$testEnvName; |
100 | 100 | |
101 | - $rolesTable = $runtimeConfigManager->getTable($runtimeConfig, 'roles'); |
|
101 | + $rolesTable = $runtimeConfigManager->getTable($runtimeConfig, 'roles'); |
|
102 | 102 | if (!isset($rolesTable->$testEnvName)) { |
103 | 103 | $rolesTable->$testEnvName = new BaseObject; |
104 | 104 | } |
105 | 105 | $activeConfig->roles = $rolesTable->$testEnvName; |
106 | - } |
|
106 | + } |
|
107 | 107 | |
108 | - public function mergeStoryplayerConfig($injectables, $spConf) |
|
109 | - { |
|
110 | - $this->mergeData('storyplayer', $spConf); |
|
111 | - } |
|
108 | + public function mergeStoryplayerConfig($injectables, $spConf) |
|
109 | + { |
|
110 | + $this->mergeData('storyplayer', $spConf); |
|
111 | + } |
|
112 | 112 | |
113 | - public function mergeSystemUnderTestConfig($injectables, SystemUnderTestConfig $sutConfig = null) |
|
114 | - { |
|
113 | + public function mergeSystemUnderTestConfig($injectables, SystemUnderTestConfig $sutConfig = null) |
|
114 | + { |
|
115 | 115 | // do we have a system under test? |
116 | 116 | if (!isset($injectables->activeSystemUnderTestName) || $sutConfig === null) { |
117 | 117 | $this->setData('systemundertest', null); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | // merge in the loaded config |
125 | 125 | $this->mergeData('systemundertest', $sutConfig->getConfig()); |
126 | - } |
|
126 | + } |
|
127 | 127 | |
128 | 128 | /** |
129 | 129 | * |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param \DataSift\Storyplayer\TestEnvironmentsLib\TestEnvironmentsConfig|\DataSift\Storyplayer\DefinitionLib\TestEnvironment_Definition $envConfig |
132 | 132 | * @return void |
133 | 133 | */ |
134 | - public function mergeTestEnvironmentConfig($injectables, $envConfig = null) |
|
135 | - { |
|
134 | + public function mergeTestEnvironmentConfig($injectables, $envConfig = null) |
|
135 | + { |
|
136 | 136 | // do we have a test environment? |
137 | 137 | if (!isset($injectables->activeTestEnvironmentName) || $envConfig === null) { |
138 | 138 | $this->setData('target', null); |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | $this->setData('target.name', $injectables->activeTestEnvironmentName); |
144 | 144 | |
145 | 145 | // merge in the loaded config |
146 | - $this->mergeData('target', $envConfig->getConfig()); |
|
147 | - } |
|
146 | + $this->mergeData('target', $envConfig->getConfig()); |
|
147 | + } |
|
148 | 148 | |
149 | 149 | protected function getHostIpAddress() |
150 | 150 | { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | // we also want to link in the hosts and roles tables, to make |
89 | 89 | // it a lot easier for Prose modules |
90 | - $activeConfig = $this->getConfig(); |
|
90 | + $activeConfig = $this->getConfig(); |
|
91 | 91 | $runtimeConfig = $injectables->getRuntimeConfig(); |
92 | 92 | $runtimeConfigManager = $injectables->getRuntimeConfigManager(); |
93 | 93 | $testEnvName = $injectables->activeTestEnvironmentName; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | // does the adapter have an IP address? |
180 | 180 | try { |
181 | 181 | $ipAddress = $netifaces->getIpAddress($adapterToTest); |
182 | - } catch(NetifacesException $e){ |
|
182 | + } catch (NetifacesException $e) { |
|
183 | 183 | // We couldn't get an IP address |
184 | 184 | $ipAddress = null; |
185 | 185 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | // this sucks |
214 | 214 | throw new NetifacesException("Unable to determine IP address"); |
215 | 215 | |
216 | - } catch (NetifacesException $e){ |
|
216 | + } catch (NetifacesException $e) { |
|
217 | 217 | throw new Exception("could not determine IP address of host machine"); |
218 | 218 | } |
219 | 219 | } |
@@ -179,7 +179,8 @@ discard block |
||
179 | 179 | // does the adapter have an IP address? |
180 | 180 | try { |
181 | 181 | $ipAddress = $netifaces->getIpAddress($adapterToTest); |
182 | - } catch(NetifacesException $e){ |
|
182 | + } |
|
183 | + catch(NetifacesException $e) { |
|
183 | 184 | // We couldn't get an IP address |
184 | 185 | $ipAddress = null; |
185 | 186 | } |
@@ -213,7 +214,8 @@ discard block |
||
213 | 214 | // this sucks |
214 | 215 | throw new NetifacesException("Unable to determine IP address"); |
215 | 216 | |
216 | - } catch (NetifacesException $e){ |
|
217 | + } |
|
218 | + catch (NetifacesException $e) { |
|
217 | 219 | throw new Exception("could not determine IP address of host machine"); |
218 | 220 | } |
219 | 221 | } |
@@ -83,6 +83,8 @@ discard block |
||
83 | 83 | |
84 | 84 | /** |
85 | 85 | * constructor |
86 | + * @param string $configType |
|
87 | + * @param string[] $searchFolders |
|
86 | 88 | */ |
87 | 89 | public function __construct($configType, $searchFolders) |
88 | 90 | { |
@@ -195,6 +197,7 @@ discard block |
||
195 | 197 | /** |
196 | 198 | * build a list of the config files in the $searchFolder |
197 | 199 | * |
200 | + * @param string $searchPattern |
|
198 | 201 | * @return array<string> |
199 | 202 | */ |
200 | 203 | protected function findConfigFilenames($searchPattern) |
@@ -329,7 +332,7 @@ discard block |
||
329 | 332 | /** |
330 | 333 | * returns our list of all known configs |
331 | 334 | * |
332 | - * @return array |
|
335 | + * @return SystemUnderTestConfig[] |
|
333 | 336 | */ |
334 | 337 | public function getEntries() |
335 | 338 | { |
@@ -339,7 +342,7 @@ discard block |
||
339 | 342 | /** |
340 | 343 | * returns the names of all of the entries in our list |
341 | 344 | * |
342 | - * @return array<string> |
|
345 | + * @return integer[] |
|
343 | 346 | */ |
344 | 347 | public function getEntryNames() |
345 | 348 | { |
@@ -356,8 +356,7 @@ |
||
356 | 356 | { |
357 | 357 | $list = $hardCodedDefaults->getConfigs(); |
358 | 358 | |
359 | - foreach ($list as $name => $config) |
|
360 | - { |
|
359 | + foreach ($list as $name => $config) { |
|
361 | 360 | $this->addEntry($name, $config); |
362 | 361 | } |
363 | 362 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * how should we provision this environment? |
222 | 222 | * |
223 | - * @return array<ProvisioningAdapters> |
|
223 | + * @return ProvisioningAdapter[] |
|
224 | 224 | */ |
225 | 225 | public function getProvisioningAdapters() |
226 | 226 | { |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | /** |
266 | 266 | * what hosts exist in this group? |
267 | 267 | * |
268 | - * @return array<TestEnvironment_HostDefinition> |
|
268 | + * @return TestEnvironmentHost[] |
|
269 | 269 | */ |
270 | 270 | public function getHosts() |
271 | 271 | { |
@@ -74,6 +74,9 @@ |
||
74 | 74 | */ |
75 | 75 | protected $storySettings; |
76 | 76 | |
77 | + /** |
|
78 | + * @param string $hostId |
|
79 | + */ |
|
77 | 80 | public function __construct(TestEnvironment_GroupDefinition $parentGroup, $hostId) |
78 | 81 | { |
79 | 82 | $this->setParentGroup($parentGroup); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * this function avoids reset()ing the array, so it will not mess with |
54 | 54 | * any iteration that you may currently be part-way through |
55 | 55 | * |
56 | - * @param array $arrayToSearch |
|
56 | + * @param Storyplayer\TestEnvironments\ProvisioningAdapter[] $arrayToSearch |
|
57 | 57 | * the array to get the first element of |
58 | 58 | * @return mixed |
59 | 59 | * the first element of $array, or NULL if the array is empty |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | /** |
96 | 96 | * Create a new test environment object |
97 | 97 | * |
98 | - * @return TestEnvironment |
|
98 | + * @return TestEnvironment_Definition |
|
99 | 99 | * the test environment object to use in the script |
100 | 100 | */ |
101 | 101 | function newTestEnvironment() |
@@ -115,7 +115,8 @@ |
||
115 | 115 | * @param callback $callback the action(s) to attempt |
116 | 116 | * @return void |
117 | 117 | */ |
118 | -function tryTo($callback) { |
|
118 | +function tryTo($callback) |
|
119 | +{ |
|
119 | 120 | try { |
120 | 121 | $callback(); |
121 | 122 | } |
@@ -75,7 +75,7 @@ |
||
75 | 75 | |
76 | 76 | /** |
77 | 77 | * @param string $filename |
78 | - * @return bool |
|
78 | + * @return null|boolean |
|
79 | 79 | */ |
80 | 80 | public function buildParseTreeForFile($filename) |
81 | 81 | { |
@@ -199,7 +199,7 @@ |
||
199 | 199 | // we are looking for |
200 | 200 | $lastStmt = null; |
201 | 201 | |
202 | - foreach($stmts as $stmt) { |
|
202 | + foreach ($stmts as $stmt) { |
|
203 | 203 | // where are we? |
204 | 204 | $currentLine = $stmt->getLine(); |
205 | 205 | // var_dump($currentLine, $stmt->getType()); |
@@ -122,8 +122,7 @@ discard block |
||
122 | 122 | ]; |
123 | 123 | |
124 | 124 | // find the code that is executing |
125 | - foreach ($stackTrace as $index => $stackEntry) |
|
126 | - { |
|
125 | + foreach ($stackTrace as $index => $stackEntry) { |
|
127 | 126 | if (!isset($stackEntry['file'])) { |
128 | 127 | continue; |
129 | 128 | } |
@@ -173,8 +172,7 @@ discard block |
||
173 | 172 | public function getCodeFor($filename, $lineToFind) |
174 | 173 | { |
175 | 174 | // do we have a parser tree for this file? |
176 | - if (!isset($this->parserTrees[$filename])) |
|
177 | - { |
|
175 | + if (!isset($this->parserTrees[$filename])) { |
|
178 | 176 | // attempt to build a parse tree |
179 | 177 | if (!$this->buildParseTreeForFile($filename)) { |
180 | 178 | |
@@ -240,8 +238,7 @@ discard block |
||
240 | 238 | // what are we looking at? |
241 | 239 | $nodeType = $stmt->getType(); |
242 | 240 | |
243 | - switch ($nodeType) |
|
244 | - { |
|
241 | + switch ($nodeType) { |
|
245 | 242 | case 'Arg': |
246 | 243 | // this is an argument to an expression |
247 | 244 | // |
@@ -438,6 +438,7 @@ discard block |
||
438 | 438 | } |
439 | 439 | |
440 | 440 | /** |
441 | + * @param Prose_Loader $proseLoader |
|
441 | 442 | * @return void |
442 | 443 | */ |
443 | 444 | public function setProseLoader($proseLoader) |
@@ -454,6 +455,9 @@ discard block |
||
454 | 455 | return $this->phaseLoader; |
455 | 456 | } |
456 | 457 | |
458 | + /** |
|
459 | + * @param Phase_Loader $phaseLoader |
|
460 | + */ |
|
457 | 461 | public function setPhaseLoader($phaseLoader) |
458 | 462 | { |
459 | 463 | $this->phaseLoader = $phaseLoader; |
@@ -483,11 +487,17 @@ discard block |
||
483 | 487 | return $this->codeParser; |
484 | 488 | } |
485 | 489 | |
490 | + /** |
|
491 | + * @param \DataSift\Storyplayer\OutputLib\CodeParser $codeParser |
|
492 | + */ |
|
486 | 493 | public function setCodeParser($codeParser) |
487 | 494 | { |
488 | 495 | $this->codeParser = $codeParser; |
489 | 496 | } |
490 | 497 | |
498 | + /** |
|
499 | + * @param \DataSift\Storyplayer\OutputLib\DataFormatter $dataFormatter |
|
500 | + */ |
|
491 | 501 | public function setDataFormatter($dataFormatter) |
492 | 502 | { |
493 | 503 | $this->dataFormatter = $dataFormatter; |
@@ -520,6 +530,7 @@ discard block |
||
520 | 530 | } |
521 | 531 | |
522 | 532 | /** |
533 | + * @param \DataSift\Storyplayer\ConfigLib\ActiveConfig $config |
|
523 | 534 | * @return void |
524 | 535 | */ |
525 | 536 | public function setConfig($config) |
@@ -783,7 +794,7 @@ discard block |
||
783 | 794 | * |
784 | 795 | * @param string $methodName |
785 | 796 | * @param array $methodArgs |
786 | - * @return mixed |
|
797 | + * @return \Prose\Prose |
|
787 | 798 | */ |
788 | 799 | public function __call($methodName, $methodArgs) |
789 | 800 | { |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | // we do not need to wrap these in a TRY/CATCH block, |
963 | 963 | // as we are already running inside one of the story's |
964 | 964 | // phases |
965 | - foreach ($callbacks as $callback){ |
|
965 | + foreach ($callbacks as $callback) { |
|
966 | 966 | call_user_func($callback, $this); |
967 | 967 | } |
968 | 968 | } |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | // we do not need to wrap these in a TRY/CATCH block, |
1002 | 1002 | // as we are already running inside one of the story's |
1003 | 1003 | // phases |
1004 | - foreach ($callbacks as $callback){ |
|
1004 | + foreach ($callbacks as $callback) { |
|
1005 | 1005 | call_user_func($callback, $this); |
1006 | 1006 | } |
1007 | 1007 | } |
@@ -281,7 +281,8 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @return Action_Logger |
283 | 283 | */ |
284 | - public function getActionLogger() { |
|
284 | + public function getActionLogger() |
|
285 | + { |
|
285 | 286 | return $this->actionLogger; |
286 | 287 | } |
287 | 288 | |
@@ -291,7 +292,8 @@ discard block |
||
291 | 292 | * @param Action_Logger $actionLogger |
292 | 293 | * @return StoryTeller |
293 | 294 | */ |
294 | - public function setActionLogger(Action_Logger $actionLogger) { |
|
295 | + public function setActionLogger(Action_Logger $actionLogger) |
|
296 | + { |
|
295 | 297 | $this->actionLogger = $actionLogger; |
296 | 298 | |
297 | 299 | return $this; |
@@ -302,7 +304,8 @@ discard block |
||
302 | 304 | * |
303 | 305 | * @return Story_Checkpoint |
304 | 306 | */ |
305 | - public function getCheckpoint() { |
|
307 | + public function getCheckpoint() |
|
308 | + { |
|
306 | 309 | return $this->checkpoint; |
307 | 310 | } |
308 | 311 | |
@@ -312,7 +315,8 @@ discard block |
||
312 | 315 | * @param Story_Checkpoint $checkpoint |
313 | 316 | * @return StoryTeller |
314 | 317 | */ |
315 | - public function setCheckpoint(Story_Checkpoint $checkpoint) { |
|
318 | + public function setCheckpoint(Story_Checkpoint $checkpoint) |
|
319 | + { |
|
316 | 320 | $this->checkpoint = $checkpoint; |
317 | 321 | |
318 | 322 | return $this; |
@@ -323,7 +327,8 @@ discard block |
||
323 | 327 | * |
324 | 328 | * @return PageContext |
325 | 329 | */ |
326 | - public function getPageContext() { |
|
330 | + public function getPageContext() |
|
331 | + { |
|
327 | 332 | return $this->pageContext; |
328 | 333 | } |
329 | 334 | |
@@ -333,7 +338,8 @@ discard block |
||
333 | 338 | * @param PageContext $pageContext |
334 | 339 | * @return StoryTeller |
335 | 340 | */ |
336 | - public function setPageContext(PageContext $pageContext) { |
|
341 | + public function setPageContext(PageContext $pageContext) |
|
342 | + { |
|
337 | 343 | $this->pageContext = $pageContext; |
338 | 344 | |
339 | 345 | return $this; |
@@ -393,7 +399,8 @@ discard block |
||
393 | 399 | * |
394 | 400 | * @return RuntimeConfigManager |
395 | 401 | */ |
396 | - public function getRuntimeConfigManager() { |
|
402 | + public function getRuntimeConfigManager() |
|
403 | + { |
|
397 | 404 | return $this->runtimeConfigManager; |
398 | 405 | } |
399 | 406 | |
@@ -403,7 +410,8 @@ discard block |
||
403 | 410 | * @param RuntimeConfigManager $runtimeConfigManager |
404 | 411 | * @return StoryTeller |
405 | 412 | */ |
406 | - public function setRuntimeConfigManager(RuntimeConfigManager $runtimeConfigManager) { |
|
413 | + public function setRuntimeConfigManager(RuntimeConfigManager $runtimeConfigManager) |
|
414 | + { |
|
407 | 415 | $this->runtimeConfigManager = $runtimeConfigManager; |
408 | 416 | |
409 | 417 | return $this; |
@@ -906,13 +914,11 @@ discard block |
||
906 | 914 | */ |
907 | 915 | public function getRunningDevice() |
908 | 916 | { |
909 | - if (!is_object($this->deviceAdapter)) |
|
910 | - { |
|
917 | + if (!is_object($this->deviceAdapter)) { |
|
911 | 918 | $this->startDevice(); |
912 | 919 | } |
913 | 920 | |
914 | - if (!is_object($this->deviceAdapter)) |
|
915 | - { |
|
921 | + if (!is_object($this->deviceAdapter)) { |
|
916 | 922 | throw new E5xx_CannotStartDevice(); |
917 | 923 | } |
918 | 924 | |
@@ -962,7 +968,7 @@ discard block |
||
962 | 968 | // we do not need to wrap these in a TRY/CATCH block, |
963 | 969 | // as we are already running inside one of the story's |
964 | 970 | // phases |
965 | - foreach ($callbacks as $callback){ |
|
971 | + foreach ($callbacks as $callback) { |
|
966 | 972 | call_user_func($callback, $this); |
967 | 973 | } |
968 | 974 | } |
@@ -1001,7 +1007,7 @@ discard block |
||
1001 | 1007 | // we do not need to wrap these in a TRY/CATCH block, |
1002 | 1008 | // as we are already running inside one of the story's |
1003 | 1009 | // phases |
1004 | - foreach ($callbacks as $callback){ |
|
1010 | + foreach ($callbacks as $callback) { |
|
1005 | 1011 | call_user_func($callback, $this); |
1006 | 1012 | } |
1007 | 1013 | } |
@@ -177,7 +177,6 @@ |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
180 | - * @param integer $level |
|
181 | 180 | * @param string $msg |
182 | 181 | * @return void |
183 | 182 | */ |
@@ -75,7 +75,7 @@ |
||
75 | 75 | * __construct |
76 | 76 | * |
77 | 77 | * @param StoryTeller $st The StoryTeller object |
78 | - * @param array $args Any arguments to be used in this Prose module |
|
78 | + * @param string[] $args Any arguments to be used in this Prose module |
|
79 | 79 | * |
80 | 80 | * @return parent::__construct |
81 | 81 | */ |