@@ -22,244 +22,244 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class CoreContext extends RawMinkContext |
| 24 | 24 | { |
| 25 | - static protected $application; |
|
| 25 | + static protected $application; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var MinkContext |
|
| 29 | - */ |
|
| 30 | - protected $minkContext; |
|
| 27 | + /** |
|
| 28 | + * @var MinkContext |
|
| 29 | + */ |
|
| 30 | + protected $minkContext; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @BeforeScenario |
|
| 34 | - * @param BeforeScenarioScope $scope |
|
| 35 | - */ |
|
| 36 | - public function gatherContexts(BeforeScenarioScope $scope) |
|
| 37 | - { |
|
| 38 | - $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
| 39 | - } |
|
| 32 | + /** |
|
| 33 | + * @BeforeScenario |
|
| 34 | + * @param BeforeScenarioScope $scope |
|
| 35 | + */ |
|
| 36 | + public function gatherContexts(BeforeScenarioScope $scope) |
|
| 37 | + { |
|
| 38 | + $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @return Application |
|
| 43 | - */ |
|
| 44 | - public function getApplication() |
|
| 45 | - { |
|
| 46 | - if(!is_object(static::$application)){ |
|
| 47 | - $configFile = realpath(__DIR__.'/../../../config/config.php'); |
|
| 48 | - $config = include($configFile); |
|
| 49 | - static::$application = Application::init($config); |
|
| 50 | - } |
|
| 51 | - return static::$application; |
|
| 52 | - } |
|
| 41 | + /** |
|
| 42 | + * @return Application |
|
| 43 | + */ |
|
| 44 | + public function getApplication() |
|
| 45 | + { |
|
| 46 | + if(!is_object(static::$application)){ |
|
| 47 | + $configFile = realpath(__DIR__.'/../../../config/config.php'); |
|
| 48 | + $config = include($configFile); |
|
| 49 | + static::$application = Application::init($config); |
|
| 50 | + } |
|
| 51 | + return static::$application; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * @return \Zend\ServiceManager\ServiceManager |
|
| 56 | - */ |
|
| 57 | - public function getServiceManager() |
|
| 58 | - { |
|
| 59 | - return $this->getApplication()->getServiceManager(); |
|
| 60 | - } |
|
| 54 | + /** |
|
| 55 | + * @return \Zend\ServiceManager\ServiceManager |
|
| 56 | + */ |
|
| 57 | + public function getServiceManager() |
|
| 58 | + { |
|
| 59 | + return $this->getApplication()->getServiceManager(); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * @return \Zend\EventManager\EventManagerInterface |
|
| 64 | - */ |
|
| 65 | - public function getEventManager() |
|
| 66 | - { |
|
| 67 | - return $this->getApplication()->getEventManager(); |
|
| 68 | - } |
|
| 62 | + /** |
|
| 63 | + * @return \Zend\EventManager\EventManagerInterface |
|
| 64 | + */ |
|
| 65 | + public function getEventManager() |
|
| 66 | + { |
|
| 67 | + return $this->getApplication()->getEventManager(); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @return RepositoryService |
|
| 72 | - */ |
|
| 73 | - public function getRepositories() |
|
| 74 | - { |
|
| 75 | - return $this->getServiceManager()->get('repositories'); |
|
| 76 | - } |
|
| 70 | + /** |
|
| 71 | + * @return RepositoryService |
|
| 72 | + */ |
|
| 73 | + public function getRepositories() |
|
| 74 | + { |
|
| 75 | + return $this->getServiceManager()->get('repositories'); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * @param $name |
|
| 80 | - * @param array $params |
|
| 81 | - * |
|
| 82 | - * @return string |
|
| 83 | - */ |
|
| 84 | - public function generateUrl($name) |
|
| 85 | - { |
|
| 86 | - return $this->minkContext->locatePath($name); |
|
| 87 | - } |
|
| 78 | + /** |
|
| 79 | + * @param $name |
|
| 80 | + * @param array $params |
|
| 81 | + * |
|
| 82 | + * @return string |
|
| 83 | + */ |
|
| 84 | + public function generateUrl($name) |
|
| 85 | + { |
|
| 86 | + return $this->minkContext->locatePath($name); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * @When /^I hover over the element "([^"]*)"$/ |
|
| 91 | - */ |
|
| 92 | - public function iHoverOverTheElement($locator) |
|
| 93 | - { |
|
| 94 | - $session = $this->minkContext->getSession(); // get the mink session |
|
| 95 | - $element = $session->getPage()->find('css', $locator); // runs the actual query and returns the element |
|
| 89 | + /** |
|
| 90 | + * @When /^I hover over the element "([^"]*)"$/ |
|
| 91 | + */ |
|
| 92 | + public function iHoverOverTheElement($locator) |
|
| 93 | + { |
|
| 94 | + $session = $this->minkContext->getSession(); // get the mink session |
|
| 95 | + $element = $session->getPage()->find('css', $locator); // runs the actual query and returns the element |
|
| 96 | 96 | |
| 97 | - // errors must not pass silently |
|
| 98 | - if (null === $element) { |
|
| 99 | - throw new \InvalidArgumentException(sprintf('Could not evaluate CSS selector: "%s"', $locator)); |
|
| 100 | - } |
|
| 97 | + // errors must not pass silently |
|
| 98 | + if (null === $element) { |
|
| 99 | + throw new \InvalidArgumentException(sprintf('Could not evaluate CSS selector: "%s"', $locator)); |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - // ok, let's hover it |
|
| 103 | - $element->mouseOver(); |
|
| 104 | - } |
|
| 102 | + // ok, let's hover it |
|
| 103 | + $element->mouseOver(); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - /** |
|
| 107 | - * @Given /^I wait for (\d+) seconds$/ |
|
| 108 | - */ |
|
| 109 | - public function iWaitForSecond($second) |
|
| 110 | - { |
|
| 111 | - sleep($second); |
|
| 112 | - } |
|
| 106 | + /** |
|
| 107 | + * @Given /^I wait for (\d+) seconds$/ |
|
| 108 | + */ |
|
| 109 | + public function iWaitForSecond($second) |
|
| 110 | + { |
|
| 111 | + sleep($second); |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - /** |
|
| 115 | - * @Then /^I wait for the ajax response$/ |
|
| 116 | - */ |
|
| 117 | - public function iWaitForTheAjaxResponse() |
|
| 118 | - { |
|
| 119 | - $this->getSession()->wait(5000, '(0 === jQuery.active)'); |
|
| 120 | - } |
|
| 114 | + /** |
|
| 115 | + * @Then /^I wait for the ajax response$/ |
|
| 116 | + */ |
|
| 117 | + public function iWaitForTheAjaxResponse() |
|
| 118 | + { |
|
| 119 | + $this->getSession()->wait(5000, '(0 === jQuery.active)'); |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - /** |
|
| 123 | - * Some forms do not have a Submit button just pass the ID |
|
| 124 | - * |
|
| 125 | - * @Given /^I submit the form with id "([^"]*)"$/ |
|
| 126 | - */ |
|
| 127 | - public function iSubmitTheFormWithId($arg) |
|
| 128 | - { |
|
| 129 | - $node = $this->minkContext->getSession()->getPage()->find('css', $arg); |
|
| 130 | - if($node) { |
|
| 131 | - $this->minkContext->getSession()->executeScript("jQuery('$arg').submit();"); |
|
| 132 | - } else { |
|
| 133 | - throw new \Exception('Element not found'); |
|
| 134 | - } |
|
| 135 | - } |
|
| 122 | + /** |
|
| 123 | + * Some forms do not have a Submit button just pass the ID |
|
| 124 | + * |
|
| 125 | + * @Given /^I submit the form with id "([^"]*)"$/ |
|
| 126 | + */ |
|
| 127 | + public function iSubmitTheFormWithId($arg) |
|
| 128 | + { |
|
| 129 | + $node = $this->minkContext->getSession()->getPage()->find('css', $arg); |
|
| 130 | + if($node) { |
|
| 131 | + $this->minkContext->getSession()->executeScript("jQuery('$arg').submit();"); |
|
| 132 | + } else { |
|
| 133 | + throw new \Exception('Element not found'); |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | - /** |
|
| 138 | - * @Then I switch to popup :name |
|
| 139 | - * |
|
| 140 | - * @param $name |
|
| 141 | - */ |
|
| 142 | - public function iSwitchToPopup($name) |
|
| 143 | - { |
|
| 144 | - $this->iSetMainWindowName(); |
|
| 145 | - $this->getSession()->switchToWindow($name); |
|
| 146 | - } |
|
| 137 | + /** |
|
| 138 | + * @Then I switch to popup :name |
|
| 139 | + * |
|
| 140 | + * @param $name |
|
| 141 | + */ |
|
| 142 | + public function iSwitchToPopup($name) |
|
| 143 | + { |
|
| 144 | + $this->iSetMainWindowName(); |
|
| 145 | + $this->getSession()->switchToWindow($name); |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - /** |
|
| 149 | - * @Then I set main window name |
|
| 150 | - */ |
|
| 151 | - public function iSetMainWindowName() |
|
| 152 | - { |
|
| 153 | - $window_name = 'main_window'; |
|
| 154 | - $script = 'window.name = "' . $window_name . '"'; |
|
| 155 | - $this->getSession()->executeScript($script); |
|
| 156 | - } |
|
| 148 | + /** |
|
| 149 | + * @Then I set main window name |
|
| 150 | + */ |
|
| 151 | + public function iSetMainWindowName() |
|
| 152 | + { |
|
| 153 | + $window_name = 'main_window'; |
|
| 154 | + $script = 'window.name = "' . $window_name . '"'; |
|
| 155 | + $this->getSession()->executeScript($script); |
|
| 156 | + } |
|
| 157 | 157 | |
| 158 | - /** |
|
| 159 | - * @Then I switch back to main window |
|
| 160 | - */ |
|
| 161 | - public function iSwitchBackToMainWindow() |
|
| 162 | - { |
|
| 163 | - $this->getSession()->switchToWindow('main_window'); |
|
| 164 | - } |
|
| 158 | + /** |
|
| 159 | + * @Then I switch back to main window |
|
| 160 | + */ |
|
| 161 | + public function iSwitchBackToMainWindow() |
|
| 162 | + { |
|
| 163 | + $this->getSession()->switchToWindow('main_window'); |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | - public function iVisit($url) |
|
| 167 | - { |
|
| 168 | - $this->minkContext->getSession()->visit($url); |
|
| 169 | - } |
|
| 166 | + public function iVisit($url) |
|
| 167 | + { |
|
| 168 | + $this->minkContext->getSession()->visit($url); |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - /** |
|
| 172 | - * @When I scroll :selector into view |
|
| 173 | - * |
|
| 174 | - * @param string $selector Allowed selectors: #id, .className, //xpath |
|
| 175 | - * |
|
| 176 | - * @throws \Exception |
|
| 177 | - */ |
|
| 178 | - public function scrollIntoView($selector) |
|
| 179 | - { |
|
| 180 | - $locator = substr($selector, 0, 1); |
|
| 171 | + /** |
|
| 172 | + * @When I scroll :selector into view |
|
| 173 | + * |
|
| 174 | + * @param string $selector Allowed selectors: #id, .className, //xpath |
|
| 175 | + * |
|
| 176 | + * @throws \Exception |
|
| 177 | + */ |
|
| 178 | + public function scrollIntoView($selector) |
|
| 179 | + { |
|
| 180 | + $locator = substr($selector, 0, 1); |
|
| 181 | 181 | |
| 182 | - switch ($locator) { |
|
| 183 | - case '/' : // XPath selector |
|
| 184 | - $function = <<<JS |
|
| 182 | + switch ($locator) { |
|
| 183 | + case '/' : // XPath selector |
|
| 184 | + $function = <<<JS |
|
| 185 | 185 | (function(){ |
| 186 | 186 | var elem = document.evaluate($selector, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; |
| 187 | 187 | elem.scrollIntoView(false); |
| 188 | 188 | })() |
| 189 | 189 | JS; |
| 190 | - break; |
|
| 190 | + break; |
|
| 191 | 191 | |
| 192 | - case '#' : // ID selector |
|
| 193 | - $selector = substr($selector, 1); |
|
| 194 | - $function = <<<JS |
|
| 192 | + case '#' : // ID selector |
|
| 193 | + $selector = substr($selector, 1); |
|
| 194 | + $function = <<<JS |
|
| 195 | 195 | (function(){ |
| 196 | 196 | var elem = document.getElementById("$selector"); |
| 197 | 197 | elem.scrollIntoView(false); |
| 198 | 198 | })() |
| 199 | 199 | JS; |
| 200 | - break; |
|
| 200 | + break; |
|
| 201 | 201 | |
| 202 | - case '.' : // Class selector |
|
| 203 | - $selector = substr($selector, 1); |
|
| 204 | - $function = <<<JS |
|
| 202 | + case '.' : // Class selector |
|
| 203 | + $selector = substr($selector, 1); |
|
| 204 | + $function = <<<JS |
|
| 205 | 205 | (function(){ |
| 206 | 206 | var elem = document.getElementsByClassName("$selector"); |
| 207 | 207 | elem[0].scrollIntoView(false); |
| 208 | 208 | })() |
| 209 | 209 | JS; |
| 210 | - break; |
|
| 210 | + break; |
|
| 211 | 211 | |
| 212 | - default: |
|
| 213 | - throw new \Exception(__METHOD__ . ' Couldn\'t find selector: ' . $selector . ' - Allowed selectors: #id, .className, //xpath'); |
|
| 214 | - break; |
|
| 215 | - } |
|
| 212 | + default: |
|
| 213 | + throw new \Exception(__METHOD__ . ' Couldn\'t find selector: ' . $selector . ' - Allowed selectors: #id, .className, //xpath'); |
|
| 214 | + break; |
|
| 215 | + } |
|
| 216 | 216 | |
| 217 | - try { |
|
| 218 | - $this->getSession()->executeScript($function); |
|
| 219 | - } catch (\Exception $e) { |
|
| 220 | - throw new \Exception(__METHOD__ . ' failed'. ' Message: for this locator:"'.$selector.'"'); |
|
| 221 | - } |
|
| 222 | - } |
|
| 217 | + try { |
|
| 218 | + $this->getSession()->executeScript($function); |
|
| 219 | + } catch (\Exception $e) { |
|
| 220 | + throw new \Exception(__METHOD__ . ' failed'. ' Message: for this locator:"'.$selector.'"'); |
|
| 221 | + } |
|
| 222 | + } |
|
| 223 | 223 | |
| 224 | 224 | |
| 225 | - /** |
|
| 226 | - * @When I click location selector |
|
| 227 | - */ |
|
| 228 | - public function iClickLocationSelector() |
|
| 229 | - { |
|
| 230 | - $locator = '#jobBase-geoLocation-span .select2'; |
|
| 231 | - $element = $this->getElement($locator); |
|
| 232 | - $element->click(); |
|
| 233 | - } |
|
| 225 | + /** |
|
| 226 | + * @When I click location selector |
|
| 227 | + */ |
|
| 228 | + public function iClickLocationSelector() |
|
| 229 | + { |
|
| 230 | + $locator = '#jobBase-geoLocation-span .select2'; |
|
| 231 | + $element = $this->getElement($locator); |
|
| 232 | + $element->click(); |
|
| 233 | + } |
|
| 234 | 234 | |
| 235 | - /** |
|
| 236 | - * @param $locator |
|
| 237 | - * @param string $selector |
|
| 238 | - * |
|
| 239 | - * @return \Behat\Mink\Element\NodeElement|mixed|null |
|
| 240 | - */ |
|
| 241 | - public function getElement($locator,$selector='css') |
|
| 242 | - { |
|
| 243 | - $page = $this->minkContext->getSession()->getPage(); |
|
| 244 | - $element = $page->find('css',$locator); |
|
| 245 | - return $element; |
|
| 246 | - } |
|
| 235 | + /** |
|
| 236 | + * @param $locator |
|
| 237 | + * @param string $selector |
|
| 238 | + * |
|
| 239 | + * @return \Behat\Mink\Element\NodeElement|mixed|null |
|
| 240 | + */ |
|
| 241 | + public function getElement($locator,$selector='css') |
|
| 242 | + { |
|
| 243 | + $page = $this->minkContext->getSession()->getPage(); |
|
| 244 | + $element = $page->find('css',$locator); |
|
| 245 | + return $element; |
|
| 246 | + } |
|
| 247 | 247 | |
| 248 | - /** |
|
| 249 | - * @When I fill in location search with :term |
|
| 250 | - * @param $term |
|
| 251 | - */ |
|
| 252 | - public function iFillInLocationSearch($term) |
|
| 253 | - { |
|
| 254 | - $locator = '.select2-container--open .select2-search__field'; |
|
| 255 | - $element = $this->getElement($locator); |
|
| 256 | - $element->focus(); |
|
| 257 | - $element->setValue($term); |
|
| 258 | - $this->iWaitForTheAjaxResponse(); |
|
| 259 | - } |
|
| 248 | + /** |
|
| 249 | + * @When I fill in location search with :term |
|
| 250 | + * @param $term |
|
| 251 | + */ |
|
| 252 | + public function iFillInLocationSearch($term) |
|
| 253 | + { |
|
| 254 | + $locator = '.select2-container--open .select2-search__field'; |
|
| 255 | + $element = $this->getElement($locator); |
|
| 256 | + $element->focus(); |
|
| 257 | + $element->setValue($term); |
|
| 258 | + $this->iWaitForTheAjaxResponse(); |
|
| 259 | + } |
|
| 260 | 260 | |
| 261 | - public function iClickOn() |
|
| 262 | - { |
|
| 261 | + public function iClickOn() |
|
| 262 | + { |
|
| 263 | 263 | |
| 264 | - } |
|
| 264 | + } |
|
| 265 | 265 | } |
| 266 | 266 | \ No newline at end of file |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function getApplication() |
| 45 | 45 | { |
| 46 | - if(!is_object(static::$application)){ |
|
| 46 | + if (!is_object(static::$application)) { |
|
| 47 | 47 | $configFile = realpath(__DIR__.'/../../../config/config.php'); |
| 48 | 48 | $config = include($configFile); |
| 49 | 49 | static::$application = Application::init($config); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | public function iSubmitTheFormWithId($arg) |
| 128 | 128 | { |
| 129 | 129 | $node = $this->minkContext->getSession()->getPage()->find('css', $arg); |
| 130 | - if($node) { |
|
| 130 | + if ($node) { |
|
| 131 | 131 | $this->minkContext->getSession()->executeScript("jQuery('$arg').submit();"); |
| 132 | 132 | } else { |
| 133 | 133 | throw new \Exception('Element not found'); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | public function iSetMainWindowName() |
| 152 | 152 | { |
| 153 | 153 | $window_name = 'main_window'; |
| 154 | - $script = 'window.name = "' . $window_name . '"'; |
|
| 154 | + $script = 'window.name = "'.$window_name.'"'; |
|
| 155 | 155 | $this->getSession()->executeScript($script); |
| 156 | 156 | } |
| 157 | 157 | |
@@ -210,14 +210,14 @@ discard block |
||
| 210 | 210 | break; |
| 211 | 211 | |
| 212 | 212 | default: |
| 213 | - throw new \Exception(__METHOD__ . ' Couldn\'t find selector: ' . $selector . ' - Allowed selectors: #id, .className, //xpath'); |
|
| 213 | + throw new \Exception(__METHOD__.' Couldn\'t find selector: '.$selector.' - Allowed selectors: #id, .className, //xpath'); |
|
| 214 | 214 | break; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | try { |
| 218 | 218 | $this->getSession()->executeScript($function); |
| 219 | 219 | } catch (\Exception $e) { |
| 220 | - throw new \Exception(__METHOD__ . ' failed'. ' Message: for this locator:"'.$selector.'"'); |
|
| 220 | + throw new \Exception(__METHOD__.' failed'.' Message: for this locator:"'.$selector.'"'); |
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | |
@@ -238,10 +238,10 @@ discard block |
||
| 238 | 238 | * |
| 239 | 239 | * @return \Behat\Mink\Element\NodeElement|mixed|null |
| 240 | 240 | */ |
| 241 | - public function getElement($locator,$selector='css') |
|
| 241 | + public function getElement($locator, $selector = 'css') |
|
| 242 | 242 | { |
| 243 | 243 | $page = $this->minkContext->getSession()->getPage(); |
| 244 | - $element = $page->find('css',$locator); |
|
| 244 | + $element = $page->find('css', $locator); |
|
| 245 | 245 | return $element; |
| 246 | 246 | } |
| 247 | 247 | |
@@ -15,78 +15,78 @@ |
||
| 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 iSaveJobClassification() |
|
| 84 | - { |
|
| 85 | - $locator = '#general-classifications-buttons-submit'; |
|
| 86 | - $this->coreContext->scrollIntoView($locator); |
|
| 87 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 88 | - $element->click(); |
|
| 89 | - } |
|
| 83 | + public function iSaveJobClassification() |
|
| 84 | + { |
|
| 85 | + $locator = '#general-classifications-buttons-submit'; |
|
| 86 | + $this->coreContext->scrollIntoView($locator); |
|
| 87 | + $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 88 | + $element->click(); |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | } |
| 93 | 93 | \ No newline at end of file |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | $name = Inflector::camelize($name); |
| 40 | 40 | $type = $this->elementMap[$name]; |
| 41 | 41 | $locator = $type.' .sf-summary .sf-controls button'; |
| 42 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 43 | - if(!$element){ |
|
| 42 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
| 43 | + if (!$element) { |
|
| 44 | 44 | throw new \Exception('No element found with this locator: "'.$locator.'"'); |
| 45 | 45 | } |
| 46 | 46 | $element->click(); |
@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | { |
| 71 | 71 | $type = Inflector::camelize($type); |
| 72 | 72 | $method = 'iSave'.$type; |
| 73 | - if(method_exists($this,$method)){ |
|
| 74 | - call_user_func([$this,$method]); |
|
| 75 | - }else{ |
|
| 73 | + if (method_exists($this, $method)) { |
|
| 74 | + call_user_func([$this, $method]); |
|
| 75 | + } else { |
|
| 76 | 76 | $locator = $this->elementMap[$type].'-buttons-submit'; |
| 77 | 77 | $this->coreContext->scrollIntoView($locator); |
| 78 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 78 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
| 79 | 79 | $element->click(); |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $locator = '#general-classifications-buttons-submit'; |
| 86 | 86 | $this->coreContext->scrollIntoView($locator); |
| 87 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 87 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
| 88 | 88 | $element->click(); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | $method = 'iSave'.$type; |
| 73 | 73 | if(method_exists($this,$method)){ |
| 74 | 74 | call_user_func([$this,$method]); |
| 75 | - }else{ |
|
| 75 | + } else{ |
|
| 76 | 76 | $locator = $this->elementMap[$type].'-buttons-submit'; |
| 77 | 77 | $this->coreContext->scrollIntoView($locator); |
| 78 | 78 | $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | return $ob; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function setContainer( ContainerInterface $container ) |
|
| 48 | + public function setContainer(ContainerInterface $container) |
|
| 49 | 49 | { |
| 50 | 50 | $this->repositories = $container->get('repositories'); |
| 51 | 51 | $this->formManager = $container->get('forms'); |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $params = $this->params()->fromQuery(); |
| 59 | 59 | return $this->pagination([ |
| 60 | - 'params' => [ 'Jobs_Admin', ['text', 'page' => 1, 'companyId', 'status' ] ], |
|
| 61 | - 'form' => [ 'as' => 'form', 'Jobs/AdminSearch' ], |
|
| 62 | - 'paginator' => [ 'as' => 'jobs', 'Jobs/Admin' ], |
|
| 60 | + 'params' => ['Jobs_Admin', ['text', 'page' => 1, 'companyId', 'status']], |
|
| 61 | + 'form' => ['as' => 'form', 'Jobs/AdminSearch'], |
|
| 62 | + 'paginator' => ['as' => 'jobs', 'Jobs/Admin'], |
|
| 63 | 63 | ]); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $oldStatus = $job->getStatus(); |
| 85 | 85 | $job->changeStatus($post['status'], '[System] Status changed via Admin GUI.'); |
| 86 | 86 | $events = $this->jobEvents; |
| 87 | - $events->trigger(JobEvent::EVENT_STATUS_CHANGED, $this, [ 'job' => $job, 'status' => $oldStatus ]); |
|
| 87 | + $events->trigger(JobEvent::EVENT_STATUS_CHANGED, $this, ['job' => $job, 'status' => $oldStatus]); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $form->bind($job); |
| 98 | 98 | |
| 99 | - return [ 'form' => $form, 'job' => $job ]; |
|
| 99 | + return ['form' => $form, 'job' => $job]; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | } |