1 | <?php |
||
10 | class ConsoleContext implements Context |
||
11 | { |
||
12 | /** @var ConfigResolverInterface */ |
||
13 | private $configResolver; |
||
14 | |||
15 | /** @var string[] */ |
||
16 | private $siteaccessList; |
||
17 | |||
18 | /** @var string */ |
||
19 | private $defaultSiteaccess; |
||
20 | |||
21 | private $scriptOutput = null; |
||
22 | |||
23 | /** |
||
24 | * Elements referenced by 'it' in sentences. |
||
25 | * @var array |
||
26 | */ |
||
27 | private $it = []; |
||
28 | |||
29 | /** |
||
30 | * @param ConfigResolverInterface $configResolver |
||
31 | * @param string[] $siteaccessList |
||
32 | * @param string $defaultSiteaccess |
||
33 | */ |
||
34 | public function __construct( |
||
43 | |||
44 | /** |
||
45 | * @When I run a console script without specifying a siteaccess |
||
46 | */ |
||
47 | public function iRunAConsoleScript() |
||
51 | |||
52 | /** |
||
53 | * @When I run a console script with the siteaccess option :siteaccessOption |
||
54 | */ |
||
55 | public function iRunAConsoleScriptWithSiteaccess($siteaccessOption) |
||
59 | |||
60 | /** |
||
61 | * @Then It is executed with the siteaccess :siteaccess |
||
62 | */ |
||
63 | public function iExpectItToBeExecutedWithTheSiteaccess($siteaccess) |
||
72 | |||
73 | /** |
||
74 | * @Then it is executed with the default one |
||
75 | * |
||
76 | * default one: default siteaccess. |
||
77 | */ |
||
78 | public function iExpectItToBeExecutedWithTheDefaultOne() |
||
82 | |||
83 | /** |
||
84 | * @Given /^that there is a "([^"]*)" siteaccess$/ |
||
85 | */ |
||
86 | public function thereIsASiteaccess($expectedSiteaccessName, $default = false) |
||
100 | |||
101 | /** |
||
102 | * @Given /^that there is a default "([^"]*)" siteaccess$/ |
||
103 | */ |
||
104 | public function thereIsADefaultSiteaccess($expectedSiteaccessName) |
||
112 | |||
113 | /** |
||
114 | * @When I run a console script with it |
||
115 | * |
||
116 | * it: the siteaccess referenced above. |
||
117 | */ |
||
118 | public function iRunAConsoleScriptWithIt() |
||
126 | |||
127 | private function iRunTheCommand($command, $siteaccess = null) |
||
156 | |||
157 | /** |
||
158 | * @Given /^that there is a siteaccess that is not the default one$/ |
||
159 | */ |
||
160 | public function thereIsASiteaccessThatIsNotTheDefaultOne() |
||
166 | |||
167 | /** |
||
168 | * @Then /^I expect it to be executed with it$/ |
||
169 | */ |
||
170 | public function iExpectItToBeExecutedWithIt() |
||
174 | |||
175 | /** |
||
176 | * Returns the name of an existing siteaccess that isn't the default one. |
||
177 | * @return string|null The siteaccess name, or null if there isn't one |
||
178 | */ |
||
179 | private function getNonDefaultSiteaccessName() |
||
190 | |||
191 | /** |
||
192 | * @return ConfigResolverInterface |
||
193 | */ |
||
194 | private function getConfigResolver() |
||
198 | |||
199 | private function getDefaultSiteaccessName() |
||
203 | } |
||
204 |