@@ -50,8 +50,8 @@ |
||
50 | 50 | $jsonLdProvider = new JsonLdProvider($job); |
51 | 51 | |
52 | 52 | return '<script type="application/ld+json">' |
53 | - . $jsonLdProvider->toJsonLd() |
|
54 | - . '</script>'; |
|
53 | + . $jsonLdProvider->toJsonLd() |
|
54 | + . '</script>'; |
|
55 | 55 | |
56 | 56 | } |
57 | 57 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $dateStart = $this->job->getDatePublishStart(); |
53 | 53 | $dateStart = $dateStart ? $dateStart->format('Y-m-d') : null; |
54 | 54 | |
55 | - $array=[ |
|
55 | + $array = [ |
|
56 | 56 | '@context'=>'http://schema.org/', |
57 | 57 | '@type' => 'JobPosting', |
58 | 58 | 'title' => $this->job->getTitle(), |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return array |
86 | 86 | */ |
87 | - private function getLocations($locations){ |
|
88 | - $array=[]; |
|
89 | - foreach($locations as $location){ /* @var \Core\Entity\LocationInterface $location */ |
|
87 | + private function getLocations($locations) { |
|
88 | + $array = []; |
|
89 | + foreach ($locations as $location) { /* @var \Core\Entity\LocationInterface $location */ |
|
90 | 90 | array_push( |
91 | 91 | $array, |
92 | 92 | [ |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | private function getDescription(TemplateValuesInterface $values) { |
114 | 114 | |
115 | - $description=sprintf( |
|
115 | + $description = sprintf( |
|
116 | 116 | "<p>%s</p>". |
117 | 117 | "<h1>%s</h1>". |
118 | 118 | "<h3>Requirements</h3><p>%s</p>". |
@@ -54,6 +54,7 @@ |
||
54 | 54 | * ManageController constructor. |
55 | 55 | * |
56 | 56 | * @param RepositoryService $repositories |
57 | + * @param ContainerInterface $container |
|
57 | 58 | */ |
58 | 59 | public function __construct( |
59 | 60 | RepositoryService $repositories, |
@@ -30,70 +30,70 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class ManageController extends AbstractActionController |
32 | 32 | { |
33 | - /** |
|
34 | - * @var RepositoryService |
|
35 | - */ |
|
36 | - private $repositories; |
|
33 | + /** |
|
34 | + * @var RepositoryService |
|
35 | + */ |
|
36 | + private $repositories; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @var |
|
40 | - */ |
|
41 | - private $coreNavigation; |
|
38 | + /** |
|
39 | + * @var |
|
40 | + */ |
|
41 | + private $coreNavigation; |
|
42 | 42 | |
43 | - private $forms; |
|
43 | + private $forms; |
|
44 | 44 | |
45 | - private $appOptions; |
|
45 | + private $appOptions; |
|
46 | 46 | |
47 | - private $appEvents; |
|
47 | + private $appEvents; |
|
48 | 48 | |
49 | - private $translator; |
|
49 | + private $translator; |
|
50 | 50 | |
51 | - private $container; |
|
51 | + private $container; |
|
52 | 52 | |
53 | - /** |
|
54 | - * ManageController constructor. |
|
55 | - * |
|
56 | - * @param RepositoryService $repositories |
|
57 | - */ |
|
58 | - public function __construct( |
|
59 | - RepositoryService $repositories, |
|
60 | - $coreNavigation, |
|
61 | - $forms, |
|
62 | - $appOptions, |
|
63 | - $appEvents, |
|
64 | - $translator, |
|
65 | - $container |
|
66 | - ) |
|
67 | - { |
|
68 | - $this->repositories = $repositories; |
|
69 | - $this->coreNavigation = $coreNavigation; |
|
70 | - $this->forms = $forms; |
|
71 | - $this->appOptions = $appOptions; |
|
72 | - $this->appEvents = $appEvents; |
|
73 | - $this->translator = $translator; |
|
74 | - $this->container = $container; |
|
75 | - } |
|
53 | + /** |
|
54 | + * ManageController constructor. |
|
55 | + * |
|
56 | + * @param RepositoryService $repositories |
|
57 | + */ |
|
58 | + public function __construct( |
|
59 | + RepositoryService $repositories, |
|
60 | + $coreNavigation, |
|
61 | + $forms, |
|
62 | + $appOptions, |
|
63 | + $appEvents, |
|
64 | + $translator, |
|
65 | + $container |
|
66 | + ) |
|
67 | + { |
|
68 | + $this->repositories = $repositories; |
|
69 | + $this->coreNavigation = $coreNavigation; |
|
70 | + $this->forms = $forms; |
|
71 | + $this->appOptions = $appOptions; |
|
72 | + $this->appEvents = $appEvents; |
|
73 | + $this->translator = $translator; |
|
74 | + $this->container = $container; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * @param ContainerInterface $container |
|
79 | - * |
|
80 | - * @return ManageController |
|
81 | - */ |
|
82 | - static public function factory(ContainerInterface $container) |
|
83 | - { |
|
84 | - $ob = new self( |
|
85 | - $container->get('Core/RepositoryService'), |
|
86 | - $container->get('Core/Navigation'), |
|
87 | - $container->get('forms'), |
|
88 | - $container->get('Applications/Options'), |
|
89 | - $container->get('Applications/Events'), |
|
90 | - $container->get('translator'), |
|
91 | - $container |
|
92 | - ); |
|
93 | - return $ob; |
|
94 | - } |
|
77 | + /** |
|
78 | + * @param ContainerInterface $container |
|
79 | + * |
|
80 | + * @return ManageController |
|
81 | + */ |
|
82 | + static public function factory(ContainerInterface $container) |
|
83 | + { |
|
84 | + $ob = new self( |
|
85 | + $container->get('Core/RepositoryService'), |
|
86 | + $container->get('Core/Navigation'), |
|
87 | + $container->get('forms'), |
|
88 | + $container->get('Applications/Options'), |
|
89 | + $container->get('Applications/Events'), |
|
90 | + $container->get('translator'), |
|
91 | + $container |
|
92 | + ); |
|
93 | + return $ob; |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
96 | + /** |
|
97 | 97 | * (non-PHPdoc) |
98 | 98 | * @see \Zend\Mvc\Controller\AbstractActionController::onDispatch() |
99 | 99 | */ |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $application->changeStatus( |
165 | 165 | $application->getStatus(), |
166 | 166 | sprintf(/*@translate*/ 'Application was read by %s', |
167 | - $this->auth()->getUser()->getInfo()->getDisplayName())); |
|
167 | + $this->auth()->getUser()->getInfo()->getDisplayName())); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | |
@@ -191,15 +191,15 @@ discard block |
||
191 | 191 | $viewModel->setVariables( |
192 | 192 | /*array( |
193 | 193 | 'application' => */$this->builders |
194 | - ->get('JsonApplication') |
|
195 | - ->unbuild($application) |
|
194 | + ->get('JsonApplication') |
|
195 | + ->unbuild($application) |
|
196 | 196 | ); |
197 | 197 | $viewModel->setVariable('isUnread', $applicationIsUnread); |
198 | 198 | $return = $viewModel; |
199 | 199 | break; |
200 | 200 | case 'pdf': |
201 | - // @TODO: [ZF3] Refactor this so we can inject Core/Html2Pdf service during controller creation |
|
202 | - $pdf = $this->container->get('Core/Html2Pdf'); |
|
201 | + // @TODO: [ZF3] Refactor this so we can inject Core/Html2Pdf service during controller creation |
|
202 | + $pdf = $this->container->get('Core/Html2Pdf'); |
|
203 | 203 | $return['format'] = $format; |
204 | 204 | break; |
205 | 205 | default: |
@@ -356,12 +356,12 @@ discard block |
||
356 | 356 | |
357 | 357 | /* @var ApplicationEvent $event */ |
358 | 358 | $event = $events->getEvent(ApplicationEvent::EVENT_APPLICATION_STATUS_CHANGE, |
359 | - $this, |
|
360 | - [ |
|
361 | - 'application' => $application, |
|
362 | - 'status' => $status, |
|
363 | - 'user' => $this->auth()->getUser(), |
|
364 | - ] |
|
359 | + $this, |
|
360 | + [ |
|
361 | + 'application' => $application, |
|
362 | + 'status' => $status, |
|
363 | + 'user' => $this->auth()->getUser(), |
|
364 | + ] |
|
365 | 365 | ); |
366 | 366 | |
367 | 367 | $event->setIsPostRequest($request->isPost()); |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | $emailAddress = $this->params()->fromQuery('email'); |
412 | 412 | /* @var \Applications\Entity\Application $application */ |
413 | 413 | $application = $this->repositories->get('Applications/Application') |
414 | - ->find($this->params('id')); |
|
414 | + ->find($this->params('id')); |
|
415 | 415 | |
416 | 416 | $this->acl($application, 'forward'); |
417 | 417 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $this->appOptions = $appOptions; |
72 | 72 | $this->appEvents = $appEvents; |
73 | 73 | $this->translator = $translator; |
74 | - $this->container = $container; |
|
74 | + $this->container = $container; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | |
171 | 171 | |
172 | - $format=$this->params()->fromQuery('format'); |
|
172 | + $format = $this->params()->fromQuery('format'); |
|
173 | 173 | |
174 | 174 | if ($application->isDraft()) { |
175 | 175 | $list = false; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | && ($network = $this->params()->fromQuery('network')) |
298 | 298 | && ($data = $this->params()->fromPost('data')) |
299 | 299 | ) { |
300 | - $profileClass = '\\Auth\\Entity\\SocialProfiles\\' . $network; |
|
300 | + $profileClass = '\\Auth\\Entity\\SocialProfiles\\'.$network; |
|
301 | 301 | $profile = new $profileClass(); |
302 | 302 | $profile->setData(\Zend\Json\Json::decode($data, \Zend\Json\Json::TYPE_ARRAY)); |
303 | 303 | } else { |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | |
367 | 367 | $event->setIsPostRequest($request->isPost()); |
368 | 368 | $event->setPostData($request->getPost()); |
369 | - $events->trigger($event->getName(),$event); |
|
369 | + $events->trigger($event->getName(), $event); |
|
370 | 370 | |
371 | 371 | $params = $event->getFormData(); |
372 | 372 | |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | |
416 | 416 | $this->acl($application, 'forward'); |
417 | 417 | |
418 | - $translator = $this->translator; |
|
418 | + $translator = $this->translator; |
|
419 | 419 | |
420 | 420 | if (!$emailAddress) { |
421 | 421 | throw new \InvalidArgumentException('An email address must be supplied.'); |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | public function deleteAction() |
456 | 456 | { |
457 | 457 | $id = $this->params('id'); |
458 | - $repositories= $this->repositories; |
|
458 | + $repositories = $this->repositories; |
|
459 | 459 | $repository = $repositories->get('Applications/Application'); |
460 | 460 | $application = $repository->find($id); |
461 | 461 | |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | |
466 | 466 | $this->acl($application, 'delete'); |
467 | 467 | |
468 | - $events = $this->appEvents; |
|
469 | - $events->trigger(ApplicationEvent::EVENT_APPLICATION_PRE_DELETE, $this, [ 'application' => $application ]); |
|
468 | + $events = $this->appEvents; |
|
469 | + $events->trigger(ApplicationEvent::EVENT_APPLICATION_PRE_DELETE, $this, ['application' => $application]); |
|
470 | 470 | |
471 | 471 | $repositories->remove($application); |
472 | 472 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * @param string $requestedName |
26 | 26 | * @param null|array $options |
27 | 27 | * |
28 | - * @return object |
|
28 | + * @return RegisterConfirmation |
|
29 | 29 | * @throws ServiceNotFoundException if unable to resolve the service. |
30 | 30 | * @throws ServiceNotCreatedException if an exception is raised when |
31 | 31 | * creating a service. |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * @param string $requestedName |
25 | 25 | * @param null|array $options |
26 | 26 | * |
27 | - * @return object |
|
27 | + * @return UserUniqueTokenGenerator |
|
28 | 28 | * @throws ServiceNotFoundException if unable to resolve the service. |
29 | 29 | * @throws ServiceNotCreatedException if an exception is raised when |
30 | 30 | * creating a service. |
@@ -31,6 +31,7 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @When /^(?:|I )fill in select2 "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/ |
33 | 33 | * @When /^(?:|I )fill in select2 "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/ |
34 | + * @param string $field |
|
34 | 35 | */ |
35 | 36 | public function iFillInSelect2Field($field, $value) |
36 | 37 | { |
@@ -42,7 +43,7 @@ discard block |
||
42 | 43 | |
43 | 44 | /** |
44 | 45 | * @When I fill in select2 search :field with :search and I choose :choice |
45 | - * @param $field |
|
46 | + * @param string $field |
|
46 | 47 | * @param $value |
47 | 48 | */ |
48 | 49 | public function iFillInSelect2FieldWith($field,$search,$choice=null) |
@@ -24,130 +24,130 @@ |
||
24 | 24 | */ |
25 | 25 | class Select2Context extends RawMinkContext implements Context |
26 | 26 | { |
27 | - protected $timeout = 5; |
|
27 | + protected $timeout = 5; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Fills in Select2 field with specified |
|
31 | - * |
|
32 | - * @When /^(?:|I )fill in select2 "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/ |
|
33 | - * @When /^(?:|I )fill in select2 "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/ |
|
34 | - */ |
|
35 | - public function iFillInSelect2Field($field, $value) |
|
36 | - { |
|
37 | - $page = $this->getSession()->getPage(); |
|
29 | + /** |
|
30 | + * Fills in Select2 field with specified |
|
31 | + * |
|
32 | + * @When /^(?:|I )fill in select2 "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/ |
|
33 | + * @When /^(?:|I )fill in select2 "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/ |
|
34 | + */ |
|
35 | + public function iFillInSelect2Field($field, $value) |
|
36 | + { |
|
37 | + $page = $this->getSession()->getPage(); |
|
38 | 38 | |
39 | - $this->openField($page, $field); |
|
40 | - $this->selectValue($page, $field, $value, $this->timeout); |
|
41 | - } |
|
39 | + $this->openField($page, $field); |
|
40 | + $this->selectValue($page, $field, $value, $this->timeout); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @When I fill in select2 search :field with :search and I choose :choice |
|
45 | - * @param $field |
|
46 | - * @param $value |
|
47 | - */ |
|
48 | - public function iFillInSelect2FieldWith($field,$search,$choice=null) |
|
49 | - { |
|
50 | - $page = $this->getSession()->getPage(); |
|
51 | - $this->openField($page, $field); |
|
52 | - $this->fillSearchField($page,$field,$search); |
|
53 | - $this->selectValue($page, $field, $choice); |
|
54 | - } |
|
43 | + /** |
|
44 | + * @When I fill in select2 search :field with :search and I choose :choice |
|
45 | + * @param $field |
|
46 | + * @param $value |
|
47 | + */ |
|
48 | + public function iFillInSelect2FieldWith($field,$search,$choice=null) |
|
49 | + { |
|
50 | + $page = $this->getSession()->getPage(); |
|
51 | + $this->openField($page, $field); |
|
52 | + $this->fillSearchField($page,$field,$search); |
|
53 | + $this->selectValue($page, $field, $choice); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Fill Select2 search field |
|
58 | - * |
|
59 | - * @param DocumentElement $page |
|
60 | - * @param string $field |
|
61 | - * @param string $value |
|
62 | - * @throws \Exception |
|
63 | - */ |
|
64 | - private function fillSearchField(DocumentElement $page, $field, $value) |
|
65 | - { |
|
66 | - $driver = $this->getSession()->getDriver(); |
|
67 | - if ('Behat\Mink\Driver\Selenium2Driver' === get_class($driver)) { |
|
68 | - // Can't use `$this->getSession()->getPage()->find()` because of https://github.com/minkphp/MinkSelenium2Driver/issues/188 |
|
56 | + /** |
|
57 | + * Fill Select2 search field |
|
58 | + * |
|
59 | + * @param DocumentElement $page |
|
60 | + * @param string $field |
|
61 | + * @param string $value |
|
62 | + * @throws \Exception |
|
63 | + */ |
|
64 | + private function fillSearchField(DocumentElement $page, $field, $value) |
|
65 | + { |
|
66 | + $driver = $this->getSession()->getDriver(); |
|
67 | + if ('Behat\Mink\Driver\Selenium2Driver' === get_class($driver)) { |
|
68 | + // Can't use `$this->getSession()->getPage()->find()` because of https://github.com/minkphp/MinkSelenium2Driver/issues/188 |
|
69 | 69 | |
70 | - $element = $page->find('css','.select2-container--open .select2-search__field'); |
|
71 | - $xpath = $element->getXpath(); |
|
72 | - $select2Input = $this->getSession() |
|
73 | - ->getDriver() |
|
74 | - ->getWebDriverSession() |
|
75 | - ->element('xpath',$xpath) |
|
76 | - //->element('xpath', "//html/descendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), ' select2-search__field ')]") |
|
77 | - ; |
|
78 | - if (!$select2Input) { |
|
79 | - throw new \Exception(sprintf('No field "%s" found', $field)); |
|
80 | - } |
|
70 | + $element = $page->find('css','.select2-container--open .select2-search__field'); |
|
71 | + $xpath = $element->getXpath(); |
|
72 | + $select2Input = $this->getSession() |
|
73 | + ->getDriver() |
|
74 | + ->getWebDriverSession() |
|
75 | + ->element('xpath',$xpath) |
|
76 | + //->element('xpath', "//html/descendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), ' select2-search__field ')]") |
|
77 | + ; |
|
78 | + if (!$select2Input) { |
|
79 | + throw new \Exception(sprintf('No field "%s" found', $field)); |
|
80 | + } |
|
81 | 81 | |
82 | - $select2Input->postValue(['value' => [$value]]); |
|
83 | - } else { |
|
84 | - $select2Input = $page->find('css', '.select2-search__field'); |
|
85 | - if (!$select2Input) { |
|
86 | - throw new \Exception(sprintf('No input found for "%s"', $field)); |
|
87 | - } |
|
88 | - $select2Input->setValue($value); |
|
89 | - } |
|
82 | + $select2Input->postValue(['value' => [$value]]); |
|
83 | + } else { |
|
84 | + $select2Input = $page->find('css', '.select2-search__field'); |
|
85 | + if (!$select2Input) { |
|
86 | + throw new \Exception(sprintf('No input found for "%s"', $field)); |
|
87 | + } |
|
88 | + $select2Input->setValue($value); |
|
89 | + } |
|
90 | 90 | |
91 | - $this->waitForLoadingResults($this->timeout); |
|
92 | - } |
|
91 | + $this->waitForLoadingResults($this->timeout); |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * Select value in choice list |
|
96 | - * |
|
97 | - * @param DocumentElement $page |
|
98 | - * @param string $field |
|
99 | - * @param string $value |
|
100 | - * @param int $time |
|
101 | - * @throws \Exception |
|
102 | - */ |
|
103 | - private function selectValue(DocumentElement $page, $field, $value, $time=5) |
|
104 | - { |
|
105 | - $this->waitForLoadingResults($time); |
|
94 | + /** |
|
95 | + * Select value in choice list |
|
96 | + * |
|
97 | + * @param DocumentElement $page |
|
98 | + * @param string $field |
|
99 | + * @param string $value |
|
100 | + * @param int $time |
|
101 | + * @throws \Exception |
|
102 | + */ |
|
103 | + private function selectValue(DocumentElement $page, $field, $value, $time=5) |
|
104 | + { |
|
105 | + $this->waitForLoadingResults($time); |
|
106 | 106 | |
107 | - $chosenResults = $page->findAll('css', '.select2-results li'); |
|
108 | - foreach ($chosenResults as $result) { |
|
109 | - $text = $result->getText(); |
|
110 | - if (false!==strpos($text,$value)) { |
|
111 | - $result->click(); |
|
112 | - return; |
|
113 | - } |
|
114 | - } |
|
107 | + $chosenResults = $page->findAll('css', '.select2-results li'); |
|
108 | + foreach ($chosenResults as $result) { |
|
109 | + $text = $result->getText(); |
|
110 | + if (false!==strpos($text,$value)) { |
|
111 | + $result->click(); |
|
112 | + return; |
|
113 | + } |
|
114 | + } |
|
115 | 115 | |
116 | - throw new \Exception(sprintf('Value "%s" not found for "%s"', $value, $field)); |
|
117 | - } |
|
116 | + throw new \Exception(sprintf('Value "%s" not found for "%s"', $value, $field)); |
|
117 | + } |
|
118 | 118 | |
119 | - private function openField(DocumentElement $page, $field) |
|
120 | - { |
|
121 | - $inputField = $page->find('css',$field); |
|
122 | - if(!$inputField){ |
|
123 | - $fieldName = sprintf('select[name="%s"] + .select2-container', $field); |
|
124 | - $inputField = $page->find('css', $fieldName); |
|
125 | - } |
|
126 | - if (!$inputField) { |
|
127 | - throw new \Exception(sprintf('No field "%s" found', $field)); |
|
128 | - } |
|
119 | + private function openField(DocumentElement $page, $field) |
|
120 | + { |
|
121 | + $inputField = $page->find('css',$field); |
|
122 | + if(!$inputField){ |
|
123 | + $fieldName = sprintf('select[name="%s"] + .select2-container', $field); |
|
124 | + $inputField = $page->find('css', $fieldName); |
|
125 | + } |
|
126 | + if (!$inputField) { |
|
127 | + throw new \Exception(sprintf('No field "%s" found', $field)); |
|
128 | + } |
|
129 | 129 | |
130 | - $choice = $inputField->find('css', '.select2-selection'); |
|
131 | - if (!$choice) { |
|
132 | - throw new \Exception(sprintf('No select2 choice found for "%s"', $field)); |
|
133 | - } |
|
134 | - $choice->press(); |
|
135 | - } |
|
130 | + $choice = $inputField->find('css', '.select2-selection'); |
|
131 | + if (!$choice) { |
|
132 | + throw new \Exception(sprintf('No select2 choice found for "%s"', $field)); |
|
133 | + } |
|
134 | + $choice->press(); |
|
135 | + } |
|
136 | 136 | |
137 | - /** |
|
138 | - * Wait the end of fetching Select2 results |
|
139 | - * |
|
140 | - * @param int $time Time to wait in seconds |
|
141 | - */ |
|
142 | - private function waitForLoadingResults($time) |
|
143 | - { |
|
144 | - for ($i = 0; $i < $time; $i++) { |
|
145 | - if (!$this->getSession()->getPage()->find('css', '.select2-results__option.loading-results')) { |
|
146 | - return; |
|
147 | - } |
|
137 | + /** |
|
138 | + * Wait the end of fetching Select2 results |
|
139 | + * |
|
140 | + * @param int $time Time to wait in seconds |
|
141 | + */ |
|
142 | + private function waitForLoadingResults($time) |
|
143 | + { |
|
144 | + for ($i = 0; $i < $time; $i++) { |
|
145 | + if (!$this->getSession()->getPage()->find('css', '.select2-results__option.loading-results')) { |
|
146 | + return; |
|
147 | + } |
|
148 | 148 | |
149 | - sleep(1); |
|
150 | - } |
|
151 | - } |
|
149 | + sleep(1); |
|
150 | + } |
|
151 | + } |
|
152 | 152 | |
153 | 153 | } |
154 | 154 | \ No newline at end of file |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | * @param $field |
46 | 46 | * @param $value |
47 | 47 | */ |
48 | - public function iFillInSelect2FieldWith($field,$search,$choice=null) |
|
48 | + public function iFillInSelect2FieldWith($field, $search, $choice = null) |
|
49 | 49 | { |
50 | 50 | $page = $this->getSession()->getPage(); |
51 | 51 | $this->openField($page, $field); |
52 | - $this->fillSearchField($page,$field,$search); |
|
52 | + $this->fillSearchField($page, $field, $search); |
|
53 | 53 | $this->selectValue($page, $field, $choice); |
54 | 54 | } |
55 | 55 | |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | if ('Behat\Mink\Driver\Selenium2Driver' === get_class($driver)) { |
68 | 68 | // Can't use `$this->getSession()->getPage()->find()` because of https://github.com/minkphp/MinkSelenium2Driver/issues/188 |
69 | 69 | |
70 | - $element = $page->find('css','.select2-container--open .select2-search__field'); |
|
70 | + $element = $page->find('css', '.select2-container--open .select2-search__field'); |
|
71 | 71 | $xpath = $element->getXpath(); |
72 | 72 | $select2Input = $this->getSession() |
73 | 73 | ->getDriver() |
74 | 74 | ->getWebDriverSession() |
75 | - ->element('xpath',$xpath) |
|
75 | + ->element('xpath', $xpath) |
|
76 | 76 | //->element('xpath', "//html/descendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), ' select2-search__field ')]") |
77 | 77 | ; |
78 | 78 | if (!$select2Input) { |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | * @param int $time |
101 | 101 | * @throws \Exception |
102 | 102 | */ |
103 | - private function selectValue(DocumentElement $page, $field, $value, $time=5) |
|
103 | + private function selectValue(DocumentElement $page, $field, $value, $time = 5) |
|
104 | 104 | { |
105 | 105 | $this->waitForLoadingResults($time); |
106 | 106 | |
107 | 107 | $chosenResults = $page->findAll('css', '.select2-results li'); |
108 | 108 | foreach ($chosenResults as $result) { |
109 | 109 | $text = $result->getText(); |
110 | - if (false!==strpos($text,$value)) { |
|
110 | + if (false !== strpos($text, $value)) { |
|
111 | 111 | $result->click(); |
112 | 112 | return; |
113 | 113 | } |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | |
119 | 119 | private function openField(DocumentElement $page, $field) |
120 | 120 | { |
121 | - $inputField = $page->find('css',$field); |
|
122 | - if(!$inputField){ |
|
121 | + $inputField = $page->find('css', $field); |
|
122 | + if (!$inputField) { |
|
123 | 123 | $fieldName = sprintf('select[name="%s"] + .select2-container', $field); |
124 | 124 | $inputField = $page->find('css', $fieldName); |
125 | 125 | } |
@@ -198,6 +198,9 @@ discard block |
||
198 | 198 | $this->startLogin($user,'test'); |
199 | 199 | } |
200 | 200 | |
201 | + /** |
|
202 | + * @param string $password |
|
203 | + */ |
|
201 | 204 | private function startLogin(UserInterface $user, $password) |
202 | 205 | { |
203 | 206 | $currentUser = $this->currentUser; |
@@ -242,7 +245,7 @@ discard block |
||
242 | 245 | * @param string $fullname |
243 | 246 | * @param string $role |
244 | 247 | * |
245 | - * @return \Auth\Entity\UserInterface |
|
248 | + * @return \Core\Entity\EntityInterface |
|
246 | 249 | */ |
247 | 250 | public function createUser($email,$password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter") |
248 | 251 | { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | protected $currentUser; |
65 | 65 | |
66 | - public function __construct($parameters=[]) |
|
66 | + public function __construct($parameters = []) |
|
67 | 67 | { |
68 | 68 | $defaultLoginInfo = [ |
69 | 69 | 'facebook' => [ |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | 'session_password-login' => getenv('LINKEDIN_USER_PASSWORD') |
76 | 76 | ], |
77 | 77 | ]; |
78 | - $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info']:[]; |
|
79 | - $this->socialLoginInfo = array_merge($defaultLoginInfo,$socialLoginConfig); |
|
78 | + $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info'] : []; |
|
79 | + $this->socialLoginInfo = array_merge($defaultLoginInfo, $socialLoginConfig); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'Auth\Entity\UserImage', |
99 | 99 | 'Organizations\Entity\OrganizationName', |
100 | 100 | ]; |
101 | - foreach($documents as $document){ |
|
101 | + foreach ($documents as $document) { |
|
102 | 102 | $dm->createQueryBuilder($document) |
103 | 103 | ->remove() |
104 | 104 | ->getQuery() |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | { |
127 | 127 | $provider = strtolower($provider); |
128 | 128 | $mink = $this->minkContext; |
129 | - foreach($this->socialLoginInfo[$provider] as $field=>$value){ |
|
130 | - $mink->fillField($field,$value); |
|
129 | + foreach ($this->socialLoginInfo[$provider] as $field=>$value) { |
|
130 | + $mink->fillField($field, $value); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | * @Given I am logged in as a recruiter |
136 | 136 | * @Given I am logged in as a recruiter with :organization as organization |
137 | 137 | */ |
138 | - public function iAmLoggedInAsARecruiter($organization=null) |
|
138 | + public function iAmLoggedInAsARecruiter($organization = null) |
|
139 | 139 | { |
140 | 140 | $user = $this->thereIsAUserIdentifiedBy( |
141 | 141 | '[email protected]', |
142 | - 'test',User::ROLE_RECRUITER, |
|
142 | + 'test', User::ROLE_RECRUITER, |
|
143 | 143 | 'Test Recruiter', |
144 | 144 | $organization |
145 | 145 | ); |
146 | - $this->startLogin($user,'test'); |
|
147 | - if(!is_null($organization)){ |
|
148 | - $this->iHaveMainOrganization($user,$organization); |
|
146 | + $this->startLogin($user, 'test'); |
|
147 | + if (!is_null($organization)) { |
|
148 | + $this->iHaveMainOrganization($user, $organization); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | public function iDonTHaveUser($login) |
157 | 157 | { |
158 | 158 | $repo = $this->getUserRepository(); |
159 | - $user=$repo->findByLogin($login); |
|
160 | - if($user instanceof UserInterface){ |
|
161 | - $repo->remove($user,true); |
|
159 | + $user = $repo->findByLogin($login); |
|
160 | + if ($user instanceof UserInterface) { |
|
161 | + $repo->remove($user, true); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param $role |
168 | 168 | * @param TableNode $fields |
169 | 169 | */ |
170 | - public function iHaveUserWithTheFollowing($role,TableNode $fields) |
|
170 | + public function iHaveUserWithTheFollowing($role, TableNode $fields) |
|
171 | 171 | { |
172 | 172 | $normalizedFields = [ |
173 | 173 | 'login' => '[email protected]', |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | 'password' => 'test', |
177 | 177 | 'organization' => 'Cross Solution' |
178 | 178 | ]; |
179 | - foreach($fields->getRowsHash() as $field=>$value){ |
|
179 | + foreach ($fields->getRowsHash() as $field=>$value) { |
|
180 | 180 | $field = Inflector::camelize($field); |
181 | 181 | $normalizedFields[$field] = $value; |
182 | 182 | } |
@@ -196,14 +196,14 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function iAmLoggedInAsAnAdmin() |
198 | 198 | { |
199 | - $user = $this->thereIsAUserIdentifiedBy('[email protected]','test',User::ROLE_ADMIN); |
|
200 | - $this->startLogin($user,'test'); |
|
199 | + $user = $this->thereIsAUserIdentifiedBy('[email protected]', 'test', User::ROLE_ADMIN); |
|
200 | + $this->startLogin($user, 'test'); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | private function startLogin(UserInterface $user, $password) |
204 | 204 | { |
205 | 205 | $currentUser = $this->currentUser; |
206 | - if(!is_object($currentUser) || $user->getId()!=$currentUser->getId()){ |
|
206 | + if (!is_object($currentUser) || $user->getId() != $currentUser->getId()) { |
|
207 | 207 | $this->iWantToLogIn(); |
208 | 208 | $this->iSpecifyTheUsernameAs($user->getLogin()); |
209 | 209 | $this->iSpecifyThePasswordAs($password); |
@@ -223,15 +223,15 @@ discard block |
||
223 | 223 | /** |
224 | 224 | * @Given there is a user :email identified by :password |
225 | 225 | */ |
226 | - public function thereIsAUserIdentifiedBy($email, $password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter",$organization=null) |
|
226 | + public function thereIsAUserIdentifiedBy($email, $password, $role = User::ROLE_RECRUITER, $fullname = "Test Recruiter", $organization = null) |
|
227 | 227 | { |
228 | 228 | $repo = $this->getUserRepository(); |
229 | - if(!is_object($user=$repo->findByEmail($email))){ |
|
230 | - $user = $this->createUser($email,$password,$role,$fullname,$organization); |
|
229 | + if (!is_object($user = $repo->findByEmail($email))) { |
|
230 | + $user = $this->createUser($email, $password, $role, $fullname, $organization); |
|
231 | 231 | } |
232 | 232 | |
233 | - if(!is_null($organization)){ |
|
234 | - $this->iHaveMainOrganization($user,$organization); |
|
233 | + if (!is_null($organization)) { |
|
234 | + $this->iHaveMainOrganization($user, $organization); |
|
235 | 235 | } |
236 | 236 | $this->addCreatedUser($user); |
237 | 237 | $repo->getDocumentManager()->refresh($user); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @return \Auth\Entity\UserInterface |
249 | 249 | */ |
250 | - public function createUser($email,$password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter") |
|
250 | + public function createUser($email, $password, $role = User::ROLE_RECRUITER, $fullname = "Test Recruiter") |
|
251 | 251 | { |
252 | 252 | /* @var Register $service */ |
253 | 253 | /* @var User $user */ |
@@ -258,10 +258,10 @@ discard block |
||
258 | 258 | $user->setRole($role); |
259 | 259 | $settings = $user->getSettings('Applications'); |
260 | 260 | |
261 | - $expFullName = explode(' ',$fullname); |
|
261 | + $expFullName = explode(' ', $fullname); |
|
262 | 262 | $info = $user->getInfo(); |
263 | 263 | $info->setFirstName(array_shift($expFullName)); |
264 | - $info->setLastName(count($expFullName)>0 ? implode(' ',$expFullName):''); |
|
264 | + $info->setLastName(count($expFullName) > 0 ? implode(' ', $expFullName) : ''); |
|
265 | 265 | $info->setEmail($email); |
266 | 266 | $info->setEmailVerified(true); |
267 | 267 | $repo->store($user); |
@@ -286,20 +286,20 @@ discard block |
||
286 | 286 | * @When I have :organization as my main organization |
287 | 287 | * @param $orgName |
288 | 288 | */ |
289 | - public function iHaveMainOrganization(UserInterface $user,$orgName) |
|
289 | + public function iHaveMainOrganization(UserInterface $user, $orgName) |
|
290 | 290 | { |
291 | 291 | /* @var $repoOrganization OrganizationRepository */ |
292 | 292 | $repoOrganization = $this->coreContext->getRepositories()->get('Organizations/Organization'); |
293 | 293 | $result = $repoOrganization->findByName($orgName); |
294 | - $organization = count($result) > 0 ? $result[0]:null; |
|
295 | - if(!$organization instanceof Organization){ |
|
294 | + $organization = count($result) > 0 ? $result[0] : null; |
|
295 | + if (!$organization instanceof Organization) { |
|
296 | 296 | $organization = new Organization(); |
297 | 297 | $organizationName = new OrganizationName($orgName); |
298 | 298 | $organization->setOrganizationName($organizationName); |
299 | 299 | } |
300 | 300 | $organization->setProfileSetting(Organization::PROFILE_ALWAYS_ENABLE); |
301 | 301 | $permissions = $organization->getPermissions(); |
302 | - $permissions->grant($user,Permissions::PERMISSION_ALL); |
|
302 | + $permissions->grant($user, Permissions::PERMISSION_ALL); |
|
303 | 303 | |
304 | 304 | $organization->setUser($user); |
305 | 305 | $repoOrganization->store($organization); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | */ |
333 | 333 | public function iSpecifyTheUsernameAs($username) |
334 | 334 | { |
335 | - $this->minkContext->fillField('Login name',$username); |
|
335 | + $this->minkContext->fillField('Login name', $username); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function iSpecifyThePasswordAs($password) |
342 | 342 | { |
343 | - $this->minkContext->fillField('Password',$password); |
|
343 | + $this->minkContext->fillField('Password', $password); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | $repo = $this->getUserRepository(); |
352 | 352 | $user = $repo->findByLogin($username); |
353 | 353 | |
354 | - if(!$user instanceof User){ |
|
355 | - throw new \Exception(sprintf('There is no user with this login: "%s"',$username)); |
|
354 | + if (!$user instanceof User) { |
|
355 | + throw new \Exception(sprintf('There is no user with this login: "%s"', $username)); |
|
356 | 356 | } |
357 | 357 | $this->iWantToLogIn(); |
358 | 358 | $this->iSpecifyTheUsernameAs($username); |
@@ -408,13 +408,13 @@ discard block |
||
408 | 408 | { |
409 | 409 | $repo = $this->getUserRepository(); |
410 | 410 | $data = $table->getRowsHash(); |
411 | - $email = isset($data['email']) ? $data['email']:'[email protected]'; |
|
412 | - $password = isset($data['password']) ? $data['password']:'test'; |
|
413 | - $fullname = isset($data['fullname']) ? $data['fullname']:'Test User'; |
|
414 | - $role = isset($data['role']) ? $data['role']:User::ROLE_RECRUITER; |
|
411 | + $email = isset($data['email']) ? $data['email'] : '[email protected]'; |
|
412 | + $password = isset($data['password']) ? $data['password'] : 'test'; |
|
413 | + $fullname = isset($data['fullname']) ? $data['fullname'] : 'Test User'; |
|
414 | + $role = isset($data['role']) ? $data['role'] : User::ROLE_RECRUITER; |
|
415 | 415 | |
416 | - if(!is_object($user=$repo->findByLogin($email))){ |
|
417 | - $user = $this->createUser($email,$password,$role,$fullname); |
|
416 | + if (!is_object($user = $repo->findByLogin($email))) { |
|
417 | + $user = $this->createUser($email, $password, $role, $fullname); |
|
418 | 418 | } |
419 | 419 | $this->currentUser = $user; |
420 | 420 | $this->addCreatedUser($user); |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | |
423 | 423 | private function addCreatedUser(UserInterface $user) |
424 | 424 | { |
425 | - if(!in_array($user,static::$users)){ |
|
425 | + if (!in_array($user, static::$users)) { |
|
426 | 426 | static::$users[] = $user; |
427 | 427 | } |
428 | 428 | } |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | */ |
443 | 443 | public function getCurrentUser() |
444 | 444 | { |
445 | - if(!$this->currentUser instanceof User){ |
|
445 | + if (!$this->currentUser instanceof User) { |
|
446 | 446 | throw new FailedExpectationException('Need to login first before use this step'); |
447 | 447 | } |
448 | 448 | return $this->currentUser; |
@@ -31,60 +31,60 @@ discard block |
||
31 | 31 | { |
32 | 32 | use CommonContextTrait; |
33 | 33 | |
34 | - /** |
|
35 | - * @var User[] |
|
36 | - */ |
|
37 | - static private $users = []; |
|
34 | + /** |
|
35 | + * @var User[] |
|
36 | + */ |
|
37 | + static private $users = []; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @var UserRepository |
|
41 | - */ |
|
42 | - static private $userRepo; |
|
39 | + /** |
|
40 | + * @var UserRepository |
|
41 | + */ |
|
42 | + static private $userRepo; |
|
43 | 43 | |
44 | - private $socialLoginInfo = []; |
|
44 | + private $socialLoginInfo = []; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @var DocumentManager |
48 | 48 | */ |
49 | - static private $dm; |
|
49 | + static private $dm; |
|
50 | 50 | |
51 | - /** |
|
52 | - * @var UserInterface |
|
53 | - */ |
|
54 | - private $loggedInUser; |
|
51 | + /** |
|
52 | + * @var UserInterface |
|
53 | + */ |
|
54 | + private $loggedInUser; |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * @var Organization |
58 | 58 | */ |
59 | - private $mainOrganization; |
|
59 | + private $mainOrganization; |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @var User |
63 | 63 | */ |
64 | 64 | protected $currentUser; |
65 | 65 | |
66 | - public function __construct($parameters=[]) |
|
67 | - { |
|
68 | - $defaultLoginInfo = [ |
|
69 | - 'facebook' => [ |
|
70 | - 'email' => getenv('FACEBOOK_USER_EMAIL'), |
|
71 | - 'pass' => getenv('FACEBOOK_USER_PASSWORD') |
|
72 | - ], |
|
73 | - 'linkedin' => [ |
|
74 | - 'session_key-login' => getenv('LINKEDIN_USER_EMAIL'), |
|
75 | - 'session_password-login' => getenv('LINKEDIN_USER_PASSWORD') |
|
76 | - ], |
|
77 | - ]; |
|
78 | - $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info']:[]; |
|
79 | - $this->socialLoginInfo = array_merge($defaultLoginInfo,$socialLoginConfig); |
|
80 | - } |
|
66 | + public function __construct($parameters=[]) |
|
67 | + { |
|
68 | + $defaultLoginInfo = [ |
|
69 | + 'facebook' => [ |
|
70 | + 'email' => getenv('FACEBOOK_USER_EMAIL'), |
|
71 | + 'pass' => getenv('FACEBOOK_USER_PASSWORD') |
|
72 | + ], |
|
73 | + 'linkedin' => [ |
|
74 | + 'session_key-login' => getenv('LINKEDIN_USER_EMAIL'), |
|
75 | + 'session_password-login' => getenv('LINKEDIN_USER_PASSWORD') |
|
76 | + ], |
|
77 | + ]; |
|
78 | + $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info']:[]; |
|
79 | + $this->socialLoginInfo = array_merge($defaultLoginInfo,$socialLoginConfig); |
|
80 | + } |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Empty all data every each tests |
84 | 84 | * |
85 | 85 | * @AfterSuite |
86 | 86 | */ |
87 | - static public function tearDown() |
|
87 | + static public function tearDown() |
|
88 | 88 | { |
89 | 89 | $dm = static::$dm; |
90 | 90 | |
@@ -107,47 +107,47 @@ discard block |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | - /** |
|
111 | - * @BeforeScenario |
|
112 | - * @param BeforeScenarioScope $scope |
|
113 | - */ |
|
114 | - public function beforeScenario(BeforeScenarioScope $scope) |
|
115 | - { |
|
116 | - $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
117 | - $this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class); |
|
118 | - static::$userRepo = $this->getUserRepository(); |
|
119 | - static::$dm = $this->getUserRepository()->getDocumentManager(); |
|
120 | - } |
|
110 | + /** |
|
111 | + * @BeforeScenario |
|
112 | + * @param BeforeScenarioScope $scope |
|
113 | + */ |
|
114 | + public function beforeScenario(BeforeScenarioScope $scope) |
|
115 | + { |
|
116 | + $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
117 | + $this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class); |
|
118 | + static::$userRepo = $this->getUserRepository(); |
|
119 | + static::$dm = $this->getUserRepository()->getDocumentManager(); |
|
120 | + } |
|
121 | 121 | |
122 | - /** |
|
123 | - * @When I fill in login form with :provider user |
|
124 | - */ |
|
125 | - public function iSignInWithSocialUser($provider) |
|
126 | - { |
|
127 | - $provider = strtolower($provider); |
|
128 | - $mink = $this->minkContext; |
|
129 | - foreach($this->socialLoginInfo[$provider] as $field=>$value){ |
|
130 | - $mink->fillField($field,$value); |
|
131 | - } |
|
132 | - } |
|
122 | + /** |
|
123 | + * @When I fill in login form with :provider user |
|
124 | + */ |
|
125 | + public function iSignInWithSocialUser($provider) |
|
126 | + { |
|
127 | + $provider = strtolower($provider); |
|
128 | + $mink = $this->minkContext; |
|
129 | + foreach($this->socialLoginInfo[$provider] as $field=>$value){ |
|
130 | + $mink->fillField($field,$value); |
|
131 | + } |
|
132 | + } |
|
133 | 133 | |
134 | - /** |
|
135 | - * @Given I am logged in as a recruiter |
|
136 | - * @Given I am logged in as a recruiter with :organization as organization |
|
137 | - */ |
|
138 | - public function iAmLoggedInAsARecruiter($organization=null) |
|
139 | - { |
|
140 | - $user = $this->thereIsAUserIdentifiedBy( |
|
141 | - '[email protected]', |
|
142 | - 'test',User::ROLE_RECRUITER, |
|
143 | - 'Test Recruiter', |
|
144 | - $organization |
|
145 | - ); |
|
146 | - $this->startLogin($user,'test'); |
|
147 | - if(!is_null($organization)){ |
|
134 | + /** |
|
135 | + * @Given I am logged in as a recruiter |
|
136 | + * @Given I am logged in as a recruiter with :organization as organization |
|
137 | + */ |
|
138 | + public function iAmLoggedInAsARecruiter($organization=null) |
|
139 | + { |
|
140 | + $user = $this->thereIsAUserIdentifiedBy( |
|
141 | + '[email protected]', |
|
142 | + 'test',User::ROLE_RECRUITER, |
|
143 | + 'Test Recruiter', |
|
144 | + $organization |
|
145 | + ); |
|
146 | + $this->startLogin($user,'test'); |
|
147 | + if(!is_null($organization)){ |
|
148 | 148 | $this->iHaveMainOrganization($user,$organization); |
149 | 149 | } |
150 | - } |
|
150 | + } |
|
151 | 151 | |
152 | 152 | /** |
153 | 153 | * @Given I am logged out |
@@ -159,156 +159,156 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | |
162 | - /** |
|
163 | - * @Given I don't have :login user |
|
164 | - * @param string $login |
|
165 | - */ |
|
166 | - public function iDonTHaveUser($login) |
|
167 | - { |
|
168 | - $repo = $this->getUserRepository(); |
|
169 | - $user=$repo->findByLogin($login); |
|
170 | - if($user instanceof UserInterface){ |
|
171 | - $repo->remove($user,true); |
|
172 | - } |
|
173 | - } |
|
162 | + /** |
|
163 | + * @Given I don't have :login user |
|
164 | + * @param string $login |
|
165 | + */ |
|
166 | + public function iDonTHaveUser($login) |
|
167 | + { |
|
168 | + $repo = $this->getUserRepository(); |
|
169 | + $user=$repo->findByLogin($login); |
|
170 | + if($user instanceof UserInterface){ |
|
171 | + $repo->remove($user,true); |
|
172 | + } |
|
173 | + } |
|
174 | 174 | |
175 | - /** |
|
176 | - * @Given I have a :role with the following: |
|
175 | + /** |
|
176 | + * @Given I have a :role with the following: |
|
177 | 177 | * @Given I have an :role with the following: |
178 | 178 | * |
179 | - * @param $role |
|
180 | - * @param TableNode $fields |
|
181 | - */ |
|
182 | - public function iHaveUserWithTheFollowing($role,TableNode $fields) |
|
183 | - { |
|
184 | - $normalizedFields = [ |
|
185 | - 'login' => '[email protected]', |
|
186 | - 'fullName' => 'Test Login', |
|
187 | - 'role' => $role, |
|
188 | - 'password' => 'test', |
|
189 | - 'organization' => 'Cross Solution' |
|
190 | - ]; |
|
191 | - foreach($fields->getRowsHash() as $field=>$value){ |
|
192 | - $field = Inflector::camelize($field); |
|
193 | - $normalizedFields[$field] = $value; |
|
194 | - } |
|
179 | + * @param $role |
|
180 | + * @param TableNode $fields |
|
181 | + */ |
|
182 | + public function iHaveUserWithTheFollowing($role,TableNode $fields) |
|
183 | + { |
|
184 | + $normalizedFields = [ |
|
185 | + 'login' => '[email protected]', |
|
186 | + 'fullName' => 'Test Login', |
|
187 | + 'role' => $role, |
|
188 | + 'password' => 'test', |
|
189 | + 'organization' => 'Cross Solution' |
|
190 | + ]; |
|
191 | + foreach($fields->getRowsHash() as $field=>$value){ |
|
192 | + $field = Inflector::camelize($field); |
|
193 | + $normalizedFields[$field] = $value; |
|
194 | + } |
|
195 | 195 | |
196 | - $this->thereIsAUserIdentifiedBy( |
|
197 | - $normalizedFields['login'], |
|
198 | - $normalizedFields['password'], |
|
199 | - $role, |
|
200 | - $normalizedFields['fullName'], |
|
201 | - $normalizedFields['organization'] |
|
202 | - ); |
|
196 | + $this->thereIsAUserIdentifiedBy( |
|
197 | + $normalizedFields['login'], |
|
198 | + $normalizedFields['password'], |
|
199 | + $role, |
|
200 | + $normalizedFields['fullName'], |
|
201 | + $normalizedFields['organization'] |
|
202 | + ); |
|
203 | 203 | |
204 | - } |
|
204 | + } |
|
205 | 205 | |
206 | - /** |
|
207 | - * @Given I am logged in as an administrator |
|
208 | - */ |
|
209 | - public function iAmLoggedInAsAnAdmin() |
|
210 | - { |
|
211 | - $user = $this->thereIsAUserIdentifiedBy('[email protected]','test',User::ROLE_ADMIN); |
|
212 | - $this->startLogin($user,'test'); |
|
213 | - } |
|
206 | + /** |
|
207 | + * @Given I am logged in as an administrator |
|
208 | + */ |
|
209 | + public function iAmLoggedInAsAnAdmin() |
|
210 | + { |
|
211 | + $user = $this->thereIsAUserIdentifiedBy('[email protected]','test',User::ROLE_ADMIN); |
|
212 | + $this->startLogin($user,'test'); |
|
213 | + } |
|
214 | 214 | |
215 | - private function startLogin(UserInterface $user, $password) |
|
216 | - { |
|
217 | - $currentUser = $this->currentUser; |
|
218 | - if(!is_object($currentUser) || $user->getId()!=$currentUser->getId()){ |
|
219 | - $this->iWantToLogIn(); |
|
220 | - $this->iSpecifyTheUsernameAs($user->getLogin()); |
|
221 | - $this->iSpecifyThePasswordAs($password); |
|
222 | - $this->iLogIn(); |
|
223 | - $this->currentUser = $user; |
|
224 | - } |
|
225 | - } |
|
215 | + private function startLogin(UserInterface $user, $password) |
|
216 | + { |
|
217 | + $currentUser = $this->currentUser; |
|
218 | + if(!is_object($currentUser) || $user->getId()!=$currentUser->getId()){ |
|
219 | + $this->iWantToLogIn(); |
|
220 | + $this->iSpecifyTheUsernameAs($user->getLogin()); |
|
221 | + $this->iSpecifyThePasswordAs($password); |
|
222 | + $this->iLogIn(); |
|
223 | + $this->currentUser = $user; |
|
224 | + } |
|
225 | + } |
|
226 | 226 | |
227 | - /** |
|
228 | - * @return UserRepository |
|
229 | - */ |
|
230 | - public function getUserRepository() |
|
231 | - { |
|
232 | - return $this->coreContext->getRepositories()->get('Auth\Entity\User'); |
|
233 | - } |
|
227 | + /** |
|
228 | + * @return UserRepository |
|
229 | + */ |
|
230 | + public function getUserRepository() |
|
231 | + { |
|
232 | + return $this->coreContext->getRepositories()->get('Auth\Entity\User'); |
|
233 | + } |
|
234 | 234 | |
235 | - /** |
|
236 | - * @Given there is a user :email identified by :password |
|
237 | - */ |
|
238 | - public function thereIsAUserIdentifiedBy($email, $password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter",$organization=null) |
|
239 | - { |
|
240 | - $repo = $this->getUserRepository(); |
|
241 | - if(!is_object($user=$repo->findByEmail($email))){ |
|
242 | - $user = $this->createUser($email,$password,$role,$fullname,$organization); |
|
243 | - } |
|
235 | + /** |
|
236 | + * @Given there is a user :email identified by :password |
|
237 | + */ |
|
238 | + public function thereIsAUserIdentifiedBy($email, $password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter",$organization=null) |
|
239 | + { |
|
240 | + $repo = $this->getUserRepository(); |
|
241 | + if(!is_object($user=$repo->findByEmail($email))){ |
|
242 | + $user = $this->createUser($email,$password,$role,$fullname,$organization); |
|
243 | + } |
|
244 | 244 | |
245 | - if(!is_null($organization)){ |
|
246 | - $this->iHaveMainOrganization($user,$organization); |
|
247 | - } |
|
248 | - $this->addCreatedUser($user); |
|
249 | - $repo->getDocumentManager()->refresh($user); |
|
250 | - return $user; |
|
251 | - } |
|
245 | + if(!is_null($organization)){ |
|
246 | + $this->iHaveMainOrganization($user,$organization); |
|
247 | + } |
|
248 | + $this->addCreatedUser($user); |
|
249 | + $repo->getDocumentManager()->refresh($user); |
|
250 | + return $user; |
|
251 | + } |
|
252 | 252 | |
253 | - /** |
|
254 | - * @param $email |
|
255 | - * @param $password |
|
256 | - * @param $username |
|
257 | - * @param string $fullname |
|
258 | - * @param string $role |
|
259 | - * |
|
260 | - * @return \Auth\Entity\UserInterface |
|
261 | - */ |
|
262 | - public function createUser($email,$password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter") |
|
263 | - { |
|
264 | - /* @var Register $service */ |
|
265 | - /* @var User $user */ |
|
266 | - $repo = $this->getUserRepository(); |
|
267 | - $user = $repo->create([]); |
|
268 | - $user->setLogin($email); |
|
269 | - $user->setPassword($password); |
|
270 | - $user->setRole($role); |
|
271 | - $settings = $user->getSettings('Applications'); |
|
253 | + /** |
|
254 | + * @param $email |
|
255 | + * @param $password |
|
256 | + * @param $username |
|
257 | + * @param string $fullname |
|
258 | + * @param string $role |
|
259 | + * |
|
260 | + * @return \Auth\Entity\UserInterface |
|
261 | + */ |
|
262 | + public function createUser($email,$password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter") |
|
263 | + { |
|
264 | + /* @var Register $service */ |
|
265 | + /* @var User $user */ |
|
266 | + $repo = $this->getUserRepository(); |
|
267 | + $user = $repo->create([]); |
|
268 | + $user->setLogin($email); |
|
269 | + $user->setPassword($password); |
|
270 | + $user->setRole($role); |
|
271 | + $settings = $user->getSettings('Applications'); |
|
272 | 272 | |
273 | - $expFullName = explode(' ',$fullname); |
|
274 | - $info = $user->getInfo(); |
|
275 | - $info->setFirstName(array_shift($expFullName)); |
|
276 | - $info->setLastName(count($expFullName)>0 ? implode(' ',$expFullName):''); |
|
277 | - $info->setEmail($email); |
|
278 | - $info->setEmailVerified(true); |
|
279 | - $repo->store($user); |
|
280 | - $repo->getDocumentManager()->refresh($user); |
|
273 | + $expFullName = explode(' ',$fullname); |
|
274 | + $info = $user->getInfo(); |
|
275 | + $info->setFirstName(array_shift($expFullName)); |
|
276 | + $info->setLastName(count($expFullName)>0 ? implode(' ',$expFullName):''); |
|
277 | + $info->setEmail($email); |
|
278 | + $info->setEmailVerified(true); |
|
279 | + $repo->store($user); |
|
280 | + $repo->getDocumentManager()->refresh($user); |
|
281 | 281 | |
282 | - $eventArgs = new LifecycleEventArgs($user, $repo->getDocumentManager()); |
|
283 | - $repo->getDocumentManager()->getEventManager()->dispatchEvent( |
|
284 | - Events::postLoad, |
|
285 | - $eventArgs |
|
286 | - ); |
|
287 | - /* @var \Core\EventManager\EventManager $events */ |
|
288 | - /* @var \Auth\Listener\Events\AuthEvent $event */ |
|
289 | - //@TODO: [Behat] event not working in travis |
|
290 | - //$events = $this->coreContext->getEventManager(); |
|
291 | - //$event = $events->getEvent(AuthEvent::EVENT_USER_REGISTERED, $this); |
|
292 | - //$event->setUser($user); |
|
293 | - //$events->triggerEvent($event); |
|
294 | - return $user; |
|
295 | - } |
|
282 | + $eventArgs = new LifecycleEventArgs($user, $repo->getDocumentManager()); |
|
283 | + $repo->getDocumentManager()->getEventManager()->dispatchEvent( |
|
284 | + Events::postLoad, |
|
285 | + $eventArgs |
|
286 | + ); |
|
287 | + /* @var \Core\EventManager\EventManager $events */ |
|
288 | + /* @var \Auth\Listener\Events\AuthEvent $event */ |
|
289 | + //@TODO: [Behat] event not working in travis |
|
290 | + //$events = $this->coreContext->getEventManager(); |
|
291 | + //$event = $events->getEvent(AuthEvent::EVENT_USER_REGISTERED, $this); |
|
292 | + //$event->setUser($user); |
|
293 | + //$events->triggerEvent($event); |
|
294 | + return $user; |
|
295 | + } |
|
296 | 296 | |
297 | - /** |
|
298 | - * @When I have :organization as my main organization |
|
299 | - * @param $orgName |
|
300 | - */ |
|
301 | - public function iHaveMainOrganization(UserInterface $user,$orgName) |
|
302 | - { |
|
303 | - /* @var $repoOrganization OrganizationRepository */ |
|
304 | - $repoOrganization = $this->coreContext->getRepositories()->get('Organizations/Organization'); |
|
305 | - $result = $repoOrganization->findByName($orgName); |
|
306 | - $organization = count($result) > 0 ? $result[0]:null; |
|
307 | - if(!$organization instanceof Organization){ |
|
308 | - $organization = new Organization(); |
|
309 | - $organizationName = new OrganizationName($orgName); |
|
310 | - $organization->setOrganizationName($organizationName); |
|
311 | - } |
|
297 | + /** |
|
298 | + * @When I have :organization as my main organization |
|
299 | + * @param $orgName |
|
300 | + */ |
|
301 | + public function iHaveMainOrganization(UserInterface $user,$orgName) |
|
302 | + { |
|
303 | + /* @var $repoOrganization OrganizationRepository */ |
|
304 | + $repoOrganization = $this->coreContext->getRepositories()->get('Organizations/Organization'); |
|
305 | + $result = $repoOrganization->findByName($orgName); |
|
306 | + $organization = count($result) > 0 ? $result[0]:null; |
|
307 | + if(!$organization instanceof Organization){ |
|
308 | + $organization = new Organization(); |
|
309 | + $organizationName = new OrganizationName($orgName); |
|
310 | + $organization->setOrganizationName($organizationName); |
|
311 | + } |
|
312 | 312 | $organization->setProfileSetting(Organization::PROFILE_ALWAYS_ENABLE); |
313 | 313 | $permissions = $organization->getPermissions(); |
314 | 314 | $permissions->grant($user,Permissions::PERMISSION_ALL); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $repoOrganization->getDocumentManager()->refresh($organization); |
319 | 319 | |
320 | 320 | $this->mainOrganization = $organization; |
321 | - } |
|
321 | + } |
|
322 | 322 | |
323 | 323 | /** |
324 | 324 | * @return Organization |
@@ -328,130 +328,130 @@ discard block |
||
328 | 328 | return $this->mainOrganization; |
329 | 329 | } |
330 | 330 | |
331 | - /** |
|
332 | - * @When I want to log in |
|
333 | - */ |
|
334 | - public function iWantToLogIn() |
|
335 | - { |
|
336 | - $session = $this->minkContext->getSession(); |
|
337 | - $url = $this->buildUrl('lang/auth'); |
|
338 | - $session->visit($url); |
|
339 | - } |
|
331 | + /** |
|
332 | + * @When I want to log in |
|
333 | + */ |
|
334 | + public function iWantToLogIn() |
|
335 | + { |
|
336 | + $session = $this->minkContext->getSession(); |
|
337 | + $url = $this->buildUrl('lang/auth'); |
|
338 | + $session->visit($url); |
|
339 | + } |
|
340 | 340 | |
341 | - /** |
|
342 | - * @When I specify the username as :username |
|
343 | - */ |
|
344 | - public function iSpecifyTheUsernameAs($username) |
|
345 | - { |
|
346 | - $this->minkContext->fillField('Login name',$username); |
|
347 | - } |
|
341 | + /** |
|
342 | + * @When I specify the username as :username |
|
343 | + */ |
|
344 | + public function iSpecifyTheUsernameAs($username) |
|
345 | + { |
|
346 | + $this->minkContext->fillField('Login name',$username); |
|
347 | + } |
|
348 | 348 | |
349 | - /** |
|
350 | - * @When I specify the password as :password |
|
351 | - */ |
|
352 | - public function iSpecifyThePasswordAs($password) |
|
353 | - { |
|
354 | - $this->minkContext->fillField('Password',$password); |
|
355 | - } |
|
349 | + /** |
|
350 | + * @When I specify the password as :password |
|
351 | + */ |
|
352 | + public function iSpecifyThePasswordAs($password) |
|
353 | + { |
|
354 | + $this->minkContext->fillField('Password',$password); |
|
355 | + } |
|
356 | 356 | |
357 | - /** |
|
358 | - * @Given I am logged in as :username identified by :password |
|
359 | - */ |
|
360 | - public function iAmLoggedInAsIdentifiedBy($username, $password) |
|
361 | - { |
|
362 | - $repo = $this->getUserRepository(); |
|
363 | - $user = $repo->findByLogin($username); |
|
357 | + /** |
|
358 | + * @Given I am logged in as :username identified by :password |
|
359 | + */ |
|
360 | + public function iAmLoggedInAsIdentifiedBy($username, $password) |
|
361 | + { |
|
362 | + $repo = $this->getUserRepository(); |
|
363 | + $user = $repo->findByLogin($username); |
|
364 | 364 | |
365 | - if(!$user instanceof User){ |
|
366 | - throw new \Exception(sprintf('There is no user with this login: "%s"',$username)); |
|
367 | - } |
|
368 | - $this->iWantToLogIn(); |
|
369 | - $this->iSpecifyTheUsernameAs($username); |
|
370 | - $this->iSpecifyThePasswordAs($password); |
|
371 | - $this->iLogIn(); |
|
365 | + if(!$user instanceof User){ |
|
366 | + throw new \Exception(sprintf('There is no user with this login: "%s"',$username)); |
|
367 | + } |
|
368 | + $this->iWantToLogIn(); |
|
369 | + $this->iSpecifyTheUsernameAs($username); |
|
370 | + $this->iSpecifyThePasswordAs($password); |
|
371 | + $this->iLogIn(); |
|
372 | 372 | $this->currentUser = $user; |
373 | - } |
|
373 | + } |
|
374 | 374 | |
375 | - /** |
|
376 | - * @When I log in |
|
377 | - */ |
|
378 | - public function iLogIn() |
|
379 | - { |
|
380 | - $this->minkContext->pressButton('login'); |
|
381 | - } |
|
375 | + /** |
|
376 | + * @When I log in |
|
377 | + */ |
|
378 | + public function iLogIn() |
|
379 | + { |
|
380 | + $this->minkContext->pressButton('login'); |
|
381 | + } |
|
382 | 382 | |
383 | - /** |
|
384 | - * @When I press logout link |
|
385 | - */ |
|
386 | - public function iPressLogoutLink() |
|
387 | - { |
|
388 | - $url = $this->buildUrl('auth-logout'); |
|
389 | - $this->visit($url); |
|
390 | - } |
|
383 | + /** |
|
384 | + * @When I press logout link |
|
385 | + */ |
|
386 | + public function iPressLogoutLink() |
|
387 | + { |
|
388 | + $url = $this->buildUrl('auth-logout'); |
|
389 | + $this->visit($url); |
|
390 | + } |
|
391 | 391 | |
392 | - /** |
|
393 | - * @Given I log in with username :username and password :password |
|
394 | - */ |
|
395 | - public function iLogInWith($username, $password) |
|
396 | - { |
|
397 | - $repo = $this->getUserRepository(); |
|
398 | - $user = $repo->findByLogin($username); |
|
399 | - $this->iWantToLogIn(); |
|
400 | - $this->iSpecifyTheUsernameAs($username); |
|
401 | - $this->iSpecifyThePasswordAs($password); |
|
402 | - $this->iLogIn(); |
|
403 | - $this->loggedInUser = $user; |
|
404 | - } |
|
392 | + /** |
|
393 | + * @Given I log in with username :username and password :password |
|
394 | + */ |
|
395 | + public function iLogInWith($username, $password) |
|
396 | + { |
|
397 | + $repo = $this->getUserRepository(); |
|
398 | + $user = $repo->findByLogin($username); |
|
399 | + $this->iWantToLogIn(); |
|
400 | + $this->iSpecifyTheUsernameAs($username); |
|
401 | + $this->iSpecifyThePasswordAs($password); |
|
402 | + $this->iLogIn(); |
|
403 | + $this->loggedInUser = $user; |
|
404 | + } |
|
405 | 405 | |
406 | - /** |
|
407 | - * @When I go to profile page |
|
408 | - */ |
|
409 | - public function iGoToProfilePage() |
|
410 | - { |
|
411 | - $url = $this->buildUrl('lang/my'); |
|
412 | - $this->visit($url); |
|
413 | - } |
|
406 | + /** |
|
407 | + * @When I go to profile page |
|
408 | + */ |
|
409 | + public function iGoToProfilePage() |
|
410 | + { |
|
411 | + $url = $this->buildUrl('lang/my'); |
|
412 | + $this->visit($url); |
|
413 | + } |
|
414 | 414 | |
415 | - /** |
|
416 | - * @Given there is a user with the following: |
|
417 | - */ |
|
418 | - public function thereIsAUserWithTheFollowing(TableNode $table) |
|
419 | - { |
|
420 | - $repo = $this->getUserRepository(); |
|
421 | - $data = $table->getRowsHash(); |
|
422 | - $email = isset($data['email']) ? $data['email']:'[email protected]'; |
|
423 | - $password = isset($data['password']) ? $data['password']:'test'; |
|
424 | - $fullname = isset($data['fullname']) ? $data['fullname']:'Test User'; |
|
425 | - $role = isset($data['role']) ? $data['role']:User::ROLE_RECRUITER; |
|
415 | + /** |
|
416 | + * @Given there is a user with the following: |
|
417 | + */ |
|
418 | + public function thereIsAUserWithTheFollowing(TableNode $table) |
|
419 | + { |
|
420 | + $repo = $this->getUserRepository(); |
|
421 | + $data = $table->getRowsHash(); |
|
422 | + $email = isset($data['email']) ? $data['email']:'[email protected]'; |
|
423 | + $password = isset($data['password']) ? $data['password']:'test'; |
|
424 | + $fullname = isset($data['fullname']) ? $data['fullname']:'Test User'; |
|
425 | + $role = isset($data['role']) ? $data['role']:User::ROLE_RECRUITER; |
|
426 | 426 | |
427 | - if(!is_object($user=$repo->findByLogin($email))){ |
|
428 | - $user = $this->createUser($email,$password,$role,$fullname); |
|
429 | - } |
|
430 | - $this->currentUser = $user; |
|
431 | - $this->addCreatedUser($user); |
|
432 | - } |
|
427 | + if(!is_object($user=$repo->findByLogin($email))){ |
|
428 | + $user = $this->createUser($email,$password,$role,$fullname); |
|
429 | + } |
|
430 | + $this->currentUser = $user; |
|
431 | + $this->addCreatedUser($user); |
|
432 | + } |
|
433 | 433 | |
434 | - private function addCreatedUser(UserInterface $user) |
|
435 | - { |
|
436 | - if(!in_array($user,static::$users)){ |
|
437 | - static::$users[] = $user; |
|
438 | - } |
|
439 | - } |
|
434 | + private function addCreatedUser(UserInterface $user) |
|
435 | + { |
|
436 | + if(!in_array($user,static::$users)){ |
|
437 | + static::$users[] = $user; |
|
438 | + } |
|
439 | + } |
|
440 | 440 | |
441 | - /** |
|
442 | - * @When I want to change my password |
|
443 | - */ |
|
444 | - public function iWantToChangeMyPassword() |
|
445 | - { |
|
446 | - $url = $this->buildUrl('lang/my-password'); |
|
447 | - $this->visit($url); |
|
448 | - } |
|
441 | + /** |
|
442 | + * @When I want to change my password |
|
443 | + */ |
|
444 | + public function iWantToChangeMyPassword() |
|
445 | + { |
|
446 | + $url = $this->buildUrl('lang/my-password'); |
|
447 | + $this->visit($url); |
|
448 | + } |
|
449 | 449 | |
450 | 450 | /** |
451 | 451 | * @return User |
452 | 452 | * @throws FailedExpectationException |
453 | 453 | */ |
454 | - public function getCurrentUser() |
|
454 | + public function getCurrentUser() |
|
455 | 455 | { |
456 | 456 | if(!$this->currentUser instanceof User){ |
457 | 457 | throw new FailedExpectationException('Need to login first before use this step'); |
@@ -128,7 +128,6 @@ |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | - * @param ControllerManager $controllerManager |
|
132 | 131 | * @return CreatePaginator |
133 | 132 | * @codeCoverageIgnore |
134 | 133 | */ |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected $request; |
46 | 46 | |
47 | - /** |
|
48 | - * CreatePaginator constructor. |
|
49 | - * |
|
50 | - * @param ContainerInterface $container |
|
51 | - * @param HttpRequest $request |
|
52 | - */ |
|
47 | + /** |
|
48 | + * CreatePaginator constructor. |
|
49 | + * |
|
50 | + * @param ContainerInterface $container |
|
51 | + * @param HttpRequest $request |
|
52 | + */ |
|
53 | 53 | public function __construct(ContainerInterface $container, HttpRequest $request) |
54 | 54 | { |
55 | 55 | $this->serviceManager = $container->get('ServiceManager'); |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | /* @var \Core\EventManager\EventManager $events */ |
106 | 106 | /* @var \Zend\Paginator\Paginator $paginator */ |
107 | 107 | /* @var CreatePaginatorEvent $event */ |
108 | - $events = $this->serviceManager->get('Core/CreatePaginator/Events'); |
|
108 | + $events = $this->serviceManager->get('Core/CreatePaginator/Events'); |
|
109 | 109 | |
110 | - $event = $events->getEvent(CreatePaginatorEvent::EVENT_CREATE_PAGINATOR,$this,[ |
|
110 | + $event = $events->getEvent(CreatePaginatorEvent::EVENT_CREATE_PAGINATOR,$this,[ |
|
111 | 111 | 'paginatorParams' => $params, |
112 | 112 | 'paginators' => $paginators, |
113 | 113 | 'paginatorName' => $paginatorName |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | $paginator = $paginators->get($paginatorName,$params); |
122 | 122 | } |
123 | 123 | $paginator->setCurrentPageNumber(isset($params['page']) ? $params['page'] : 1) |
124 | - ->setItemCountPerPage(isset($params['count']) ? $params['count'] : 10) |
|
125 | - ->setPageRange(isset($params['range']) ? $params['range'] : 5); |
|
124 | + ->setItemCountPerPage(isset($params['count']) ? $params['count'] : 10) |
|
125 | + ->setPageRange(isset($params['range']) ? $params['range'] : 5); |
|
126 | 126 | |
127 | 127 | return $paginator; |
128 | 128 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | /* @var CreatePaginatorEvent $event */ |
108 | 108 | $events = $this->serviceManager->get('Core/CreatePaginator/Events'); |
109 | 109 | |
110 | - $event = $events->getEvent(CreatePaginatorEvent::EVENT_CREATE_PAGINATOR,$this,[ |
|
110 | + $event = $events->getEvent(CreatePaginatorEvent::EVENT_CREATE_PAGINATOR, $this, [ |
|
111 | 111 | 'paginatorParams' => $params, |
112 | 112 | 'paginators' => $paginators, |
113 | 113 | 'paginatorName' => $paginatorName |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | |
117 | 117 | $paginator = $event->getPaginator(); |
118 | 118 | |
119 | - if(!$paginator instanceof Paginator){ |
|
119 | + if (!$paginator instanceof Paginator) { |
|
120 | 120 | // no paginator created by listener, so let's create default paginator |
121 | - $paginator = $paginators->get($paginatorName,$params); |
|
121 | + $paginator = $paginators->get($paginatorName, $params); |
|
122 | 122 | } |
123 | 123 | $paginator->setCurrentPageNumber(isset($params['page']) ? $params['page'] : 1) |
124 | 124 | ->setItemCountPerPage(isset($params['count']) ? $params['count'] : 10) |
@@ -60,8 +60,8 @@ |
||
60 | 60 | * |
61 | 61 | * If no event instance is passed, it creates one prior to triggering. |
62 | 62 | * |
63 | - * @param EventInterface|string $eventName |
|
64 | - * @param object|string|null $target |
|
63 | + * @param EventInterface $eventName |
|
64 | + * @param \Core\Controller\AdminController $target |
|
65 | 65 | * @param array $argv |
66 | 66 | * |
67 | 67 | * @return \Zend\EventManager\ResponseCollection |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | return $event; |
56 | 56 | } |
57 | 57 | |
58 | - /** |
|
59 | - * Trigger an event. |
|
58 | + /** |
|
59 | + * Trigger an event. |
|
60 | 60 | * |
61 | 61 | * If no event instance is passed, it creates one prior to triggering. |
62 | 62 | * |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param array $argv |
66 | 66 | * |
67 | 67 | * @return \Zend\EventManager\ResponseCollection |
68 | - */ |
|
68 | + */ |
|
69 | 69 | public function trigger($eventName, $target = null, $argv = []) |
70 | 70 | { |
71 | 71 | $event = $eventName instanceOf EventInterface |