@@ -36,24 +36,24 @@ |
||
| 36 | 36 | private $filterManager; |
| 37 | 37 | |
| 38 | 38 | public function __construct( |
| 39 | - $formManager, |
|
| 40 | - $repositories, |
|
| 41 | - $filterManager |
|
| 39 | + $formManager, |
|
| 40 | + $repositories, |
|
| 41 | + $filterManager |
|
| 42 | 42 | ) |
| 43 | 43 | { |
| 44 | - $this->formManager = $formManager; |
|
| 45 | - $this->repositories = $repositories; |
|
| 46 | - $this->filterManager = $filterManager; |
|
| 44 | + $this->formManager = $formManager; |
|
| 45 | + $this->repositories = $repositories; |
|
| 46 | + $this->filterManager = $filterManager; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - static public function factory(ContainerInterface $container) |
|
| 50 | - { |
|
| 51 | - return new self( |
|
| 52 | - $container->get('FormElementManager'), |
|
| 53 | - $container->get('repositories'), |
|
| 54 | - $container->get('FilterManager') |
|
| 55 | - ); |
|
| 56 | - } |
|
| 49 | + static public function factory(ContainerInterface $container) |
|
| 50 | + { |
|
| 51 | + return new self( |
|
| 52 | + $container->get('FormElementManager'), |
|
| 53 | + $container->get('repositories'), |
|
| 54 | + $container->get('FilterManager') |
|
| 55 | + ); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * Register the default events for this controller |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | $events->attach( |
| 77 | 77 | MvcEvent::EVENT_DISPATCH, |
| 78 | - function ($event) { |
|
| 78 | + function($event) { |
|
| 79 | 79 | $routeMatch = $event->getRouteMatch(); |
| 80 | 80 | $action = $routeMatch->getParam('action'); |
| 81 | 81 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | $events->attach( |
| 97 | 97 | MvcEvent::EVENT_DISPATCH, |
| 98 | - function ($event) { |
|
| 98 | + function($event) { |
|
| 99 | 99 | $model = $event->getResult(); |
| 100 | 100 | if (!$model instanceof ViewModel || $model->terminate()) { |
| 101 | 101 | return; |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $users = $repository->findByQuery($query); |
| 224 | 224 | |
| 225 | 225 | $userFilter = $this->filterManager->get('Auth/Entity/UserToSearchResult'); |
| 226 | - $filterFunc = function ($user) use ($userFilter) { |
|
| 226 | + $filterFunc = function($user) use ($userFilter) { |
|
| 227 | 227 | return $userFilter->filter($user); |
| 228 | 228 | }; |
| 229 | 229 | $result = array_values(array_map($filterFunc, $users->toArray())); |
@@ -16,12 +16,12 @@ |
||
| 16 | 16 | |
| 17 | 17 | class SocialProfilesFactory implements FactoryInterface |
| 18 | 18 | { |
| 19 | - public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
| 20 | - { |
|
| 21 | - $request = $container->get('request'); |
|
| 22 | - $hybridAuth = $container->get('HybridAuth'); |
|
| 23 | - $plugin = new SocialProfiles($hybridAuth,$request); |
|
| 19 | + public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
| 20 | + { |
|
| 21 | + $request = $container->get('request'); |
|
| 22 | + $hybridAuth = $container->get('HybridAuth'); |
|
| 23 | + $plugin = new SocialProfiles($hybridAuth,$request); |
|
| 24 | 24 | |
| 25 | - return $plugin; |
|
| 26 | - } |
|
| 25 | + return $plugin; |
|
| 26 | + } |
|
| 27 | 27 | } |
@@ -16,11 +16,11 @@ |
||
| 16 | 16 | |
| 17 | 17 | class SocialProfilesFactory implements FactoryInterface |
| 18 | 18 | { |
| 19 | - public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
| 19 | + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
| 20 | 20 | { |
| 21 | 21 | $request = $container->get('request'); |
| 22 | 22 | $hybridAuth = $container->get('HybridAuth'); |
| 23 | - $plugin = new SocialProfiles($hybridAuth,$request); |
|
| 23 | + $plugin = new SocialProfiles($hybridAuth, $request); |
|
| 24 | 24 | |
| 25 | 25 | return $plugin; |
| 26 | 26 | } |
@@ -37,14 +37,14 @@ |
||
| 37 | 37 | $this->options['allowName'] = isset($options['allowName']) ? $options['allowName'] : null; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
| 41 | - { |
|
| 42 | - $auth = $container->get('AuthenticationService'); |
|
| 43 | - $user = $auth->getUser(); |
|
| 44 | - $options = $this->options; |
|
| 45 | - $options['user'] = $user; |
|
| 46 | - $validator = new UniqueGroupName($options); |
|
| 40 | + public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
| 41 | + { |
|
| 42 | + $auth = $container->get('AuthenticationService'); |
|
| 43 | + $user = $auth->getUser(); |
|
| 44 | + $options = $this->options; |
|
| 45 | + $options['user'] = $user; |
|
| 46 | + $validator = new UniqueGroupName($options); |
|
| 47 | 47 | |
| 48 | - return $validator; |
|
| 49 | - } |
|
| 48 | + return $validator; |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | $this->options['allowName'] = isset($options['allowName']) ? $options['allowName'] : null; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
| 40 | + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
| 41 | 41 | { |
| 42 | 42 | $auth = $container->get('AuthenticationService'); |
| 43 | 43 | $user = $auth->getUser(); |
@@ -55,8 +55,8 @@ |
||
| 55 | 55 | { |
| 56 | 56 | /* @var $options \Applications\Options\ModuleOptions */ |
| 57 | 57 | $form->get($this->fileName)->setViewHelper('formImageUpload') |
| 58 | - ->setMaxSize($options->getContactImageMaxSize()) |
|
| 59 | - ->setAllowedTypes($options->getContactImageMimeType()) |
|
| 60 | - ->setForm($form); |
|
| 58 | + ->setMaxSize($options->getContactImageMaxSize()) |
|
| 59 | + ->setAllowedTypes($options->getContactImageMimeType()) |
|
| 60 | + ->setForm($form); |
|
| 61 | 61 | } |
| 62 | 62 | } |
@@ -56,6 +56,6 @@ |
||
| 56 | 56 | $form = new static(); |
| 57 | 57 | $form->forms = $forms->get('FormElementManager'); |
| 58 | 58 | |
| 59 | - return $form; |
|
| 59 | + return $form; |
|
| 60 | 60 | } |
| 61 | 61 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function setBirthDay($birthDay) |
| 140 | 140 | { |
| 141 | - $this->birthDay=$birthDay; |
|
| 141 | + $this->birthDay = $birthDay; |
|
| 142 | 142 | return $this; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function setBirthMonth($birthMonth) |
| 161 | 161 | { |
| 162 | - $this->birthMonth=$birthMonth; |
|
| 162 | + $this->birthMonth = $birthMonth; |
|
| 163 | 163 | return $this; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function setBirthYear($birthYear) |
| 182 | 182 | { |
| 183 | - $this->birthYear=$birthYear; |
|
| 183 | + $this->birthYear = $birthYear; |
|
| 184 | 184 | return $this; |
| 185 | 185 | } |
| 186 | 186 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | public function setEmail($email) |
| 203 | 203 | { |
| 204 | - $this->email = trim((String)$email); |
|
| 204 | + $this->email = trim((String) $email); |
|
| 205 | 205 | return $this; |
| 206 | 206 | } |
| 207 | 207 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | public function setFirstName($firstName) |
| 246 | 246 | { |
| 247 | - $this->firstName = trim((String)$firstName); |
|
| 247 | + $this->firstName = trim((String) $firstName); |
|
| 248 | 248 | return $this; |
| 249 | 249 | } |
| 250 | 250 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | public function setGender($gender) |
| 268 | 268 | { |
| 269 | - $this->gender = trim((String)$gender); |
|
| 269 | + $this->gender = trim((String) $gender); |
|
| 270 | 270 | return $this; |
| 271 | 271 | } |
| 272 | 272 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | */ |
| 288 | 288 | public function setHouseNumber($houseNumber) |
| 289 | 289 | { |
| 290 | - $this->houseNumber=$houseNumber; |
|
| 290 | + $this->houseNumber = $houseNumber; |
|
| 291 | 291 | return $this; |
| 292 | 292 | } |
| 293 | 293 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | if (!$this->lastName) { |
| 333 | 333 | return $emailIfEmpty ? $this->email : ''; |
| 334 | 334 | } |
| 335 | - return ($this->firstName ? $this->firstName . ' ' : '') . $this->lastName; |
|
| 335 | + return ($this->firstName ? $this->firstName.' ' : '').$this->lastName; |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | /** |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | */ |
| 427 | 427 | public function setStreet($street) |
| 428 | 428 | { |
| 429 | - $this->street=$street; |
|
| 429 | + $this->street = $street; |
|
| 430 | 430 | return $this; |
| 431 | 431 | } |
| 432 | 432 | |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | */ |
| 448 | 448 | public function setCountry($country) |
| 449 | 449 | { |
| 450 | - $this->country=$country; |
|
| 450 | + $this->country = $country; |
|
| 451 | 451 | return $this; |
| 452 | 452 | } |
| 453 | 453 | |
@@ -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); |
@@ -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 |
@@ -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 = '#nameForm-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 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | public function iSaveWorkflow() |
| 95 | 95 | { |
| 96 | 96 | $locator = '#workflowSettings-buttons-submit'; |
| 97 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 97 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
| 98 | 98 | $element->click(); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | $locator = '#locationForm-buttons-submit'; |
| 104 | 104 | $this->coreContext->scrollIntoView($locator); |
| 105 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 105 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
| 106 | 106 | $element->click(); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | { |
| 112 | 112 | $locator = '#general-classifications-buttons-submit'; |
| 113 | 113 | $this->coreContext->scrollIntoView($locator); |
| 114 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 114 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
| 115 | 115 | $element->click(); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | $locator = '#general-customerNote-buttons-submit'; |
| 121 | 121 | $this->coreContext->scrollIntoView('#sf-general-customerNote'); |
| 122 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 122 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
| 123 | 123 | $element->click(); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | public function __construct() |
| 33 | 33 | { |
| 34 | - static::$configFile = getcwd() . '/config/autoload/install.module.php'; |
|
| 35 | - static::$yawikGlobalConfig = getcwd() . '/config/autoload/yawik.config.global.php'; |
|
| 34 | + static::$configFile = getcwd().'/config/autoload/install.module.php'; |
|
| 35 | + static::$yawikGlobalConfig = getcwd().'/config/autoload/yawik.config.global.php'; |
|
| 36 | 36 | static::$yawikBackupConfig = str_replace('yawik.config.global.php', 'yawik.backup', static::$yawikGlobalConfig); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -42,18 +42,18 @@ discard block |
||
| 42 | 42 | public function iHaveInstallModuleActivated() |
| 43 | 43 | { |
| 44 | 44 | $target = static::$configFile; |
| 45 | - if(!file_exists($target)){ |
|
| 45 | + if (!file_exists($target)) { |
|
| 46 | 46 | $source = __DIR__.'/../resources/install.module.php'; |
| 47 | - copy($source,$target); |
|
| 48 | - chmod($target,0777); |
|
| 47 | + copy($source, $target); |
|
| 48 | + chmod($target, 0777); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // backup existing file |
| 52 | 52 | $yawikBackupConfig = static::$yawikBackupConfig; |
| 53 | 53 | $yawikGlobalConfig = static::$yawikGlobalConfig; |
| 54 | 54 | |
| 55 | - if(is_file($yawikGlobalConfig)){ |
|
| 56 | - rename($yawikGlobalConfig,$yawikBackupConfig); |
|
| 55 | + if (is_file($yawikGlobalConfig)) { |
|
| 56 | + rename($yawikGlobalConfig, $yawikBackupConfig); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | static public function restoreConfig() |
| 94 | 94 | { |
| 95 | - if(is_file($file = static::$configFile)){ |
|
| 95 | + if (is_file($file = static::$configFile)) { |
|
| 96 | 96 | unlink($file); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | $yawikBackupConfig = static::$yawikBackupConfig; |
| 101 | 101 | $yawikGlobalConfig = static::$yawikGlobalConfig; |
| 102 | 102 | |
| 103 | - if(is_file($yawikBackupConfig)){ |
|
| 104 | - rename($yawikBackupConfig,$yawikGlobalConfig); |
|
| 103 | + if (is_file($yawikBackupConfig)) { |
|
| 104 | + rename($yawikBackupConfig, $yawikGlobalConfig); |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
@@ -112,6 +112,6 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | $config = $this->getService('config'); |
| 114 | 114 | $connection = $config['doctrine']['connection']['odm_default']['connectionString']; |
| 115 | - $this->minkContext->fillField('db_conn',$connection); |
|
| 115 | + $this->minkContext->fillField('db_conn', $connection); |
|
| 116 | 116 | } |
| 117 | 117 | } |
@@ -150,6 +150,9 @@ |
||
| 150 | 150 | ); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | + /** |
|
| 154 | + * @param string $contents |
|
| 155 | + */ |
|
| 153 | 156 | private function parseEmail($contents) |
| 154 | 157 | { |
| 155 | 158 | $addresses = $this->parseEmailAddress($contents); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $core = $scope->getEnvironment()->getContext(CoreContext::class); |
| 50 | 50 | /* @var FileTransport $transport */ |
| 51 | 51 | $transport = $core->getServiceManager()->get('Core/MailService')->getTransport(); |
| 52 | - $path = $transport->getOptions()->getPath() . '/*.eml'; |
|
| 52 | + $path = $transport->getOptions()->getPath().'/*.eml'; |
|
| 53 | 53 | foreach (glob($path) as $filename) { |
| 54 | 54 | unlink($filename); |
| 55 | 55 | } |
@@ -105,25 +105,25 @@ discard block |
||
| 105 | 105 | $regex = '/.*('.preg_quote($text).').*/im'; |
| 106 | 106 | $matches = []; |
| 107 | 107 | $multiMessages = false; |
| 108 | - if(count($this->messages) > 1){ |
|
| 108 | + if (count($this->messages) > 1) { |
|
| 109 | 109 | $multiMessages = true; |
| 110 | 110 | } |
| 111 | 111 | $content = ""; |
| 112 | - foreach($this->messages as $key=>$definition){ |
|
| 112 | + foreach ($this->messages as $key=>$definition) { |
|
| 113 | 113 | $content = $definition['contents']; |
| 114 | - if(preg_match($regex,$content,$match)){ |
|
| 114 | + if (preg_match($regex, $content, $match)) { |
|
| 115 | 115 | $matches[] = $match; |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | - $failMessage = sprintf('Can not find text "%s" in any email sent',$text); |
|
| 119 | - if(!$multiMessages){ |
|
| 118 | + $failMessage = sprintf('Can not find text "%s" in any email sent', $text); |
|
| 119 | + if (!$multiMessages) { |
|
| 120 | 120 | $failMessage = sprintf( |
| 121 | 121 | 'Can not find text "%s" in sent email. Here\'s the email content: %s', |
| 122 | 122 | $text, |
| 123 | 123 | PHP_EOL.PHP_EOL.$content |
| 124 | 124 | ); |
| 125 | 125 | } |
| 126 | - Assert::true(count($matches)>0,$failMessage); |
|
| 126 | + Assert::true(count($matches) > 0, $failMessage); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -136,16 +136,16 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | $path = $transport->getOptions()->getPath().'/*.eml'; |
| 138 | 138 | |
| 139 | - foreach(glob($path) as $filename){ |
|
| 139 | + foreach (glob($path) as $filename) { |
|
| 140 | 140 | $id = md5($filename); |
| 141 | - if(!isset($this->messages[$id])){ |
|
| 141 | + if (!isset($this->messages[$id])) { |
|
| 142 | 142 | $contents = file_get_contents($filename); |
| 143 | - $this->messages[$id] = $this->parseEmail($contents); |
|
| 143 | + $this->messages[$id] = $this->parseEmail($contents); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | Assert::true( |
| 148 | - count($this->messages)>0, |
|
| 148 | + count($this->messages) > 0, |
|
| 149 | 149 | 'No email have been sent' |
| 150 | 150 | ); |
| 151 | 151 | } |
@@ -153,33 +153,33 @@ discard block |
||
| 153 | 153 | private function parseEmail($contents) |
| 154 | 154 | { |
| 155 | 155 | $addresses = $this->parseEmailAddress($contents); |
| 156 | - $subject =$this->parseSubject($contents); |
|
| 156 | + $subject = $this->parseSubject($contents); |
|
| 157 | 157 | |
| 158 | 158 | $contents = strip_tags($contents); |
| 159 | 159 | $contents = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $contents); |
| 160 | 160 | |
| 161 | - return array_merge($addresses,$subject,['contents' => $contents]); |
|
| 161 | + return array_merge($addresses, $subject, ['contents' => $contents]); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | private function parseEmailAddress($contents) |
| 165 | 165 | { |
| 166 | 166 | // pattern to get email address |
| 167 | - $radd = '(\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b)'; |
|
| 167 | + $radd = '(\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b)'; |
|
| 168 | 168 | |
| 169 | 169 | // get email from address |
| 170 | - $regex = sprintf('/^From\:.*%s/im',$radd); |
|
| 171 | - $hasMatch = preg_match($regex,$contents,$matches); |
|
| 172 | - $fromAddress = $hasMatch ? $matches[1]:null; |
|
| 170 | + $regex = sprintf('/^From\:.*%s/im', $radd); |
|
| 171 | + $hasMatch = preg_match($regex, $contents, $matches); |
|
| 172 | + $fromAddress = $hasMatch ? $matches[1] : null; |
|
| 173 | 173 | |
| 174 | 174 | // get email to address |
| 175 | - $regex = sprintf('/^To\:\s+%s/im',$radd); |
|
| 176 | - $hasMatch = preg_match($regex,$contents,$matches); |
|
| 177 | - $toAddress1 = $hasMatch ? $matches[1]:null; |
|
| 175 | + $regex = sprintf('/^To\:\s+%s/im', $radd); |
|
| 176 | + $hasMatch = preg_match($regex, $contents, $matches); |
|
| 177 | + $toAddress1 = $hasMatch ? $matches[1] : null; |
|
| 178 | 178 | |
| 179 | 179 | // get email to address |
| 180 | - $regex = sprintf('/^To\:.*%s/im',$radd); |
|
| 181 | - $hasMatch = preg_match($regex,$contents,$matches); |
|
| 182 | - $toAddress2 = $hasMatch ? $matches[1]:null; |
|
| 180 | + $regex = sprintf('/^To\:.*%s/im', $radd); |
|
| 181 | + $hasMatch = preg_match($regex, $contents, $matches); |
|
| 182 | + $toAddress2 = $hasMatch ? $matches[1] : null; |
|
| 183 | 183 | |
| 184 | 184 | $this->fromMails[] = $fromAddress; |
| 185 | 185 | $this->toMails[] = $toAddress1; |
@@ -187,15 +187,15 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | return [ |
| 189 | 189 | 'from' => $fromAddress, |
| 190 | - 'to' => [$toAddress1,$toAddress2], |
|
| 190 | + 'to' => [$toAddress1, $toAddress2], |
|
| 191 | 191 | ]; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | private function parseSubject($contents) |
| 195 | 195 | { |
| 196 | 196 | $pattern = '/Subject\:(.*)/i'; |
| 197 | - preg_match($pattern,$contents,$matches); |
|
| 198 | - $subject = isset($matches[1]) ? $matches[1]:null; |
|
| 197 | + preg_match($pattern, $contents, $matches); |
|
| 198 | + $subject = isset($matches[1]) ? $matches[1] : null; |
|
| 199 | 199 | $this->subjects[] = $subject; |
| 200 | 200 | return [ |
| 201 | 201 | 'subject' => trim($subject) |