@@ -15,112 +15,112 @@ |
||
15 | 15 | |
16 | 16 | class SummaryFormContext implements Context |
17 | 17 | { |
18 | - use CommonContextTrait; |
|
18 | + use CommonContextTrait; |
|
19 | 19 | |
20 | - private $elementMap = array( |
|
21 | - 'name' => '#sf-nameForm', |
|
22 | - 'location' => '#sf-locationForm', |
|
23 | - 'employees' => '#sf-employeesManagement', |
|
24 | - 'workflow' => '#sf-workflowSettings', |
|
25 | - 'jobTitleAndLocation' => '#general-locationForm', |
|
26 | - 'jobClassification' => '#sf-general-classifications', |
|
27 | - 'customerNote' => '#sf-general-customerNote', |
|
28 | - 'personalInformations' => '#sf-contact-contact', |
|
29 | - 'resumePersonalInformations' => '#sf-contact', |
|
30 | - ); |
|
20 | + private $elementMap = array( |
|
21 | + 'name' => '#sf-nameForm', |
|
22 | + 'location' => '#sf-locationForm', |
|
23 | + 'employees' => '#sf-employeesManagement', |
|
24 | + 'workflow' => '#sf-workflowSettings', |
|
25 | + 'jobTitleAndLocation' => '#general-locationForm', |
|
26 | + 'jobClassification' => '#sf-general-classifications', |
|
27 | + 'customerNote' => '#sf-general-customerNote', |
|
28 | + 'personalInformations' => '#sf-contact-contact', |
|
29 | + 'resumePersonalInformations' => '#sf-contact', |
|
30 | + ); |
|
31 | 31 | |
32 | - /** |
|
33 | - * @When I click edit on :name form |
|
34 | - * @TODO: [ZF3] move this method to CoreContext |
|
35 | - */ |
|
36 | - public function iClickEditOnForm($name) |
|
37 | - { |
|
38 | - $this->iClickForm($name); |
|
39 | - $name = Inflector::camelize($name); |
|
40 | - $type = $this->elementMap[$name]; |
|
41 | - $locator = $type.' .sf-summary .sf-controls button'; |
|
42 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
43 | - if(!$element){ |
|
44 | - throw new \Exception('No element found with this locator: "'.$locator.'"'); |
|
45 | - } |
|
46 | - $element->click(); |
|
47 | - } |
|
32 | + /** |
|
33 | + * @When I click edit on :name form |
|
34 | + * @TODO: [ZF3] move this method to CoreContext |
|
35 | + */ |
|
36 | + public function iClickEditOnForm($name) |
|
37 | + { |
|
38 | + $this->iClickForm($name); |
|
39 | + $name = Inflector::camelize($name); |
|
40 | + $type = $this->elementMap[$name]; |
|
41 | + $locator = $type.' .sf-summary .sf-controls button'; |
|
42 | + $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
43 | + if(!$element){ |
|
44 | + throw new \Exception('No element found with this locator: "'.$locator.'"'); |
|
45 | + } |
|
46 | + $element->click(); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @When I click :form form |
|
51 | - */ |
|
52 | - public function iClickForm($name) |
|
53 | - { |
|
54 | - $name = Inflector::camelize($name); |
|
55 | - $type = $this->elementMap[$name]; |
|
56 | - $locator = $type.' .sf-summary'; |
|
57 | - $session = $this->minkContext->getSession(); |
|
58 | - $script = <<<EOC |
|
49 | + /** |
|
50 | + * @When I click :form form |
|
51 | + */ |
|
52 | + public function iClickForm($name) |
|
53 | + { |
|
54 | + $name = Inflector::camelize($name); |
|
55 | + $type = $this->elementMap[$name]; |
|
56 | + $locator = $type.' .sf-summary'; |
|
57 | + $session = $this->minkContext->getSession(); |
|
58 | + $script = <<<EOC |
|
59 | 59 | var tElement = jQuery("$locator .sf-controls"); |
60 | 60 | tElement.css('display','block'); |
61 | 61 | tElement.css('visibility','visible'); |
62 | 62 | EOC; |
63 | - $session->executeScript($script); |
|
64 | - } |
|
63 | + $session->executeScript($script); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @When I save :type form |
|
68 | - */ |
|
69 | - public function iSaveForm($type) |
|
70 | - { |
|
71 | - $type = Inflector::camelize($type); |
|
72 | - $method = 'iSave'.$type; |
|
73 | - if(method_exists($this,$method)){ |
|
74 | - call_user_func([$this,$method]); |
|
75 | - }else{ |
|
76 | - $locator = $this->elementMap[$type].'-buttons-submit'; |
|
77 | - $this->coreContext->scrollIntoView($locator); |
|
78 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
79 | - $element->click(); |
|
80 | - } |
|
81 | - } |
|
66 | + /** |
|
67 | + * @When I save :type form |
|
68 | + */ |
|
69 | + public function iSaveForm($type) |
|
70 | + { |
|
71 | + $type = Inflector::camelize($type); |
|
72 | + $method = 'iSave'.$type; |
|
73 | + if(method_exists($this,$method)){ |
|
74 | + call_user_func([$this,$method]); |
|
75 | + }else{ |
|
76 | + $locator = $this->elementMap[$type].'-buttons-submit'; |
|
77 | + $this->coreContext->scrollIntoView($locator); |
|
78 | + $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
79 | + $element->click(); |
|
80 | + } |
|
81 | + } |
|
82 | 82 | |
83 | - public function iSaveOrganizationName() |
|
84 | - { |
|
85 | - $locator = '#nameForm-buttons-submit'; |
|
86 | - $this->coreContext->scrollIntoView($locator); |
|
87 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
88 | - $element->click(); |
|
89 | - } |
|
83 | + public function iSaveOrganizationName() |
|
84 | + { |
|
85 | + $locator = '#nameForm-buttons-submit'; |
|
86 | + $this->coreContext->scrollIntoView($locator); |
|
87 | + $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
88 | + $element->click(); |
|
89 | + } |
|
90 | 90 | |
91 | - /** |
|
92 | - * Saving organization workflow |
|
93 | - */ |
|
94 | - public function iSaveWorkflow() |
|
95 | - { |
|
96 | - $locator = '#workflowSettings-buttons-submit'; |
|
97 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
98 | - $element->click(); |
|
99 | - } |
|
91 | + /** |
|
92 | + * Saving organization workflow |
|
93 | + */ |
|
94 | + public function iSaveWorkflow() |
|
95 | + { |
|
96 | + $locator = '#workflowSettings-buttons-submit'; |
|
97 | + $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
98 | + $element->click(); |
|
99 | + } |
|
100 | 100 | |
101 | - public function iSaveOrganizationLocation() |
|
102 | - { |
|
103 | - $locator = '#locationForm-buttons-submit'; |
|
104 | - $this->coreContext->scrollIntoView($locator); |
|
105 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
106 | - $element->click(); |
|
107 | - } |
|
101 | + public function iSaveOrganizationLocation() |
|
102 | + { |
|
103 | + $locator = '#locationForm-buttons-submit'; |
|
104 | + $this->coreContext->scrollIntoView($locator); |
|
105 | + $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
106 | + $element->click(); |
|
107 | + } |
|
108 | 108 | |
109 | 109 | |
110 | - public function iSaveJobClassification() |
|
111 | - { |
|
112 | - $locator = '#general-classifications-buttons-submit'; |
|
113 | - $this->coreContext->scrollIntoView($locator); |
|
114 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
115 | - $element->click(); |
|
116 | - } |
|
110 | + public function iSaveJobClassification() |
|
111 | + { |
|
112 | + $locator = '#general-classifications-buttons-submit'; |
|
113 | + $this->coreContext->scrollIntoView($locator); |
|
114 | + $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
115 | + $element->click(); |
|
116 | + } |
|
117 | 117 | |
118 | - public function iSaveCustomerNote() |
|
119 | - { |
|
120 | - $locator = '#general-customerNote-buttons-submit'; |
|
121 | - $this->coreContext->scrollIntoView('#sf-general-customerNote'); |
|
122 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
123 | - $element->click(); |
|
124 | - } |
|
118 | + public function iSaveCustomerNote() |
|
119 | + { |
|
120 | + $locator = '#general-customerNote-buttons-submit'; |
|
121 | + $this->coreContext->scrollIntoView('#sf-general-customerNote'); |
|
122 | + $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
123 | + $element->click(); |
|
124 | + } |
|
125 | 125 | |
126 | 126 | } |
127 | 127 | \ No newline at end of file |
@@ -23,290 +23,290 @@ |
||
23 | 23 | */ |
24 | 24 | class CoreContext extends RawMinkContext |
25 | 25 | { |
26 | - static protected $application; |
|
26 | + static protected $application; |
|
27 | 27 | |
28 | - /** |
|
29 | - * @var MinkContext |
|
30 | - */ |
|
31 | - protected $minkContext; |
|
28 | + /** |
|
29 | + * @var MinkContext |
|
30 | + */ |
|
31 | + protected $minkContext; |
|
32 | 32 | |
33 | - static private $jobCategoryChecked = false; |
|
33 | + static private $jobCategoryChecked = false; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @BeforeScenario |
|
37 | - * @param BeforeScenarioScope $scope |
|
38 | - */ |
|
39 | - public function gatherContexts(BeforeScenarioScope $scope) |
|
40 | - { |
|
41 | - $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
42 | - if(false === static::$jobCategoryChecked){ |
|
43 | - /* @var Categories $catRepo */ |
|
44 | - $catRepo = $this->getRepositories()->get('Jobs/Category'); |
|
45 | - $all = $catRepo->findAll(); |
|
46 | - if(count($all) <= 1){ |
|
47 | - $catRepo->createDefaultCategory('professions'); |
|
48 | - $catRepo->createDefaultCategory('industries'); |
|
49 | - $catRepo->createDefaultCategory('employmentTypes'); |
|
50 | - } |
|
51 | - static::$jobCategoryChecked = true; |
|
52 | - } |
|
53 | - } |
|
35 | + /** |
|
36 | + * @BeforeScenario |
|
37 | + * @param BeforeScenarioScope $scope |
|
38 | + */ |
|
39 | + public function gatherContexts(BeforeScenarioScope $scope) |
|
40 | + { |
|
41 | + $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
42 | + if(false === static::$jobCategoryChecked){ |
|
43 | + /* @var Categories $catRepo */ |
|
44 | + $catRepo = $this->getRepositories()->get('Jobs/Category'); |
|
45 | + $all = $catRepo->findAll(); |
|
46 | + if(count($all) <= 1){ |
|
47 | + $catRepo->createDefaultCategory('professions'); |
|
48 | + $catRepo->createDefaultCategory('industries'); |
|
49 | + $catRepo->createDefaultCategory('employmentTypes'); |
|
50 | + } |
|
51 | + static::$jobCategoryChecked = true; |
|
52 | + } |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * @return Application |
|
57 | - */ |
|
58 | - public function getApplication() |
|
59 | - { |
|
60 | - if(!is_object(static::$application)){ |
|
61 | - $configFile = realpath(__DIR__.'/../../../config/config.php'); |
|
62 | - $config = include($configFile); |
|
63 | - static::$application = Application::init($config); |
|
64 | - } |
|
65 | - return static::$application; |
|
66 | - } |
|
55 | + /** |
|
56 | + * @return Application |
|
57 | + */ |
|
58 | + public function getApplication() |
|
59 | + { |
|
60 | + if(!is_object(static::$application)){ |
|
61 | + $configFile = realpath(__DIR__.'/../../../config/config.php'); |
|
62 | + $config = include($configFile); |
|
63 | + static::$application = Application::init($config); |
|
64 | + } |
|
65 | + return static::$application; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @return \Zend\ServiceManager\ServiceManager |
|
70 | - */ |
|
71 | - public function getServiceManager() |
|
72 | - { |
|
73 | - return $this->getApplication()->getServiceManager(); |
|
74 | - } |
|
68 | + /** |
|
69 | + * @return \Zend\ServiceManager\ServiceManager |
|
70 | + */ |
|
71 | + public function getServiceManager() |
|
72 | + { |
|
73 | + return $this->getApplication()->getServiceManager(); |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @return \Zend\EventManager\EventManagerInterface |
|
78 | - */ |
|
79 | - public function getEventManager() |
|
80 | - { |
|
81 | - return $this->getApplication()->getEventManager(); |
|
82 | - } |
|
76 | + /** |
|
77 | + * @return \Zend\EventManager\EventManagerInterface |
|
78 | + */ |
|
79 | + public function getEventManager() |
|
80 | + { |
|
81 | + return $this->getApplication()->getEventManager(); |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * @return RepositoryService |
|
86 | - */ |
|
87 | - public function getRepositories() |
|
88 | - { |
|
89 | - return $this->getServiceManager()->get('repositories'); |
|
90 | - } |
|
84 | + /** |
|
85 | + * @return RepositoryService |
|
86 | + */ |
|
87 | + public function getRepositories() |
|
88 | + { |
|
89 | + return $this->getServiceManager()->get('repositories'); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * @param $name |
|
94 | - * @param array $params |
|
95 | - * |
|
96 | - * @return string |
|
97 | - */ |
|
98 | - public function generateUrl($name) |
|
99 | - { |
|
100 | - return $this->minkContext->locatePath($name); |
|
101 | - } |
|
92 | + /** |
|
93 | + * @param $name |
|
94 | + * @param array $params |
|
95 | + * |
|
96 | + * @return string |
|
97 | + */ |
|
98 | + public function generateUrl($name) |
|
99 | + { |
|
100 | + return $this->minkContext->locatePath($name); |
|
101 | + } |
|
102 | 102 | |
103 | - /** |
|
104 | - * @When /^I hover over the element "([^"]*)"$/ |
|
105 | - */ |
|
106 | - public function iHoverOverTheElement($locator) |
|
107 | - { |
|
108 | - $session = $this->minkContext->getSession(); // get the mink session |
|
109 | - $element = $session->getPage()->find('css', $locator); // runs the actual query and returns the element |
|
103 | + /** |
|
104 | + * @When /^I hover over the element "([^"]*)"$/ |
|
105 | + */ |
|
106 | + public function iHoverOverTheElement($locator) |
|
107 | + { |
|
108 | + $session = $this->minkContext->getSession(); // get the mink session |
|
109 | + $element = $session->getPage()->find('css', $locator); // runs the actual query and returns the element |
|
110 | 110 | |
111 | - // errors must not pass silently |
|
112 | - if (null === $element) { |
|
113 | - throw new \InvalidArgumentException(sprintf('Could not evaluate CSS selector: "%s"', $locator)); |
|
114 | - } |
|
111 | + // errors must not pass silently |
|
112 | + if (null === $element) { |
|
113 | + throw new \InvalidArgumentException(sprintf('Could not evaluate CSS selector: "%s"', $locator)); |
|
114 | + } |
|
115 | 115 | |
116 | - // ok, let's hover it |
|
117 | - $element->mouseOver(); |
|
118 | - } |
|
116 | + // ok, let's hover it |
|
117 | + $element->mouseOver(); |
|
118 | + } |
|
119 | 119 | |
120 | - /** |
|
121 | - * @Given /^I wait for (\d+) seconds$/ |
|
122 | - */ |
|
123 | - public function iWaitForSecond($second) |
|
124 | - { |
|
125 | - sleep($second); |
|
126 | - } |
|
120 | + /** |
|
121 | + * @Given /^I wait for (\d+) seconds$/ |
|
122 | + */ |
|
123 | + public function iWaitForSecond($second) |
|
124 | + { |
|
125 | + sleep($second); |
|
126 | + } |
|
127 | 127 | |
128 | - /** |
|
129 | - * @Then /^I wait for the ajax response$/ |
|
130 | - */ |
|
131 | - public function iWaitForTheAjaxResponse() |
|
132 | - { |
|
133 | - $this->getSession()->wait(5000, '(0 === jQuery.active)'); |
|
134 | - } |
|
128 | + /** |
|
129 | + * @Then /^I wait for the ajax response$/ |
|
130 | + */ |
|
131 | + public function iWaitForTheAjaxResponse() |
|
132 | + { |
|
133 | + $this->getSession()->wait(5000, '(0 === jQuery.active)'); |
|
134 | + } |
|
135 | 135 | |
136 | - /** |
|
137 | - * Some forms do not have a Submit button just pass the ID |
|
138 | - * |
|
139 | - * @Given /^I submit the form with id "([^"]*)"$/ |
|
140 | - */ |
|
141 | - public function iSubmitTheFormWithId($arg) |
|
142 | - { |
|
143 | - $node = $this->minkContext->getSession()->getPage()->find('css', $arg); |
|
144 | - if($node) { |
|
145 | - $this->minkContext->getSession()->executeScript("jQuery('$arg').submit();"); |
|
146 | - } else { |
|
147 | - throw new \Exception('Element not found'); |
|
148 | - } |
|
149 | - } |
|
136 | + /** |
|
137 | + * Some forms do not have a Submit button just pass the ID |
|
138 | + * |
|
139 | + * @Given /^I submit the form with id "([^"]*)"$/ |
|
140 | + */ |
|
141 | + public function iSubmitTheFormWithId($arg) |
|
142 | + { |
|
143 | + $node = $this->minkContext->getSession()->getPage()->find('css', $arg); |
|
144 | + if($node) { |
|
145 | + $this->minkContext->getSession()->executeScript("jQuery('$arg').submit();"); |
|
146 | + } else { |
|
147 | + throw new \Exception('Element not found'); |
|
148 | + } |
|
149 | + } |
|
150 | 150 | |
151 | - /** |
|
152 | - * @Then I switch to popup :name |
|
153 | - * |
|
154 | - * @param $name |
|
155 | - */ |
|
156 | - public function iSwitchToPopup($name) |
|
157 | - { |
|
158 | - $this->iSetMainWindowName(); |
|
159 | - $this->getSession()->switchToWindow($name); |
|
160 | - } |
|
151 | + /** |
|
152 | + * @Then I switch to popup :name |
|
153 | + * |
|
154 | + * @param $name |
|
155 | + */ |
|
156 | + public function iSwitchToPopup($name) |
|
157 | + { |
|
158 | + $this->iSetMainWindowName(); |
|
159 | + $this->getSession()->switchToWindow($name); |
|
160 | + } |
|
161 | 161 | |
162 | - /** |
|
163 | - * @Then I set main window name |
|
164 | - */ |
|
165 | - public function iSetMainWindowName() |
|
166 | - { |
|
167 | - $window_name = 'main_window'; |
|
168 | - $script = 'window.name = "' . $window_name . '"'; |
|
169 | - $this->getSession()->executeScript($script); |
|
170 | - } |
|
162 | + /** |
|
163 | + * @Then I set main window name |
|
164 | + */ |
|
165 | + public function iSetMainWindowName() |
|
166 | + { |
|
167 | + $window_name = 'main_window'; |
|
168 | + $script = 'window.name = "' . $window_name . '"'; |
|
169 | + $this->getSession()->executeScript($script); |
|
170 | + } |
|
171 | 171 | |
172 | - /** |
|
173 | - * @Then I switch back to main window |
|
174 | - */ |
|
175 | - public function iSwitchBackToMainWindow() |
|
176 | - { |
|
177 | - $this->getSession()->switchToWindow('main_window'); |
|
178 | - } |
|
172 | + /** |
|
173 | + * @Then I switch back to main window |
|
174 | + */ |
|
175 | + public function iSwitchBackToMainWindow() |
|
176 | + { |
|
177 | + $this->getSession()->switchToWindow('main_window'); |
|
178 | + } |
|
179 | 179 | |
180 | - public function iVisit($url) |
|
181 | - { |
|
182 | - $this->minkContext->getSession()->visit($url); |
|
183 | - } |
|
180 | + public function iVisit($url) |
|
181 | + { |
|
182 | + $this->minkContext->getSession()->visit($url); |
|
183 | + } |
|
184 | 184 | |
185 | - /** |
|
186 | - * @When I scroll :selector into view |
|
187 | - * |
|
188 | - * @param string $selector Allowed selectors: #id, .className, //xpath |
|
189 | - * |
|
190 | - * @throws \Exception |
|
191 | - */ |
|
192 | - public function scrollIntoView($selector) |
|
193 | - { |
|
194 | - $locator = substr($selector, 0, 1); |
|
185 | + /** |
|
186 | + * @When I scroll :selector into view |
|
187 | + * |
|
188 | + * @param string $selector Allowed selectors: #id, .className, //xpath |
|
189 | + * |
|
190 | + * @throws \Exception |
|
191 | + */ |
|
192 | + public function scrollIntoView($selector) |
|
193 | + { |
|
194 | + $locator = substr($selector, 0, 1); |
|
195 | 195 | |
196 | - switch ($locator) { |
|
197 | - case '/' : // XPath selector |
|
198 | - $function = <<<JS |
|
196 | + switch ($locator) { |
|
197 | + case '/' : // XPath selector |
|
198 | + $function = <<<JS |
|
199 | 199 | (function(){ |
200 | 200 | var elem = document.evaluate($selector, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; |
201 | 201 | elem.scrollIntoView(false); |
202 | 202 | })() |
203 | 203 | JS; |
204 | - break; |
|
204 | + break; |
|
205 | 205 | |
206 | - case '#' : // ID selector |
|
207 | - $selector = substr($selector, 1); |
|
208 | - $function = <<<JS |
|
206 | + case '#' : // ID selector |
|
207 | + $selector = substr($selector, 1); |
|
208 | + $function = <<<JS |
|
209 | 209 | (function(){ |
210 | 210 | var elem = document.getElementById("$selector"); |
211 | 211 | elem.scrollIntoView(false); |
212 | 212 | })() |
213 | 213 | JS; |
214 | - break; |
|
214 | + break; |
|
215 | 215 | |
216 | - case '.' : // Class selector |
|
217 | - $selector = substr($selector, 1); |
|
218 | - $function = <<<JS |
|
216 | + case '.' : // Class selector |
|
217 | + $selector = substr($selector, 1); |
|
218 | + $function = <<<JS |
|
219 | 219 | (function(){ |
220 | 220 | var elem = document.getElementsByClassName("$selector"); |
221 | 221 | elem[0].scrollIntoView(false); |
222 | 222 | })() |
223 | 223 | JS; |
224 | - break; |
|
224 | + break; |
|
225 | 225 | |
226 | - default: |
|
227 | - throw new \Exception(__METHOD__ . ' Couldn\'t find selector: ' . $selector . ' - Allowed selectors: #id, .className, //xpath'); |
|
228 | - break; |
|
229 | - } |
|
226 | + default: |
|
227 | + throw new \Exception(__METHOD__ . ' Couldn\'t find selector: ' . $selector . ' - Allowed selectors: #id, .className, //xpath'); |
|
228 | + break; |
|
229 | + } |
|
230 | 230 | |
231 | - try { |
|
232 | - $this->getSession()->executeScript($function); |
|
233 | - } catch (\Exception $e) { |
|
234 | - throw new \Exception(__METHOD__ . ' failed'. ' Message: for this locator:"'.$selector.'"'); |
|
235 | - } |
|
236 | - } |
|
231 | + try { |
|
232 | + $this->getSession()->executeScript($function); |
|
233 | + } catch (\Exception $e) { |
|
234 | + throw new \Exception(__METHOD__ . ' failed'. ' Message: for this locator:"'.$selector.'"'); |
|
235 | + } |
|
236 | + } |
|
237 | 237 | |
238 | 238 | |
239 | - /** |
|
240 | - * @When I click location selector |
|
241 | - */ |
|
242 | - public function iClickLocationSelector() |
|
243 | - { |
|
244 | - $locator = '#jobBase-geoLocation-span .select2'; |
|
245 | - $element = $this->getElement($locator); |
|
246 | - $element->click(); |
|
247 | - } |
|
239 | + /** |
|
240 | + * @When I click location selector |
|
241 | + */ |
|
242 | + public function iClickLocationSelector() |
|
243 | + { |
|
244 | + $locator = '#jobBase-geoLocation-span .select2'; |
|
245 | + $element = $this->getElement($locator); |
|
246 | + $element->click(); |
|
247 | + } |
|
248 | 248 | |
249 | - /** |
|
250 | - * @param $locator |
|
251 | - * @param string $selector |
|
252 | - * |
|
253 | - * @return \Behat\Mink\Element\NodeElement|mixed|null |
|
254 | - */ |
|
255 | - public function getElement($locator,$selector='css') |
|
256 | - { |
|
257 | - $page = $this->minkContext->getSession()->getPage(); |
|
258 | - $element = $page->find('css',$locator); |
|
259 | - return $element; |
|
260 | - } |
|
249 | + /** |
|
250 | + * @param $locator |
|
251 | + * @param string $selector |
|
252 | + * |
|
253 | + * @return \Behat\Mink\Element\NodeElement|mixed|null |
|
254 | + */ |
|
255 | + public function getElement($locator,$selector='css') |
|
256 | + { |
|
257 | + $page = $this->minkContext->getSession()->getPage(); |
|
258 | + $element = $page->find('css',$locator); |
|
259 | + return $element; |
|
260 | + } |
|
261 | 261 | |
262 | - /** |
|
263 | - * @When I fill in location search with :term |
|
264 | - * @param $term |
|
265 | - */ |
|
266 | - public function iFillInLocationSearch($term) |
|
267 | - { |
|
268 | - $locator = '.select2-container--open .select2-search__field'; |
|
269 | - $element = $this->getElement($locator); |
|
270 | - $element->focus(); |
|
271 | - $element->setValue($term); |
|
272 | - $this->iWaitForTheAjaxResponse(); |
|
273 | - } |
|
262 | + /** |
|
263 | + * @When I fill in location search with :term |
|
264 | + * @param $term |
|
265 | + */ |
|
266 | + public function iFillInLocationSearch($term) |
|
267 | + { |
|
268 | + $locator = '.select2-container--open .select2-search__field'; |
|
269 | + $element = $this->getElement($locator); |
|
270 | + $element->focus(); |
|
271 | + $element->setValue($term); |
|
272 | + $this->iWaitForTheAjaxResponse(); |
|
273 | + } |
|
274 | 274 | |
275 | - public function iClickOn() |
|
276 | - { |
|
275 | + public function iClickOn() |
|
276 | + { |
|
277 | 277 | |
278 | - } |
|
278 | + } |
|
279 | 279 | |
280 | - /** |
|
281 | - * Click some text |
|
282 | - * |
|
283 | - * @When /^I click on the text "([^"]*)"$/ |
|
284 | - */ |
|
285 | - public function iClickOnTheText($text) |
|
286 | - { |
|
287 | - $session = $this->getSession(); |
|
288 | - $element = $session->getPage()->find( |
|
289 | - 'xpath', |
|
290 | - $session->getSelectorsHandler()->selectorToXpath('xpath', '*//*[text()="'. $text .'"]') |
|
291 | - ); |
|
292 | - if(null === $element){ |
|
293 | - $element = $session->getPage()->find( |
|
294 | - 'named', |
|
295 | - array('id',$text) |
|
296 | - ); |
|
297 | - } |
|
298 | - if (null === $element) { |
|
299 | - throw new \InvalidArgumentException(sprintf('Cannot find text: "%s"', $text)); |
|
300 | - } |
|
280 | + /** |
|
281 | + * Click some text |
|
282 | + * |
|
283 | + * @When /^I click on the text "([^"]*)"$/ |
|
284 | + */ |
|
285 | + public function iClickOnTheText($text) |
|
286 | + { |
|
287 | + $session = $this->getSession(); |
|
288 | + $element = $session->getPage()->find( |
|
289 | + 'xpath', |
|
290 | + $session->getSelectorsHandler()->selectorToXpath('xpath', '*//*[text()="'. $text .'"]') |
|
291 | + ); |
|
292 | + if(null === $element){ |
|
293 | + $element = $session->getPage()->find( |
|
294 | + 'named', |
|
295 | + array('id',$text) |
|
296 | + ); |
|
297 | + } |
|
298 | + if (null === $element) { |
|
299 | + throw new \InvalidArgumentException(sprintf('Cannot find text: "%s"', $text)); |
|
300 | + } |
|
301 | 301 | |
302 | - $element->click(); |
|
302 | + $element->click(); |
|
303 | 303 | |
304 | - } |
|
304 | + } |
|
305 | 305 | |
306 | 306 | /** |
307 | 307 | * @Then /^(?:|I )should see translated text "(?P<text>(?:[^"]|\\")*)"$/ |
308 | 308 | */ |
309 | - public function iShouldSeeText($text) |
|
309 | + public function iShouldSeeText($text) |
|
310 | 310 | { |
311 | 311 | $translator = $this->getServiceManager()->get('translator'); |
312 | 312 | $translated = $translator->translate($text); |
@@ -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->generateUrl('lang/apply',[ |
|
45 | - 'applyId' => $job->getApplyId() |
|
44 | + $url = $this->generateUrl('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->generateUrl('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->generateUrl('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 | } |
@@ -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 | - 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 | + 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 generateUrl($name,array $params=array(),array $options=array()) |
|
55 | - { |
|
56 | - $defaults = ['lang'=>'en']; |
|
57 | - $params = array_merge($defaults,$params); |
|
54 | + public function generateUrl($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 | } |
@@ -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->generateUrl('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->generateUrl('lang/settings',[ |
|
35 | - 'module' => 'Applications' |
|
29 | + /** |
|
30 | + * @Given I go to email template settings page |
|
31 | + */ |
|
32 | + public function iGoToEmailTemplatePage() |
|
33 | + { |
|
34 | + $url = $this->generateUrl('lang/settings',[ |
|
35 | + 'module' => 'Applications' |
|
36 | 36 | ]); |
37 | - $this->visit($url); |
|
38 | - } |
|
37 | + $this->visit($url); |
|
38 | + } |
|
39 | 39 | } |
@@ -31,17 +31,17 @@ |
||
31 | 31 | * @param array|null $options |
32 | 32 | * @return Notification |
33 | 33 | */ |
34 | - public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
35 | - { |
|
36 | - $pluginManager = $container->get('ControllerPluginManager'); |
|
37 | - $flashMessenger = $pluginManager->get('FlashMessenger'); |
|
38 | - $translator = $container->get('translator'); |
|
34 | + public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
35 | + { |
|
36 | + $pluginManager = $container->get('ControllerPluginManager'); |
|
37 | + $flashMessenger = $pluginManager->get('FlashMessenger'); |
|
38 | + $translator = $container->get('translator'); |
|
39 | 39 | |
40 | - $notificationListener = $container->get('Core/Listener/Notification'); |
|
41 | - $notification = new Notification($flashMessenger); |
|
42 | - $notification->setListener($notificationListener); |
|
43 | - $notification->setTranslator($translator); |
|
40 | + $notificationListener = $container->get('Core/Listener/Notification'); |
|
41 | + $notification = new Notification($flashMessenger); |
|
42 | + $notification->setListener($notificationListener); |
|
43 | + $notification->setTranslator($translator); |
|
44 | 44 | |
45 | - return $notification; |
|
46 | - } |
|
45 | + return $notification; |
|
46 | + } |
|
47 | 47 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function trigger($event, $target = null) |
75 | 75 | { |
76 | 76 | if (empty($this->_template) || !is_string($this->_template)) { |
77 | - throw new \InvalidArgumentException('ContentCollector must have a template-name'); |
|
77 | + throw new \InvalidArgumentException('ContentCollector must have a template-name'); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $responseCollection = $this->getController()->getEventManager()->trigger($event, $target); |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | $viewModel->setTemplate($this->_template); |
83 | 83 | foreach ($responseCollection as $i => $response) { |
84 | 84 | if (is_string($response)) { |
85 | - $template = $response; |
|
86 | - $response = new ViewModel(array('target' => $target)); |
|
87 | - $response->setTemplate($template); |
|
85 | + $template = $response; |
|
86 | + $response = new ViewModel(array('target' => $target)); |
|
87 | + $response->setTemplate($template); |
|
88 | 88 | } |
89 | 89 | $viewModel->addChild($response, $this->_captureTo . $i); |
90 | 90 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | } elseif (isset($this->config['templateHalf'])) { |
226 | 226 | $template = $this->config['templateHalf']; |
227 | 227 | } else { |
228 | - throw new \InvalidArgumentException('No template provided for Mail.'); |
|
228 | + throw new \InvalidArgumentException('No template provided for Mail.'); |
|
229 | 229 | } |
230 | 230 | return $template; |
231 | 231 | } |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | return $erg; |
277 | 277 | } |
278 | 278 | |
279 | - /** |
|
280 | - * @param ContainerInterface $container |
|
281 | - * |
|
282 | - * @return static |
|
283 | - */ |
|
279 | + /** |
|
280 | + * @param ContainerInterface $container |
|
281 | + * |
|
282 | + * @return static |
|
283 | + */ |
|
284 | 284 | public static function factory(ContainerInterface $container) |
285 | 285 | { |
286 | 286 | //@TODO: need to define transport to be use during ::send() |