@@ -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 | } |
@@ -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 | } |
@@ -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 | */ |
@@ -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 |
@@ -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 |
@@ -78,20 +78,20 @@ |
||
78 | 78 | |
79 | 79 | public function initBeforeModulesAvailable(CliEngine $engine, CliCommand $command, Injectables $injectables) |
80 | 80 | { |
81 | - // which colour mode are we in? |
|
82 | - switch ($engine->options->color) { |
|
83 | - case Feature_ColorSwitch::NO_COLOR: |
|
84 | - $injectables->output->disableColourSupport(); |
|
85 | - break; |
|
81 | + // which colour mode are we in? |
|
82 | + switch ($engine->options->color) { |
|
83 | + case Feature_ColorSwitch::NO_COLOR: |
|
84 | + $injectables->output->disableColourSupport(); |
|
85 | + break; |
|
86 | 86 | |
87 | - case Feature_ColorSwitch::ALWAYS_COLOR: |
|
88 | - $injectables->output->enforceColourSupport(); |
|
89 | - break; |
|
87 | + case Feature_ColorSwitch::ALWAYS_COLOR: |
|
88 | + $injectables->output->enforceColourSupport(); |
|
89 | + break; |
|
90 | 90 | |
91 | - case Feature_ColorSwitch::AUTO_COLOR: |
|
92 | - $injectables->output->enableColourSupport(); |
|
93 | - break; |
|
94 | - } |
|
91 | + case Feature_ColorSwitch::AUTO_COLOR: |
|
92 | + $injectables->output->enableColourSupport(); |
|
93 | + break; |
|
94 | + } |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | public function initAfterModulesAvailable(StoryTeller $st, CliEngine $engine, Injectables $injectables) |