@@ -18,43 +18,43 @@ discard block |
||
18 | 18 | |
19 | 19 | trait CommonContextTrait |
20 | 20 | { |
21 | - /** |
|
22 | - * @var MinkContext |
|
23 | - */ |
|
24 | - protected $minkContext; |
|
21 | + /** |
|
22 | + * @var MinkContext |
|
23 | + */ |
|
24 | + protected $minkContext; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var CoreContext |
|
28 | - */ |
|
29 | - protected $coreContext; |
|
26 | + /** |
|
27 | + * @var CoreContext |
|
28 | + */ |
|
29 | + protected $coreContext; |
|
30 | 30 | |
31 | - /** |
|
32 | - * @var UserContext |
|
33 | - */ |
|
34 | - protected $userContext; |
|
31 | + /** |
|
32 | + * @var UserContext |
|
33 | + */ |
|
34 | + protected $userContext; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @var SummaryFormContext |
|
38 | - */ |
|
39 | - protected $summaryFormContext; |
|
36 | + /** |
|
37 | + * @var SummaryFormContext |
|
38 | + */ |
|
39 | + protected $summaryFormContext; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @BeforeScenario |
|
43 | - * |
|
44 | - * @param BeforeScenarioScope $scope |
|
45 | - */ |
|
46 | - final public function gatherContexts(BeforeScenarioScope $scope) |
|
47 | - { |
|
48 | - $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
49 | - $this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class); |
|
50 | - $this->userContext = $scope->getEnvironment()->getContext(UserContext::class); |
|
51 | - $this->summaryFormContext = $scope->getEnvironment()->getContext(SummaryFormContext::class); |
|
52 | - } |
|
41 | + /** |
|
42 | + * @BeforeScenario |
|
43 | + * |
|
44 | + * @param BeforeScenarioScope $scope |
|
45 | + */ |
|
46 | + final public function gatherContexts(BeforeScenarioScope $scope) |
|
47 | + { |
|
48 | + $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
49 | + $this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class); |
|
50 | + $this->userContext = $scope->getEnvironment()->getContext(UserContext::class); |
|
51 | + $this->summaryFormContext = $scope->getEnvironment()->getContext(SummaryFormContext::class); |
|
52 | + } |
|
53 | 53 | |
54 | - public function buildUrl($name, array $params=array(), array $options=array()) |
|
55 | - { |
|
56 | - $defaults = ['lang'=>'en']; |
|
57 | - $params = array_merge($defaults,$params); |
|
54 | + public function buildUrl($name, array $params=array(), array $options=array()) |
|
55 | + { |
|
56 | + $defaults = ['lang'=>'en']; |
|
57 | + $params = array_merge($defaults,$params); |
|
58 | 58 | /* @var Url $urlHelper */ |
59 | 59 | $urlHelper = $this |
60 | 60 | ->getService('ViewHelperManager') |
@@ -63,36 +63,36 @@ discard block |
||
63 | 63 | $url = $urlHelper($name,$params,$options); |
64 | 64 | |
65 | 65 | return $this->coreContext->generateUrl($url); |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | - public function visit($url) |
|
69 | - { |
|
70 | - $this->coreContext->iVisit($url); |
|
71 | - } |
|
68 | + public function visit($url) |
|
69 | + { |
|
70 | + $this->coreContext->iVisit($url); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * @param $id |
|
75 | - * @return mixed|object |
|
76 | - */ |
|
77 | - public function getService($id) |
|
78 | - { |
|
79 | - return $this->coreContext->getServiceManager()->get($id); |
|
80 | - } |
|
73 | + /** |
|
74 | + * @param $id |
|
75 | + * @return mixed|object |
|
76 | + */ |
|
77 | + public function getService($id) |
|
78 | + { |
|
79 | + return $this->coreContext->getServiceManager()->get($id); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @param $id |
|
84 | - * |
|
85 | - * @return RepositoryInterface |
|
86 | - */ |
|
87 | - public function getRepository($id) |
|
88 | - { |
|
89 | - return $this->coreContext->getRepositories()->get($id); |
|
90 | - } |
|
82 | + /** |
|
83 | + * @param $id |
|
84 | + * |
|
85 | + * @return RepositoryInterface |
|
86 | + */ |
|
87 | + public function getRepository($id) |
|
88 | + { |
|
89 | + return $this->coreContext->getRepositories()->get($id); |
|
90 | + } |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * @return UserContext |
94 | 94 | */ |
95 | - public function getUserContext() |
|
95 | + public function getUserContext() |
|
96 | 96 | { |
97 | 97 | return $this->userContext; |
98 | 98 | } |
@@ -25,283 +25,283 @@ |
||
25 | 25 | { |
26 | 26 | use CommonContextTrait; |
27 | 27 | |
28 | - static protected $application; |
|
28 | + static protected $application; |
|
29 | 29 | |
30 | - static private $jobCategoryChecked = false; |
|
30 | + static private $jobCategoryChecked = false; |
|
31 | 31 | |
32 | - /** |
|
33 | - * @BeforeScenario |
|
34 | - * @param BeforeScenarioScope $scope |
|
35 | - */ |
|
36 | - public function setupContexts(BeforeScenarioScope $scope) |
|
37 | - { |
|
38 | - if(false === static::$jobCategoryChecked){ |
|
39 | - /* @var Categories $catRepo */ |
|
40 | - $catRepo = $this->getRepositories()->get('Jobs/Category'); |
|
41 | - $all = $catRepo->findAll(); |
|
42 | - if(count($all) <= 1){ |
|
43 | - $catRepo->createDefaultCategory('professions'); |
|
44 | - $catRepo->createDefaultCategory('industries'); |
|
45 | - $catRepo->createDefaultCategory('employmentTypes'); |
|
46 | - } |
|
47 | - static::$jobCategoryChecked = true; |
|
48 | - } |
|
49 | - } |
|
32 | + /** |
|
33 | + * @BeforeScenario |
|
34 | + * @param BeforeScenarioScope $scope |
|
35 | + */ |
|
36 | + public function setupContexts(BeforeScenarioScope $scope) |
|
37 | + { |
|
38 | + if(false === static::$jobCategoryChecked){ |
|
39 | + /* @var Categories $catRepo */ |
|
40 | + $catRepo = $this->getRepositories()->get('Jobs/Category'); |
|
41 | + $all = $catRepo->findAll(); |
|
42 | + if(count($all) <= 1){ |
|
43 | + $catRepo->createDefaultCategory('professions'); |
|
44 | + $catRepo->createDefaultCategory('industries'); |
|
45 | + $catRepo->createDefaultCategory('employmentTypes'); |
|
46 | + } |
|
47 | + static::$jobCategoryChecked = true; |
|
48 | + } |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * @return Application |
|
53 | - */ |
|
54 | - public function getApplication() |
|
55 | - { |
|
56 | - if(!is_object(static::$application)){ |
|
57 | - $configFile = realpath(__DIR__.'/../../../config/config.php'); |
|
58 | - $config = include($configFile); |
|
59 | - static::$application = Application::init($config); |
|
60 | - } |
|
61 | - return static::$application; |
|
62 | - } |
|
51 | + /** |
|
52 | + * @return Application |
|
53 | + */ |
|
54 | + public function getApplication() |
|
55 | + { |
|
56 | + if(!is_object(static::$application)){ |
|
57 | + $configFile = realpath(__DIR__.'/../../../config/config.php'); |
|
58 | + $config = include($configFile); |
|
59 | + static::$application = Application::init($config); |
|
60 | + } |
|
61 | + return static::$application; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * @return \Zend\ServiceManager\ServiceManager |
|
66 | - */ |
|
67 | - public function getServiceManager() |
|
68 | - { |
|
69 | - return $this->getApplication()->getServiceManager(); |
|
70 | - } |
|
64 | + /** |
|
65 | + * @return \Zend\ServiceManager\ServiceManager |
|
66 | + */ |
|
67 | + public function getServiceManager() |
|
68 | + { |
|
69 | + return $this->getApplication()->getServiceManager(); |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * @return \Zend\EventManager\EventManagerInterface |
|
74 | - */ |
|
75 | - public function getEventManager() |
|
76 | - { |
|
77 | - return $this->getApplication()->getEventManager(); |
|
78 | - } |
|
72 | + /** |
|
73 | + * @return \Zend\EventManager\EventManagerInterface |
|
74 | + */ |
|
75 | + public function getEventManager() |
|
76 | + { |
|
77 | + return $this->getApplication()->getEventManager(); |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * @return RepositoryService |
|
82 | - */ |
|
83 | - public function getRepositories() |
|
84 | - { |
|
85 | - return $this->getServiceManager()->get('repositories'); |
|
86 | - } |
|
80 | + /** |
|
81 | + * @return RepositoryService |
|
82 | + */ |
|
83 | + public function getRepositories() |
|
84 | + { |
|
85 | + return $this->getServiceManager()->get('repositories'); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * @param $name |
|
90 | - * @param array $params |
|
91 | - * |
|
92 | - * @return string |
|
93 | - */ |
|
94 | - public function generateUrl($name) |
|
95 | - { |
|
96 | - return $this->minkContext->locatePath($name); |
|
97 | - } |
|
88 | + /** |
|
89 | + * @param $name |
|
90 | + * @param array $params |
|
91 | + * |
|
92 | + * @return string |
|
93 | + */ |
|
94 | + public function generateUrl($name) |
|
95 | + { |
|
96 | + return $this->minkContext->locatePath($name); |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * @When /^I hover over the element "([^"]*)"$/ |
|
101 | - */ |
|
102 | - public function iHoverOverTheElement($locator) |
|
103 | - { |
|
104 | - $session = $this->minkContext->getSession(); // get the mink session |
|
105 | - $element = $session->getPage()->find('css', $locator); // runs the actual query and returns the element |
|
99 | + /** |
|
100 | + * @When /^I hover over the element "([^"]*)"$/ |
|
101 | + */ |
|
102 | + public function iHoverOverTheElement($locator) |
|
103 | + { |
|
104 | + $session = $this->minkContext->getSession(); // get the mink session |
|
105 | + $element = $session->getPage()->find('css', $locator); // runs the actual query and returns the element |
|
106 | 106 | |
107 | - // errors must not pass silently |
|
108 | - if (null === $element) { |
|
109 | - throw new \InvalidArgumentException(sprintf('Could not evaluate CSS selector: "%s"', $locator)); |
|
110 | - } |
|
107 | + // errors must not pass silently |
|
108 | + if (null === $element) { |
|
109 | + throw new \InvalidArgumentException(sprintf('Could not evaluate CSS selector: "%s"', $locator)); |
|
110 | + } |
|
111 | 111 | |
112 | - // ok, let's hover it |
|
113 | - $element->mouseOver(); |
|
114 | - } |
|
112 | + // ok, let's hover it |
|
113 | + $element->mouseOver(); |
|
114 | + } |
|
115 | 115 | |
116 | - /** |
|
117 | - * @Given /^I wait for (\d+) seconds$/ |
|
118 | - */ |
|
119 | - public function iWaitForSecond($second) |
|
120 | - { |
|
121 | - sleep($second); |
|
122 | - } |
|
116 | + /** |
|
117 | + * @Given /^I wait for (\d+) seconds$/ |
|
118 | + */ |
|
119 | + public function iWaitForSecond($second) |
|
120 | + { |
|
121 | + sleep($second); |
|
122 | + } |
|
123 | 123 | |
124 | - /** |
|
125 | - * @Then /^I wait for the ajax response$/ |
|
126 | - */ |
|
127 | - public function iWaitForTheAjaxResponse() |
|
128 | - { |
|
129 | - $this->getSession()->wait(5000, '(0 === jQuery.active)'); |
|
130 | - } |
|
124 | + /** |
|
125 | + * @Then /^I wait for the ajax response$/ |
|
126 | + */ |
|
127 | + public function iWaitForTheAjaxResponse() |
|
128 | + { |
|
129 | + $this->getSession()->wait(5000, '(0 === jQuery.active)'); |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * Some forms do not have a Submit button just pass the ID |
|
134 | - * |
|
135 | - * @Given /^I submit the form with id "([^"]*)"$/ |
|
136 | - */ |
|
137 | - public function iSubmitTheFormWithId($arg) |
|
138 | - { |
|
139 | - $node = $this->minkContext->getSession()->getPage()->find('css', $arg); |
|
140 | - if($node) { |
|
141 | - $this->minkContext->getSession()->executeScript("jQuery('$arg').submit();"); |
|
142 | - } else { |
|
143 | - throw new \Exception('Element not found'); |
|
144 | - } |
|
145 | - } |
|
132 | + /** |
|
133 | + * Some forms do not have a Submit button just pass the ID |
|
134 | + * |
|
135 | + * @Given /^I submit the form with id "([^"]*)"$/ |
|
136 | + */ |
|
137 | + public function iSubmitTheFormWithId($arg) |
|
138 | + { |
|
139 | + $node = $this->minkContext->getSession()->getPage()->find('css', $arg); |
|
140 | + if($node) { |
|
141 | + $this->minkContext->getSession()->executeScript("jQuery('$arg').submit();"); |
|
142 | + } else { |
|
143 | + throw new \Exception('Element not found'); |
|
144 | + } |
|
145 | + } |
|
146 | 146 | |
147 | - /** |
|
148 | - * @Then I switch to popup :name |
|
149 | - * |
|
150 | - * @param $name |
|
151 | - */ |
|
152 | - public function iSwitchToPopup($name) |
|
153 | - { |
|
154 | - $this->iSetMainWindowName(); |
|
155 | - $this->getSession()->switchToWindow($name); |
|
156 | - } |
|
147 | + /** |
|
148 | + * @Then I switch to popup :name |
|
149 | + * |
|
150 | + * @param $name |
|
151 | + */ |
|
152 | + public function iSwitchToPopup($name) |
|
153 | + { |
|
154 | + $this->iSetMainWindowName(); |
|
155 | + $this->getSession()->switchToWindow($name); |
|
156 | + } |
|
157 | 157 | |
158 | - /** |
|
159 | - * @Then I set main window name |
|
160 | - */ |
|
161 | - public function iSetMainWindowName() |
|
162 | - { |
|
163 | - $window_name = 'main_window'; |
|
164 | - $script = 'window.name = "' . $window_name . '"'; |
|
165 | - $this->getSession()->executeScript($script); |
|
166 | - } |
|
158 | + /** |
|
159 | + * @Then I set main window name |
|
160 | + */ |
|
161 | + public function iSetMainWindowName() |
|
162 | + { |
|
163 | + $window_name = 'main_window'; |
|
164 | + $script = 'window.name = "' . $window_name . '"'; |
|
165 | + $this->getSession()->executeScript($script); |
|
166 | + } |
|
167 | 167 | |
168 | - /** |
|
169 | - * @Then I switch back to main window |
|
170 | - */ |
|
171 | - public function iSwitchBackToMainWindow() |
|
172 | - { |
|
173 | - $this->getSession()->switchToWindow('main_window'); |
|
174 | - } |
|
168 | + /** |
|
169 | + * @Then I switch back to main window |
|
170 | + */ |
|
171 | + public function iSwitchBackToMainWindow() |
|
172 | + { |
|
173 | + $this->getSession()->switchToWindow('main_window'); |
|
174 | + } |
|
175 | 175 | |
176 | - public function iVisit($url) |
|
177 | - { |
|
178 | - $this->minkContext->getSession()->visit($url); |
|
179 | - } |
|
176 | + public function iVisit($url) |
|
177 | + { |
|
178 | + $this->minkContext->getSession()->visit($url); |
|
179 | + } |
|
180 | 180 | |
181 | - /** |
|
182 | - * @When I scroll :selector into view |
|
183 | - * |
|
184 | - * @param string $selector Allowed selectors: #id, .className, //xpath |
|
185 | - * |
|
186 | - * @throws \Exception |
|
187 | - */ |
|
188 | - public function scrollIntoView($selector) |
|
189 | - { |
|
190 | - $locator = substr($selector, 0, 1); |
|
181 | + /** |
|
182 | + * @When I scroll :selector into view |
|
183 | + * |
|
184 | + * @param string $selector Allowed selectors: #id, .className, //xpath |
|
185 | + * |
|
186 | + * @throws \Exception |
|
187 | + */ |
|
188 | + public function scrollIntoView($selector) |
|
189 | + { |
|
190 | + $locator = substr($selector, 0, 1); |
|
191 | 191 | |
192 | - switch ($locator) { |
|
193 | - case '/' : // XPath selector |
|
194 | - $function = <<<JS |
|
192 | + switch ($locator) { |
|
193 | + case '/' : // XPath selector |
|
194 | + $function = <<<JS |
|
195 | 195 | (function(){ |
196 | 196 | var elem = document.evaluate($selector, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; |
197 | 197 | elem.scrollIntoView(false); |
198 | 198 | })() |
199 | 199 | JS; |
200 | - break; |
|
200 | + break; |
|
201 | 201 | |
202 | - case '#' : // ID selector |
|
203 | - $selector = substr($selector, 1); |
|
204 | - $function = <<<JS |
|
202 | + case '#' : // ID selector |
|
203 | + $selector = substr($selector, 1); |
|
204 | + $function = <<<JS |
|
205 | 205 | (function(){ |
206 | 206 | var elem = document.getElementById("$selector"); |
207 | 207 | elem.scrollIntoView(false); |
208 | 208 | })() |
209 | 209 | JS; |
210 | - break; |
|
210 | + break; |
|
211 | 211 | |
212 | - case '.' : // Class selector |
|
213 | - $selector = substr($selector, 1); |
|
214 | - $function = <<<JS |
|
212 | + case '.' : // Class selector |
|
213 | + $selector = substr($selector, 1); |
|
214 | + $function = <<<JS |
|
215 | 215 | (function(){ |
216 | 216 | var elem = document.getElementsByClassName("$selector"); |
217 | 217 | elem[0].scrollIntoView(false); |
218 | 218 | })() |
219 | 219 | JS; |
220 | - break; |
|
220 | + break; |
|
221 | 221 | |
222 | - default: |
|
223 | - throw new \Exception(__METHOD__ . ' Couldn\'t find selector: ' . $selector . ' - Allowed selectors: #id, .className, //xpath'); |
|
224 | - break; |
|
225 | - } |
|
222 | + default: |
|
223 | + throw new \Exception(__METHOD__ . ' Couldn\'t find selector: ' . $selector . ' - Allowed selectors: #id, .className, //xpath'); |
|
224 | + break; |
|
225 | + } |
|
226 | 226 | |
227 | - try { |
|
228 | - $this->getSession()->executeScript($function); |
|
229 | - } catch (\Exception $e) { |
|
230 | - throw new \Exception(__METHOD__ . ' failed'. ' Message: for this locator:"'.$selector.'"'); |
|
231 | - } |
|
232 | - } |
|
227 | + try { |
|
228 | + $this->getSession()->executeScript($function); |
|
229 | + } catch (\Exception $e) { |
|
230 | + throw new \Exception(__METHOD__ . ' failed'. ' Message: for this locator:"'.$selector.'"'); |
|
231 | + } |
|
232 | + } |
|
233 | 233 | |
234 | - /** |
|
235 | - * @When I click location selector |
|
236 | - */ |
|
237 | - public function iClickLocationSelector() |
|
238 | - { |
|
239 | - $locator = '#jobBase-geoLocation-span .select2'; |
|
240 | - $element = $this->getElement($locator); |
|
241 | - $element->click(); |
|
242 | - } |
|
234 | + /** |
|
235 | + * @When I click location selector |
|
236 | + */ |
|
237 | + public function iClickLocationSelector() |
|
238 | + { |
|
239 | + $locator = '#jobBase-geoLocation-span .select2'; |
|
240 | + $element = $this->getElement($locator); |
|
241 | + $element->click(); |
|
242 | + } |
|
243 | 243 | |
244 | - /** |
|
245 | - * @param $locator |
|
246 | - * @param string $selector |
|
247 | - * |
|
248 | - * @return \Behat\Mink\Element\NodeElement|mixed|null |
|
249 | - */ |
|
250 | - public function getElement($locator,$selector='css') |
|
251 | - { |
|
252 | - $page = $this->minkContext->getSession()->getPage(); |
|
253 | - $element = $page->find('css',$locator); |
|
254 | - return $element; |
|
255 | - } |
|
244 | + /** |
|
245 | + * @param $locator |
|
246 | + * @param string $selector |
|
247 | + * |
|
248 | + * @return \Behat\Mink\Element\NodeElement|mixed|null |
|
249 | + */ |
|
250 | + public function getElement($locator,$selector='css') |
|
251 | + { |
|
252 | + $page = $this->minkContext->getSession()->getPage(); |
|
253 | + $element = $page->find('css',$locator); |
|
254 | + return $element; |
|
255 | + } |
|
256 | 256 | |
257 | - /** |
|
258 | - * @When I fill in location search with :term |
|
259 | - * @param $term |
|
260 | - */ |
|
261 | - public function iFillInLocationSearch($term) |
|
262 | - { |
|
263 | - $locator = '.select2-container--open .select2-search__field'; |
|
264 | - $element = $this->getElement($locator); |
|
265 | - $element->focus(); |
|
266 | - $element->setValue($term); |
|
267 | - $this->iWaitForTheAjaxResponse(); |
|
268 | - } |
|
257 | + /** |
|
258 | + * @When I fill in location search with :term |
|
259 | + * @param $term |
|
260 | + */ |
|
261 | + public function iFillInLocationSearch($term) |
|
262 | + { |
|
263 | + $locator = '.select2-container--open .select2-search__field'; |
|
264 | + $element = $this->getElement($locator); |
|
265 | + $element->focus(); |
|
266 | + $element->setValue($term); |
|
267 | + $this->iWaitForTheAjaxResponse(); |
|
268 | + } |
|
269 | 269 | |
270 | - public function iClickOn() |
|
271 | - { |
|
270 | + public function iClickOn() |
|
271 | + { |
|
272 | 272 | |
273 | - } |
|
273 | + } |
|
274 | 274 | |
275 | - /** |
|
276 | - * Click some text |
|
277 | - * |
|
278 | - * @When /^I click on the text "([^"]*)"$/ |
|
279 | - */ |
|
280 | - public function iClickOnTheText($text) |
|
281 | - { |
|
282 | - $session = $this->getSession(); |
|
283 | - $element = $session->getPage()->find( |
|
284 | - 'xpath', |
|
285 | - $session->getSelectorsHandler()->selectorToXpath('xpath', '*//*[text()="'. $text .'"]') |
|
286 | - ); |
|
287 | - if(null === $element){ |
|
288 | - $element = $session->getPage()->find( |
|
289 | - 'named', |
|
290 | - array('id',$text) |
|
291 | - ); |
|
292 | - } |
|
293 | - if (null === $element) { |
|
294 | - throw new \InvalidArgumentException(sprintf('Cannot find text: "%s"', $text)); |
|
295 | - } |
|
275 | + /** |
|
276 | + * Click some text |
|
277 | + * |
|
278 | + * @When /^I click on the text "([^"]*)"$/ |
|
279 | + */ |
|
280 | + public function iClickOnTheText($text) |
|
281 | + { |
|
282 | + $session = $this->getSession(); |
|
283 | + $element = $session->getPage()->find( |
|
284 | + 'xpath', |
|
285 | + $session->getSelectorsHandler()->selectorToXpath('xpath', '*//*[text()="'. $text .'"]') |
|
286 | + ); |
|
287 | + if(null === $element){ |
|
288 | + $element = $session->getPage()->find( |
|
289 | + 'named', |
|
290 | + array('id',$text) |
|
291 | + ); |
|
292 | + } |
|
293 | + if (null === $element) { |
|
294 | + throw new \InvalidArgumentException(sprintf('Cannot find text: "%s"', $text)); |
|
295 | + } |
|
296 | 296 | |
297 | - $element->click(); |
|
297 | + $element->click(); |
|
298 | 298 | |
299 | - } |
|
299 | + } |
|
300 | 300 | |
301 | 301 | /** |
302 | 302 | * @Then /^(?:|I )should see translated text "(?P<text>(?:[^"]|\\")*)"$/ |
303 | 303 | */ |
304 | - public function iShouldSeeText($text) |
|
304 | + public function iShouldSeeText($text) |
|
305 | 305 | { |
306 | 306 | $translator = $this->getServiceManager()->get('translator'); |
307 | 307 | $translated = $translator->translate($text); |
@@ -14,26 +14,26 @@ |
||
14 | 14 | |
15 | 15 | class SettingsContext implements Context |
16 | 16 | { |
17 | - use CommonContextTrait; |
|
17 | + use CommonContextTrait; |
|
18 | 18 | |
19 | - /** |
|
20 | - * @Given I go to settings page |
|
21 | - */ |
|
22 | - public function iGoToSettingsPage() |
|
23 | - { |
|
24 | - //$this->visit('/settings'); |
|
19 | + /** |
|
20 | + * @Given I go to settings page |
|
21 | + */ |
|
22 | + public function iGoToSettingsPage() |
|
23 | + { |
|
24 | + //$this->visit('/settings'); |
|
25 | 25 | $url = $this->buildUrl('lang/settings'); |
26 | 26 | $this->visit($url); |
27 | - } |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * @Given I go to email template settings page |
|
31 | - */ |
|
32 | - public function iGoToEmailTemplatePage() |
|
33 | - { |
|
34 | - $url = $this->buildUrl('lang/settings',[ |
|
35 | - 'module' => 'Applications' |
|
29 | + /** |
|
30 | + * @Given I go to email template settings page |
|
31 | + */ |
|
32 | + public function iGoToEmailTemplatePage() |
|
33 | + { |
|
34 | + $url = $this->buildUrl('lang/settings',[ |
|
35 | + 'module' => 'Applications' |
|
36 | 36 | ]); |
37 | - $this->visit($url); |
|
38 | - } |
|
37 | + $this->visit($url); |
|
38 | + } |
|
39 | 39 | } |
@@ -22,37 +22,37 @@ |
||
22 | 22 | */ |
23 | 23 | class ApplicationContext implements Context |
24 | 24 | { |
25 | - use CommonContextTrait; |
|
25 | + use CommonContextTrait; |
|
26 | 26 | |
27 | - /** |
|
28 | - * @Given I apply for :title job |
|
29 | - * |
|
30 | - * @param string $title |
|
31 | - * @throws \Exception when the titled job not exists |
|
32 | - */ |
|
33 | - public function iApplyAJob($title) |
|
34 | - { |
|
35 | - /* @var $repo JobRepository */ |
|
36 | - $repo = $this->getRepository('Jobs/Job'); |
|
37 | - $job = $repo->findOneBy(['title' => $title]); |
|
38 | - if(!$job instanceof Job){ |
|
39 | - throw new \Exception('There is no job titled: "'.$title.'"'); |
|
40 | - } |
|
41 | - $job->setApplyId($job->getId()); |
|
42 | - $repo->store($job); |
|
27 | + /** |
|
28 | + * @Given I apply for :title job |
|
29 | + * |
|
30 | + * @param string $title |
|
31 | + * @throws \Exception when the titled job not exists |
|
32 | + */ |
|
33 | + public function iApplyAJob($title) |
|
34 | + { |
|
35 | + /* @var $repo JobRepository */ |
|
36 | + $repo = $this->getRepository('Jobs/Job'); |
|
37 | + $job = $repo->findOneBy(['title' => $title]); |
|
38 | + if(!$job instanceof Job){ |
|
39 | + throw new \Exception('There is no job titled: "'.$title.'"'); |
|
40 | + } |
|
41 | + $job->setApplyId($job->getId()); |
|
42 | + $repo->store($job); |
|
43 | 43 | |
44 | - $url = $this->buildUrl('lang/apply',[ |
|
45 | - 'applyId' => $job->getApplyId() |
|
44 | + $url = $this->buildUrl('lang/apply',[ |
|
45 | + 'applyId' => $job->getApplyId() |
|
46 | 46 | ]); |
47 | - $this->visit($url); |
|
48 | - } |
|
47 | + $this->visit($url); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @Given I visit job categories |
|
52 | - */ |
|
53 | - public function visitJobsCategories() |
|
54 | - { |
|
55 | - $url = '/admin/jobs/categories'; |
|
56 | - $this->visit($url); |
|
57 | - } |
|
50 | + /** |
|
51 | + * @Given I visit job categories |
|
52 | + */ |
|
53 | + public function visitJobsCategories() |
|
54 | + { |
|
55 | + $url = '/admin/jobs/categories'; |
|
56 | + $this->visit($url); |
|
57 | + } |
|
58 | 58 | } |
@@ -22,23 +22,23 @@ |
||
22 | 22 | */ |
23 | 23 | class CvContext implements Context |
24 | 24 | { |
25 | - use CommonContextTrait; |
|
25 | + use CommonContextTrait; |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @Given I go to manage my resume page |
|
30 | - */ |
|
31 | - public function iGoToManageResumePage() |
|
32 | - { |
|
33 | - $url = $this->buildUrl('lang/my-cv'); |
|
34 | - $this->visit($url); |
|
35 | - } |
|
28 | + /** |
|
29 | + * @Given I go to manage my resume page |
|
30 | + */ |
|
31 | + public function iGoToManageResumePage() |
|
32 | + { |
|
33 | + $url = $this->buildUrl('lang/my-cv'); |
|
34 | + $this->visit($url); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * @When I click edit on my personal information |
|
39 | - */ |
|
40 | - public function iClickEditOnPersonalInformations() |
|
41 | - { |
|
42 | - $this->summaryFormContext->iClickEditOnForm('resumePersonalInformations'); |
|
43 | - } |
|
37 | + /** |
|
38 | + * @When I click edit on my personal information |
|
39 | + */ |
|
40 | + public function iClickEditOnPersonalInformations() |
|
41 | + { |
|
42 | + $this->summaryFormContext->iClickEditOnForm('resumePersonalInformations'); |
|
43 | + } |
|
44 | 44 | } |
@@ -27,48 +27,48 @@ discard block |
||
27 | 27 | */ |
28 | 28 | class LazyControllerFactory implements AbstractFactoryInterface |
29 | 29 | { |
30 | - protected $aliases = [ |
|
31 | - FormElementManager::class => 'FormElementManager', |
|
32 | - ValidatorPluginManager::class => 'ValidatorManager', |
|
33 | - Translator::class => 'translator', |
|
34 | - ModuleManagerInterface::class => 'ModuleManager', |
|
35 | - EventManager::class => 'Core/EventManager', |
|
30 | + protected $aliases = [ |
|
31 | + FormElementManager::class => 'FormElementManager', |
|
32 | + ValidatorPluginManager::class => 'ValidatorManager', |
|
33 | + Translator::class => 'translator', |
|
34 | + ModuleManagerInterface::class => 'ModuleManager', |
|
35 | + EventManager::class => 'Core/EventManager', |
|
36 | 36 | RepositoryService::class => 'repositories', |
37 | - ]; |
|
37 | + ]; |
|
38 | 38 | |
39 | - public function canCreate( ContainerInterface $container, $requestedName ) |
|
40 | - { |
|
41 | - return strstr( $requestedName,'\Controller') !== false; |
|
42 | - } |
|
39 | + public function canCreate( ContainerInterface $container, $requestedName ) |
|
40 | + { |
|
41 | + return strstr( $requestedName,'\Controller') !== false; |
|
42 | + } |
|
43 | 43 | |
44 | - public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
45 | - { |
|
44 | + public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
45 | + { |
|
46 | 46 | $className = $this->getClassName($requestedName); |
47 | - $class = new \ReflectionClass($className); |
|
47 | + $class = new \ReflectionClass($className); |
|
48 | 48 | |
49 | - if( $constructor = $class->getConstructor() ) |
|
50 | - { |
|
51 | - if( $params = $constructor->getParameters() ) |
|
52 | - { |
|
53 | - $constructorArgs = []; |
|
54 | - foreach( $params as $p ) |
|
55 | - { |
|
56 | - $serviceName = ''; |
|
57 | - if( $p->getClass() ) { |
|
58 | - $serviceName = $p->getClass()->getName(); |
|
59 | - if (array_key_exists($serviceName, $this->aliases)) { |
|
60 | - $serviceName = $this->aliases[$serviceName]; |
|
61 | - } |
|
62 | - } |
|
63 | - else{ |
|
64 | - if( $p->getName() == 'config' ){ |
|
49 | + if( $constructor = $class->getConstructor() ) |
|
50 | + { |
|
51 | + if( $params = $constructor->getParameters() ) |
|
52 | + { |
|
53 | + $constructorArgs = []; |
|
54 | + foreach( $params as $p ) |
|
55 | + { |
|
56 | + $serviceName = ''; |
|
57 | + if( $p->getClass() ) { |
|
58 | + $serviceName = $p->getClass()->getName(); |
|
59 | + if (array_key_exists($serviceName, $this->aliases)) { |
|
60 | + $serviceName = $this->aliases[$serviceName]; |
|
61 | + } |
|
62 | + } |
|
63 | + else{ |
|
64 | + if( $p->getName() == 'config' ){ |
|
65 | 65 | $serviceName = 'config'; |
66 | 66 | } |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - if(!$container->has($serviceName)){ |
|
70 | - throw new ServiceNotCreatedException(sprintf( |
|
71 | - 'Can\'t create constructor argument "%s" for service "%s"', |
|
69 | + if(!$container->has($serviceName)){ |
|
70 | + throw new ServiceNotCreatedException(sprintf( |
|
71 | + 'Can\'t create constructor argument "%s" for service "%s"', |
|
72 | 72 | $p->getName(),$requestedName |
73 | 73 | )); |
74 | 74 | } |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | echo __CLASS__ . " couldn't create an instance of {$p->getName()} to satisfy the constructor for $requestedName."; |
80 | 80 | exit; |
81 | 81 | } |
82 | - } |
|
83 | - return $class->newInstanceArgs($constructorArgs); |
|
84 | - } |
|
85 | - } |
|
82 | + } |
|
83 | + return $class->newInstanceArgs($constructorArgs); |
|
84 | + } |
|
85 | + } |
|
86 | 86 | |
87 | - return new $className; |
|
88 | - } |
|
87 | + return new $className; |
|
88 | + } |
|
89 | 89 | |
90 | 90 | /** |
91 | 91 | * Generate class name |
@@ -25,24 +25,24 @@ discard block |
||
25 | 25 | */ |
26 | 26 | class IndexController extends AbstractActionController |
27 | 27 | { |
28 | - /** @var DefaultListener */ |
|
29 | - private $defaultListener; |
|
28 | + /** @var DefaultListener */ |
|
29 | + private $defaultListener; |
|
30 | 30 | |
31 | - private $config; |
|
31 | + private $config; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @var ModuleManager |
|
35 | - */ |
|
36 | - private $moduleManager; |
|
33 | + /** |
|
34 | + * @var ModuleManager |
|
35 | + */ |
|
36 | + private $moduleManager; |
|
37 | 37 | |
38 | - public function __construct( |
|
38 | + public function __construct( |
|
39 | 39 | ModuleManagerInterface $moduleManager, |
40 | 40 | $config |
41 | 41 | ) |
42 | - { |
|
43 | - $this->config = $config; |
|
44 | - $this->moduleManager = $moduleManager; |
|
45 | - } |
|
42 | + { |
|
43 | + $this->config = $config; |
|
44 | + $this->moduleManager = $moduleManager; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Home site |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | $viewModel = new ViewModel(); |
108 | 108 | $viewModel->setTemplate('error/index') |
109 | - ->setVariable('message', 'An unexpected error had occured. Please try again later.'); |
|
109 | + ->setVariable('message', 'An unexpected error had occured. Please try again later.'); |
|
110 | 110 | return $viewModel; |
111 | 111 | } |
112 | 112 | } |
@@ -34,188 +34,188 @@ discard block |
||
34 | 34 | */ |
35 | 35 | class JobContext implements Context |
36 | 36 | { |
37 | - use CommonContextTrait; |
|
37 | + use CommonContextTrait; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @var Select2Context |
|
41 | - */ |
|
42 | - private $select2Context; |
|
39 | + /** |
|
40 | + * @var Select2Context |
|
41 | + */ |
|
42 | + private $select2Context; |
|
43 | 43 | |
44 | - /** |
|
45 | - * @var Job |
|
46 | - */ |
|
47 | - private $currentJob; |
|
44 | + /** |
|
45 | + * @var Job |
|
46 | + */ |
|
47 | + private $currentJob; |
|
48 | 48 | |
49 | - /** |
|
50 | - * @var JobRepository |
|
51 | - */ |
|
52 | - static private $jobRepo; |
|
49 | + /** |
|
50 | + * @var JobRepository |
|
51 | + */ |
|
52 | + static private $jobRepo; |
|
53 | 53 | |
54 | - /** |
|
55 | - * @param User $user |
|
56 | - */ |
|
57 | - static public function removeJobByUser(User $user) |
|
58 | - { |
|
59 | - $repo = static::$jobRepo; |
|
60 | - $results = $repo->findBy(['user' => $user]); |
|
61 | - foreach($results as $result){ |
|
62 | - $repo->remove($result,true); |
|
63 | - } |
|
64 | - } |
|
54 | + /** |
|
55 | + * @param User $user |
|
56 | + */ |
|
57 | + static public function removeJobByUser(User $user) |
|
58 | + { |
|
59 | + $repo = static::$jobRepo; |
|
60 | + $results = $repo->findBy(['user' => $user]); |
|
61 | + foreach($results as $result){ |
|
62 | + $repo->remove($result,true); |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @BeforeScenario |
|
68 | - * |
|
69 | - * @param BeforeScenarioScope $scope |
|
70 | - */ |
|
71 | - public function beforeScenario(BeforeScenarioScope $scope) |
|
72 | - { |
|
73 | - $this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class); |
|
74 | - if(is_null(static::$jobRepo)){ |
|
75 | - $this->gatherContexts($scope); |
|
76 | - static::$jobRepo = $this->getJobRepository(); |
|
77 | - } |
|
78 | - } |
|
66 | + /** |
|
67 | + * @BeforeScenario |
|
68 | + * |
|
69 | + * @param BeforeScenarioScope $scope |
|
70 | + */ |
|
71 | + public function beforeScenario(BeforeScenarioScope $scope) |
|
72 | + { |
|
73 | + $this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class); |
|
74 | + if(is_null(static::$jobRepo)){ |
|
75 | + $this->gatherContexts($scope); |
|
76 | + static::$jobRepo = $this->getJobRepository(); |
|
77 | + } |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * @Given I go to job board page |
|
82 | - */ |
|
83 | - public function iGoToJobBoardPage() |
|
84 | - { |
|
85 | - $this->visit('/jobboard'); |
|
86 | - } |
|
80 | + /** |
|
81 | + * @Given I go to job board page |
|
82 | + */ |
|
83 | + public function iGoToJobBoardPage() |
|
84 | + { |
|
85 | + $this->visit('/jobboard'); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * @Given I go to create job page |
|
90 | - */ |
|
91 | - public function iGoToCreateJob() |
|
92 | - { |
|
93 | - $url = $this->buildUrl('lang/jobs/manage',['action' => 'edit']); |
|
94 | - $this->visit($url); |
|
95 | - } |
|
88 | + /** |
|
89 | + * @Given I go to create job page |
|
90 | + */ |
|
91 | + public function iGoToCreateJob() |
|
92 | + { |
|
93 | + $url = $this->buildUrl('lang/jobs/manage',['action' => 'edit']); |
|
94 | + $this->visit($url); |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * @Given I go to job overview page |
|
99 | - */ |
|
100 | - public function iGoToJobOverviewPage() |
|
101 | - { |
|
102 | - $this->visit('/jobs'); |
|
103 | - } |
|
97 | + /** |
|
98 | + * @Given I go to job overview page |
|
99 | + */ |
|
100 | + public function iGoToJobOverviewPage() |
|
101 | + { |
|
102 | + $this->visit('/jobs'); |
|
103 | + } |
|
104 | 104 | |
105 | - /** |
|
106 | - * @Given I go to edit job draft with title :jobTitle |
|
107 | - * @param $jobTitle |
|
108 | - * @throws \Exception when job is not found |
|
109 | - */ |
|
110 | - public function iGoToEditJobWithTitle($jobTitle) |
|
111 | - { |
|
112 | - $job = $this->getJobRepository()->findOneBy(['title' => $jobTitle]); |
|
113 | - if(!$job instanceof Job){ |
|
114 | - throw new \Exception(sprintf('Job with title "%s" is not found',$jobTitle)); |
|
115 | - } |
|
116 | - $this->currentJob = $job; |
|
117 | - $url = $this->buildUrl('lang/jobs/manage',[ |
|
118 | - 'id' => $job->getId() |
|
105 | + /** |
|
106 | + * @Given I go to edit job draft with title :jobTitle |
|
107 | + * @param $jobTitle |
|
108 | + * @throws \Exception when job is not found |
|
109 | + */ |
|
110 | + public function iGoToEditJobWithTitle($jobTitle) |
|
111 | + { |
|
112 | + $job = $this->getJobRepository()->findOneBy(['title' => $jobTitle]); |
|
113 | + if(!$job instanceof Job){ |
|
114 | + throw new \Exception(sprintf('Job with title "%s" is not found',$jobTitle)); |
|
115 | + } |
|
116 | + $this->currentJob = $job; |
|
117 | + $url = $this->buildUrl('lang/jobs/manage',[ |
|
118 | + 'id' => $job->getId() |
|
119 | 119 | ]); |
120 | - $this->visit($url); |
|
121 | - } |
|
120 | + $this->visit($url); |
|
121 | + } |
|
122 | 122 | |
123 | - /** |
|
124 | - * @Given I don't have any classification data |
|
125 | - */ |
|
126 | - public function iDonTHaveAnyClassificationData() |
|
127 | - { |
|
128 | - $this->currentJob->setClassifications(new Classifications()); |
|
129 | - $this->getJobRepository()->store($this->currentJob); |
|
130 | - } |
|
123 | + /** |
|
124 | + * @Given I don't have any classification data |
|
125 | + */ |
|
126 | + public function iDonTHaveAnyClassificationData() |
|
127 | + { |
|
128 | + $this->currentJob->setClassifications(new Classifications()); |
|
129 | + $this->getJobRepository()->store($this->currentJob); |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * @When I don't have any posted job |
|
134 | - */ |
|
135 | - public function iDonTHaveAnyPostedJob() |
|
136 | - { |
|
137 | - /* @var $jobRepository JobRepository */ |
|
138 | - /* @var $job Job */ |
|
139 | - $user = $this->getUserContext()->getCurrentUser(); |
|
132 | + /** |
|
133 | + * @When I don't have any posted job |
|
134 | + */ |
|
135 | + public function iDonTHaveAnyPostedJob() |
|
136 | + { |
|
137 | + /* @var $jobRepository JobRepository */ |
|
138 | + /* @var $job Job */ |
|
139 | + $user = $this->getUserContext()->getCurrentUser(); |
|
140 | 140 | |
141 | - $jobRepository = $this->getJobRepository(); |
|
142 | - $results = $jobRepository->getUserJobs($user->getId()); |
|
143 | - foreach($results as $job){ |
|
144 | - $jobRepository->remove($job,true); |
|
145 | - } |
|
146 | - $this->currentJob = null; |
|
147 | - } |
|
141 | + $jobRepository = $this->getJobRepository(); |
|
142 | + $results = $jobRepository->getUserJobs($user->getId()); |
|
143 | + foreach($results as $job){ |
|
144 | + $jobRepository->remove($job,true); |
|
145 | + } |
|
146 | + $this->currentJob = null; |
|
147 | + } |
|
148 | 148 | |
149 | - /** |
|
150 | - * @When I fill job location search with :search and choose :choice |
|
151 | - * |
|
152 | - */ |
|
153 | - public function iFillJobLocationAndChoose($search,$choice) |
|
154 | - { |
|
155 | - $select2 = $this->select2Context; |
|
156 | - $select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice); |
|
157 | - } |
|
149 | + /** |
|
150 | + * @When I fill job location search with :search and choose :choice |
|
151 | + * |
|
152 | + */ |
|
153 | + public function iFillJobLocationAndChoose($search,$choice) |
|
154 | + { |
|
155 | + $select2 = $this->select2Context; |
|
156 | + $select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice); |
|
157 | + } |
|
158 | 158 | |
159 | - /** |
|
160 | - * @When I choose :value from :field |
|
161 | - */ |
|
162 | - public function iJobClassificationSelect($value,$field) |
|
163 | - { |
|
164 | - $field = Inflector::camelize($field); |
|
159 | + /** |
|
160 | + * @When I choose :value from :field |
|
161 | + */ |
|
162 | + public function iJobClassificationSelect($value,$field) |
|
163 | + { |
|
164 | + $field = Inflector::camelize($field); |
|
165 | 165 | |
166 | - $mapSelect2 = [ |
|
167 | - 'professions' => '#classifications-professions-span .select2-container', |
|
168 | - 'industries' => '#classifications-industries-span .select2-container', |
|
169 | - 'employmentTypes' => '#classifications-employmentTypes-span .select2-container', |
|
170 | - ]; |
|
166 | + $mapSelect2 = [ |
|
167 | + 'professions' => '#classifications-professions-span .select2-container', |
|
168 | + 'industries' => '#classifications-industries-span .select2-container', |
|
169 | + 'employmentTypes' => '#classifications-employmentTypes-span .select2-container', |
|
170 | + ]; |
|
171 | 171 | |
172 | - $mapMultiple = [ |
|
173 | - 'professions' => "select#classifications-professions", |
|
174 | - 'industries' => "select#classifications-industries", |
|
175 | - 'employmentTypes' => "select#classifications-employmentTypes", |
|
176 | - ]; |
|
172 | + $mapMultiple = [ |
|
173 | + 'professions' => "select#classifications-professions", |
|
174 | + 'industries' => "select#classifications-industries", |
|
175 | + 'employmentTypes' => "select#classifications-employmentTypes", |
|
176 | + ]; |
|
177 | 177 | |
178 | - if(!isset($mapSelect2[$field])){ |
|
179 | - throw new \Exception('Undefined field selection value "'.$field.'"'); |
|
180 | - } |
|
178 | + if(!isset($mapSelect2[$field])){ |
|
179 | + throw new \Exception('Undefined field selection value "'.$field.'"'); |
|
180 | + } |
|
181 | 181 | |
182 | - $multipleField = $mapMultiple[$field]; |
|
183 | - $page = $this->minkContext->getSession()->getPage(); |
|
184 | - $element = $page->find('css',$mapMultiple[$field]); |
|
185 | - if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){ |
|
186 | - $this->minkContext->selectOption($value,$multipleField); |
|
187 | - }else{ |
|
188 | - $locator = $mapSelect2[$field]; |
|
189 | - $this->select2Context->iFillInSelect2Field($locator,$value); |
|
190 | - } |
|
191 | - } |
|
182 | + $multipleField = $mapMultiple[$field]; |
|
183 | + $page = $this->minkContext->getSession()->getPage(); |
|
184 | + $element = $page->find('css',$mapMultiple[$field]); |
|
185 | + if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){ |
|
186 | + $this->minkContext->selectOption($value,$multipleField); |
|
187 | + }else{ |
|
188 | + $locator = $mapSelect2[$field]; |
|
189 | + $this->select2Context->iFillInSelect2Field($locator,$value); |
|
190 | + } |
|
191 | + } |
|
192 | 192 | |
193 | - /** |
|
194 | - * @return JobRepository |
|
195 | - */ |
|
196 | - public function getJobRepository() |
|
197 | - { |
|
198 | - return $this->getRepository('Jobs/Job'); |
|
199 | - } |
|
193 | + /** |
|
194 | + * @return JobRepository |
|
195 | + */ |
|
196 | + public function getJobRepository() |
|
197 | + { |
|
198 | + return $this->getRepository('Jobs/Job'); |
|
199 | + } |
|
200 | 200 | |
201 | - /** |
|
202 | - * @return CategoriesRepo |
|
203 | - */ |
|
204 | - public function getCategoriesRepository() |
|
205 | - { |
|
206 | - return $this->getRepository('Jobs/Category'); |
|
207 | - } |
|
201 | + /** |
|
202 | + * @return CategoriesRepo |
|
203 | + */ |
|
204 | + public function getCategoriesRepository() |
|
205 | + { |
|
206 | + return $this->getRepository('Jobs/Category'); |
|
207 | + } |
|
208 | 208 | |
209 | - /** |
|
210 | - * @When I have a :status job with the following: |
|
211 | - * @param TableNode $fields |
|
212 | - */ |
|
213 | - public function iHaveAJobWithTheFollowing($status,TableNode $fields) |
|
214 | - { |
|
215 | - $this->buildJob($status,$fields->getRowsHash()); |
|
216 | - } |
|
209 | + /** |
|
210 | + * @When I have a :status job with the following: |
|
211 | + * @param TableNode $fields |
|
212 | + */ |
|
213 | + public function iHaveAJobWithTheFollowing($status,TableNode $fields) |
|
214 | + { |
|
215 | + $this->buildJob($status,$fields->getRowsHash()); |
|
216 | + } |
|
217 | 217 | |
218 | - public function buildJob($status, $definitions,$organization = null) |
|
218 | + public function buildJob($status, $definitions,$organization = null) |
|
219 | 219 | { |
220 | 220 | $normalizedField = [ |
221 | 221 | 'template' => 'modern', |
@@ -284,84 +284,84 @@ discard block |
||
284 | 284 | } |
285 | 285 | |
286 | 286 | |
287 | - private function setLocation(Job $job, $term) |
|
288 | - { |
|
289 | - /* @var $client Photon */ |
|
290 | - $client = $this->coreContext->getServiceManager()->get('Geo/Client'); |
|
291 | - $result = $client->queryOne($term); |
|
292 | - $location = new Location(); |
|
293 | - $serialized = Json::encode($result); |
|
294 | - $location->fromString($serialized); |
|
287 | + private function setLocation(Job $job, $term) |
|
288 | + { |
|
289 | + /* @var $client Photon */ |
|
290 | + $client = $this->coreContext->getServiceManager()->get('Geo/Client'); |
|
291 | + $result = $client->queryOne($term); |
|
292 | + $location = new Location(); |
|
293 | + $serialized = Json::encode($result); |
|
294 | + $location->fromString($serialized); |
|
295 | 295 | |
296 | - $locations = $job->getLocations(); |
|
297 | - if(count($locations)){ |
|
298 | - $locations->clear(); |
|
299 | - } |
|
300 | - $job->getLocations()->add($location); |
|
301 | - } |
|
296 | + $locations = $job->getLocations(); |
|
297 | + if(count($locations)){ |
|
298 | + $locations->clear(); |
|
299 | + } |
|
300 | + $job->getLocations()->add($location); |
|
301 | + } |
|
302 | 302 | |
303 | - private function addProfessions(Job &$job,$terms) |
|
304 | - { |
|
305 | - $professions = $this->getCategories($terms); |
|
306 | - foreach($professions as $profession){ |
|
307 | - $values = $job->getClassifications()->getProfessions()->getValues(); |
|
308 | - if(!is_array($values) || !in_array($profession,$values)){ |
|
309 | - $job->getClassifications()->getProfessions()->getItems()->add($profession); |
|
310 | - } |
|
311 | - } |
|
312 | - } |
|
303 | + private function addProfessions(Job &$job,$terms) |
|
304 | + { |
|
305 | + $professions = $this->getCategories($terms); |
|
306 | + foreach($professions as $profession){ |
|
307 | + $values = $job->getClassifications()->getProfessions()->getValues(); |
|
308 | + if(!is_array($values) || !in_array($profession,$values)){ |
|
309 | + $job->getClassifications()->getProfessions()->getItems()->add($profession); |
|
310 | + } |
|
311 | + } |
|
312 | + } |
|
313 | 313 | |
314 | - private function addIndustries(Job &$job, $terms) |
|
315 | - { |
|
316 | - $industries = $this->getCategories($terms); |
|
317 | - foreach($industries as $industry){ |
|
318 | - $values = $job->getClassifications()->getIndustries()->getValues(); |
|
319 | - if(!is_array($values) || !in_array($industry,$values)){ |
|
320 | - $job->getClassifications()->getIndustries()->getItems()->add($industry); |
|
321 | - } |
|
322 | - } |
|
323 | - } |
|
314 | + private function addIndustries(Job &$job, $terms) |
|
315 | + { |
|
316 | + $industries = $this->getCategories($terms); |
|
317 | + foreach($industries as $industry){ |
|
318 | + $values = $job->getClassifications()->getIndustries()->getValues(); |
|
319 | + if(!is_array($values) || !in_array($industry,$values)){ |
|
320 | + $job->getClassifications()->getIndustries()->getItems()->add($industry); |
|
321 | + } |
|
322 | + } |
|
323 | + } |
|
324 | 324 | |
325 | - /** |
|
326 | - * @param array $categories |
|
327 | - * |
|
328 | - * @return mixed |
|
329 | - */ |
|
330 | - private function getCategories(array $categories) |
|
331 | - { |
|
332 | - $catRepo = $this->getCategoriesRepository(); |
|
325 | + /** |
|
326 | + * @param array $categories |
|
327 | + * |
|
328 | + * @return mixed |
|
329 | + */ |
|
330 | + private function getCategories(array $categories) |
|
331 | + { |
|
332 | + $catRepo = $this->getCategoriesRepository(); |
|
333 | 333 | |
334 | - // get a professions |
|
335 | - $qb = $catRepo->createQueryBuilder() |
|
336 | - ->field('name')->in($categories) |
|
337 | - ->getQuery() |
|
338 | - ; |
|
339 | - $results = $qb->execute(); |
|
340 | - return $results->toArray(); |
|
341 | - } |
|
334 | + // get a professions |
|
335 | + $qb = $catRepo->createQueryBuilder() |
|
336 | + ->field('name')->in($categories) |
|
337 | + ->getQuery() |
|
338 | + ; |
|
339 | + $results = $qb->execute(); |
|
340 | + return $results->toArray(); |
|
341 | + } |
|
342 | 342 | |
343 | 343 | |
344 | - /** |
|
345 | - * @return Job |
|
346 | - */ |
|
347 | - private function getCurrentUserJobDraft($jobTitle) |
|
348 | - { |
|
349 | - $repo = $this->getJobRepository(); |
|
350 | - $user = $this->getCurrentUser(); |
|
344 | + /** |
|
345 | + * @return Job |
|
346 | + */ |
|
347 | + private function getCurrentUserJobDraft($jobTitle) |
|
348 | + { |
|
349 | + $repo = $this->getJobRepository(); |
|
350 | + $user = $this->getCurrentUser(); |
|
351 | 351 | |
352 | - $job = $repo->findDraft($user); |
|
352 | + $job = $repo->findDraft($user); |
|
353 | 353 | |
354 | - if(is_null($job)){ |
|
355 | - $job = new Job(); |
|
356 | - $job |
|
357 | - ->setUser($user) |
|
358 | - ->setOrganization($user->getOrganization()->getOrganization()) |
|
359 | - ->setStatus(StatusInterface::CREATED) |
|
360 | - ; |
|
361 | - $job->setIsDraft(true); |
|
362 | - } |
|
363 | - $job->setTitle($jobTitle); |
|
364 | - $repo->store($job); |
|
365 | - return $job; |
|
366 | - } |
|
354 | + if(is_null($job)){ |
|
355 | + $job = new Job(); |
|
356 | + $job |
|
357 | + ->setUser($user) |
|
358 | + ->setOrganization($user->getOrganization()->getOrganization()) |
|
359 | + ->setStatus(StatusInterface::CREATED) |
|
360 | + ; |
|
361 | + $job->setIsDraft(true); |
|
362 | + } |
|
363 | + $job->setTitle($jobTitle); |
|
364 | + $repo->store($job); |
|
365 | + return $job; |
|
366 | + } |
|
367 | 367 | } |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class OrganizationContext implements Context |
32 | 32 | { |
33 | - use CommonContextTrait; |
|
33 | + use CommonContextTrait; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @var JobContext |
37 | 37 | */ |
38 | - private $jobContext; |
|
38 | + private $jobContext; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * @BeforeScenario |
@@ -47,51 +47,51 @@ discard block |
||
47 | 47 | $this->jobContext = $scope->getEnvironment()->getContext(JobContext::class); |
48 | 48 | } |
49 | 49 | |
50 | - /** |
|
51 | - * @Given I go to my organization page |
|
52 | - */ |
|
53 | - public function iGoToMyOrganizationPage() |
|
54 | - { |
|
50 | + /** |
|
51 | + * @Given I go to my organization page |
|
52 | + */ |
|
53 | + public function iGoToMyOrganizationPage() |
|
54 | + { |
|
55 | 55 | $url = $this->buildUrl('lang/my-organization'); |
56 | - $this->visit($url); |
|
57 | - } |
|
56 | + $this->visit($url); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * @When I hover over name form |
|
61 | - */ |
|
62 | - public function iMouseOverOrganizationNameForm() |
|
63 | - { |
|
64 | - $locator = '#sf-nameForm .sf-summary'; |
|
65 | - $this->coreContext->iHoverOverTheElement($locator); |
|
66 | - } |
|
59 | + /** |
|
60 | + * @When I hover over name form |
|
61 | + */ |
|
62 | + public function iMouseOverOrganizationNameForm() |
|
63 | + { |
|
64 | + $locator = '#sf-nameForm .sf-summary'; |
|
65 | + $this->coreContext->iHoverOverTheElement($locator); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @Given I go to create new organization page |
|
70 | - */ |
|
71 | - public function iGoToCreateNewOrganizationPage() |
|
72 | - { |
|
73 | - //$this->visit('/organizations/edit'); |
|
68 | + /** |
|
69 | + * @Given I go to create new organization page |
|
70 | + */ |
|
71 | + public function iGoToCreateNewOrganizationPage() |
|
72 | + { |
|
73 | + //$this->visit('/organizations/edit'); |
|
74 | 74 | $url = $this->buildUrl('lang/organizations/edit'); |
75 | 75 | $this->visit($url); |
76 | - } |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @Given I go to organization overview page |
|
80 | - */ |
|
81 | - public function iGoToOrganizationOverviewPage() |
|
82 | - { |
|
83 | - //$this->visit('/organizations'); |
|
84 | - $url = $this->buildUrl('lang/organizations'); |
|
85 | - $this->visit($url); |
|
86 | - } |
|
78 | + /** |
|
79 | + * @Given I go to organization overview page |
|
80 | + */ |
|
81 | + public function iGoToOrganizationOverviewPage() |
|
82 | + { |
|
83 | + //$this->visit('/organizations'); |
|
84 | + $url = $this->buildUrl('lang/organizations'); |
|
85 | + $this->visit($url); |
|
86 | + } |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * @Given I want to see list organization profiles |
90 | 90 | */ |
91 | - public function iWantToSeeListOrganizationProfiles() |
|
91 | + public function iWantToSeeListOrganizationProfiles() |
|
92 | 92 | { |
93 | - $url = $this->buildUrl('lang/organizations/profile'); |
|
94 | - $this->visit($url); |
|
93 | + $url = $this->buildUrl('lang/organizations/profile'); |
|
94 | + $this->visit($url); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @internal param string $name |
101 | 101 | * @internal param TableNode|null $table |
102 | 102 | */ |
103 | - public function iHaveOrganization($name) |
|
103 | + public function iHaveOrganization($name) |
|
104 | 104 | { |
105 | 105 | $user = $this->getUserContext()->getCurrentUser(); |
106 | 106 | $organization = $this->findOrganizationByName($name,false); |