@@ -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 |
@@ -18,43 +18,43 @@ discard block |
||
18 | 18 | |
19 | 19 | trait CommonContextTrait |
20 | 20 | { |
21 | - /** |
|
22 | - * @var MinkContext |
|
23 | - */ |
|
24 | - protected $minkContext; |
|
21 | + /** |
|
22 | + * @var MinkContext |
|
23 | + */ |
|
24 | + protected $minkContext; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var CoreContext |
|
28 | - */ |
|
29 | - protected $coreContext; |
|
26 | + /** |
|
27 | + * @var CoreContext |
|
28 | + */ |
|
29 | + protected $coreContext; |
|
30 | 30 | |
31 | - /** |
|
32 | - * @var UserContext |
|
33 | - */ |
|
34 | - protected $userContext; |
|
31 | + /** |
|
32 | + * @var UserContext |
|
33 | + */ |
|
34 | + protected $userContext; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @var SummaryFormContext |
|
38 | - */ |
|
39 | - protected $summaryFormContext; |
|
36 | + /** |
|
37 | + * @var SummaryFormContext |
|
38 | + */ |
|
39 | + protected $summaryFormContext; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @BeforeScenario |
|
43 | - * |
|
44 | - * @param BeforeScenarioScope $scope |
|
45 | - */ |
|
46 | - final public function gatherContexts(BeforeScenarioScope $scope) |
|
47 | - { |
|
48 | - $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
49 | - $this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class); |
|
50 | - $this->userContext = $scope->getEnvironment()->getContext(UserContext::class); |
|
51 | - $this->summaryFormContext = $scope->getEnvironment()->getContext(SummaryFormContext::class); |
|
52 | - } |
|
41 | + /** |
|
42 | + * @BeforeScenario |
|
43 | + * |
|
44 | + * @param BeforeScenarioScope $scope |
|
45 | + */ |
|
46 | + final public function gatherContexts(BeforeScenarioScope $scope) |
|
47 | + { |
|
48 | + $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
49 | + $this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class); |
|
50 | + $this->userContext = $scope->getEnvironment()->getContext(UserContext::class); |
|
51 | + $this->summaryFormContext = $scope->getEnvironment()->getContext(SummaryFormContext::class); |
|
52 | + } |
|
53 | 53 | |
54 | - public function buildUrl($name, array $params=array(), array $options=array()) |
|
55 | - { |
|
56 | - $defaults = ['lang'=>'en']; |
|
57 | - $params = array_merge($defaults,$params); |
|
54 | + public function buildUrl($name, array $params=array(), array $options=array()) |
|
55 | + { |
|
56 | + $defaults = ['lang'=>'en']; |
|
57 | + $params = array_merge($defaults,$params); |
|
58 | 58 | /* @var Url $urlHelper */ |
59 | 59 | $urlHelper = $this |
60 | 60 | ->getService('ViewHelperManager') |
@@ -63,36 +63,36 @@ discard block |
||
63 | 63 | $url = $urlHelper($name,$params,$options); |
64 | 64 | |
65 | 65 | return $this->coreContext->generateUrl($url); |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | - public function visit($url) |
|
69 | - { |
|
70 | - $this->coreContext->iVisit($url); |
|
71 | - } |
|
68 | + public function visit($url) |
|
69 | + { |
|
70 | + $this->coreContext->iVisit($url); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * @param $id |
|
75 | - * @return mixed|object |
|
76 | - */ |
|
77 | - public function getService($id) |
|
78 | - { |
|
79 | - return $this->coreContext->getServiceManager()->get($id); |
|
80 | - } |
|
73 | + /** |
|
74 | + * @param $id |
|
75 | + * @return mixed|object |
|
76 | + */ |
|
77 | + public function getService($id) |
|
78 | + { |
|
79 | + return $this->coreContext->getServiceManager()->get($id); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @param $id |
|
84 | - * |
|
85 | - * @return RepositoryInterface |
|
86 | - */ |
|
87 | - public function getRepository($id) |
|
88 | - { |
|
89 | - return $this->coreContext->getRepositories()->get($id); |
|
90 | - } |
|
82 | + /** |
|
83 | + * @param $id |
|
84 | + * |
|
85 | + * @return RepositoryInterface |
|
86 | + */ |
|
87 | + public function getRepository($id) |
|
88 | + { |
|
89 | + return $this->coreContext->getRepositories()->get($id); |
|
90 | + } |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * @return UserContext |
94 | 94 | */ |
95 | - public function getUserContext() |
|
95 | + public function getUserContext() |
|
96 | 96 | { |
97 | 97 | return $this->userContext; |
98 | 98 | } |
@@ -14,26 +14,26 @@ |
||
14 | 14 | |
15 | 15 | class SettingsContext implements Context |
16 | 16 | { |
17 | - use CommonContextTrait; |
|
17 | + use CommonContextTrait; |
|
18 | 18 | |
19 | - /** |
|
20 | - * @Given I go to settings page |
|
21 | - */ |
|
22 | - public function iGoToSettingsPage() |
|
23 | - { |
|
24 | - //$this->visit('/settings'); |
|
19 | + /** |
|
20 | + * @Given I go to settings page |
|
21 | + */ |
|
22 | + public function iGoToSettingsPage() |
|
23 | + { |
|
24 | + //$this->visit('/settings'); |
|
25 | 25 | $url = $this->buildUrl('lang/settings'); |
26 | 26 | $this->visit($url); |
27 | - } |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * @Given I go to email template settings page |
|
31 | - */ |
|
32 | - public function iGoToEmailTemplatePage() |
|
33 | - { |
|
34 | - $url = $this->buildUrl('lang/settings',[ |
|
35 | - 'module' => 'Applications' |
|
29 | + /** |
|
30 | + * @Given I go to email template settings page |
|
31 | + */ |
|
32 | + public function iGoToEmailTemplatePage() |
|
33 | + { |
|
34 | + $url = $this->buildUrl('lang/settings',[ |
|
35 | + 'module' => 'Applications' |
|
36 | 36 | ]); |
37 | - $this->visit($url); |
|
38 | - } |
|
37 | + $this->visit($url); |
|
38 | + } |
|
39 | 39 | } |
@@ -22,37 +22,37 @@ |
||
22 | 22 | */ |
23 | 23 | class ApplicationContext implements Context |
24 | 24 | { |
25 | - use CommonContextTrait; |
|
25 | + use CommonContextTrait; |
|
26 | 26 | |
27 | - /** |
|
28 | - * @Given I apply for :title job |
|
29 | - * |
|
30 | - * @param string $title |
|
31 | - * @throws \Exception when the titled job not exists |
|
32 | - */ |
|
33 | - public function iApplyAJob($title) |
|
34 | - { |
|
35 | - /* @var $repo JobRepository */ |
|
36 | - $repo = $this->getRepository('Jobs/Job'); |
|
37 | - $job = $repo->findOneBy(['title' => $title]); |
|
38 | - if(!$job instanceof Job){ |
|
39 | - throw new \Exception('There is no job titled: "'.$title.'"'); |
|
40 | - } |
|
41 | - $job->setApplyId($job->getId()); |
|
42 | - $repo->store($job); |
|
27 | + /** |
|
28 | + * @Given I apply for :title job |
|
29 | + * |
|
30 | + * @param string $title |
|
31 | + * @throws \Exception when the titled job not exists |
|
32 | + */ |
|
33 | + public function iApplyAJob($title) |
|
34 | + { |
|
35 | + /* @var $repo JobRepository */ |
|
36 | + $repo = $this->getRepository('Jobs/Job'); |
|
37 | + $job = $repo->findOneBy(['title' => $title]); |
|
38 | + if(!$job instanceof Job){ |
|
39 | + throw new \Exception('There is no job titled: "'.$title.'"'); |
|
40 | + } |
|
41 | + $job->setApplyId($job->getId()); |
|
42 | + $repo->store($job); |
|
43 | 43 | |
44 | - $url = $this->buildUrl('lang/apply',[ |
|
45 | - 'applyId' => $job->getApplyId() |
|
44 | + $url = $this->buildUrl('lang/apply',[ |
|
45 | + 'applyId' => $job->getApplyId() |
|
46 | 46 | ]); |
47 | - $this->visit($url); |
|
48 | - } |
|
47 | + $this->visit($url); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @Given I visit job categories |
|
52 | - */ |
|
53 | - public function visitJobsCategories() |
|
54 | - { |
|
55 | - $url = '/admin/jobs/categories'; |
|
56 | - $this->visit($url); |
|
57 | - } |
|
50 | + /** |
|
51 | + * @Given I visit job categories |
|
52 | + */ |
|
53 | + public function visitJobsCategories() |
|
54 | + { |
|
55 | + $url = '/admin/jobs/categories'; |
|
56 | + $this->visit($url); |
|
57 | + } |
|
58 | 58 | } |
@@ -22,23 +22,23 @@ |
||
22 | 22 | */ |
23 | 23 | class CvContext implements Context |
24 | 24 | { |
25 | - use CommonContextTrait; |
|
25 | + use CommonContextTrait; |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @Given I go to manage my resume page |
|
30 | - */ |
|
31 | - public function iGoToManageResumePage() |
|
32 | - { |
|
33 | - $url = $this->buildUrl('lang/my-cv'); |
|
34 | - $this->visit($url); |
|
35 | - } |
|
28 | + /** |
|
29 | + * @Given I go to manage my resume page |
|
30 | + */ |
|
31 | + public function iGoToManageResumePage() |
|
32 | + { |
|
33 | + $url = $this->buildUrl('lang/my-cv'); |
|
34 | + $this->visit($url); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * @When I click edit on my personal information |
|
39 | - */ |
|
40 | - public function iClickEditOnPersonalInformations() |
|
41 | - { |
|
42 | - $this->summaryFormContext->iClickEditOnForm('resumePersonalInformations'); |
|
43 | - } |
|
37 | + /** |
|
38 | + * @When I click edit on my personal information |
|
39 | + */ |
|
40 | + public function iClickEditOnPersonalInformations() |
|
41 | + { |
|
42 | + $this->summaryFormContext->iClickEditOnForm('resumePersonalInformations'); |
|
43 | + } |
|
44 | 44 | } |
@@ -34,188 +34,188 @@ discard block |
||
34 | 34 | */ |
35 | 35 | class JobContext implements Context |
36 | 36 | { |
37 | - use CommonContextTrait; |
|
37 | + use CommonContextTrait; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @var Select2Context |
|
41 | - */ |
|
42 | - private $select2Context; |
|
39 | + /** |
|
40 | + * @var Select2Context |
|
41 | + */ |
|
42 | + private $select2Context; |
|
43 | 43 | |
44 | - /** |
|
45 | - * @var Job |
|
46 | - */ |
|
47 | - private $currentJob; |
|
44 | + /** |
|
45 | + * @var Job |
|
46 | + */ |
|
47 | + private $currentJob; |
|
48 | 48 | |
49 | - /** |
|
50 | - * @var JobRepository |
|
51 | - */ |
|
52 | - static private $jobRepo; |
|
49 | + /** |
|
50 | + * @var JobRepository |
|
51 | + */ |
|
52 | + static private $jobRepo; |
|
53 | 53 | |
54 | - /** |
|
55 | - * @param User $user |
|
56 | - */ |
|
57 | - static public function removeJobByUser(User $user) |
|
58 | - { |
|
59 | - $repo = static::$jobRepo; |
|
60 | - $results = $repo->findBy(['user' => $user]); |
|
61 | - foreach($results as $result){ |
|
62 | - $repo->remove($result,true); |
|
63 | - } |
|
64 | - } |
|
54 | + /** |
|
55 | + * @param User $user |
|
56 | + */ |
|
57 | + static public function removeJobByUser(User $user) |
|
58 | + { |
|
59 | + $repo = static::$jobRepo; |
|
60 | + $results = $repo->findBy(['user' => $user]); |
|
61 | + foreach($results as $result){ |
|
62 | + $repo->remove($result,true); |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @BeforeScenario |
|
68 | - * |
|
69 | - * @param BeforeScenarioScope $scope |
|
70 | - */ |
|
71 | - public function beforeScenario(BeforeScenarioScope $scope) |
|
72 | - { |
|
73 | - $this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class); |
|
74 | - if(is_null(static::$jobRepo)){ |
|
75 | - $this->gatherContexts($scope); |
|
76 | - static::$jobRepo = $this->getJobRepository(); |
|
77 | - } |
|
78 | - } |
|
66 | + /** |
|
67 | + * @BeforeScenario |
|
68 | + * |
|
69 | + * @param BeforeScenarioScope $scope |
|
70 | + */ |
|
71 | + public function beforeScenario(BeforeScenarioScope $scope) |
|
72 | + { |
|
73 | + $this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class); |
|
74 | + if(is_null(static::$jobRepo)){ |
|
75 | + $this->gatherContexts($scope); |
|
76 | + static::$jobRepo = $this->getJobRepository(); |
|
77 | + } |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * @Given I go to job board page |
|
82 | - */ |
|
83 | - public function iGoToJobBoardPage() |
|
84 | - { |
|
85 | - $this->visit('/jobboard'); |
|
86 | - } |
|
80 | + /** |
|
81 | + * @Given I go to job board page |
|
82 | + */ |
|
83 | + public function iGoToJobBoardPage() |
|
84 | + { |
|
85 | + $this->visit('/jobboard'); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * @Given I go to create job page |
|
90 | - */ |
|
91 | - public function iGoToCreateJob() |
|
92 | - { |
|
93 | - $url = $this->buildUrl('lang/jobs/manage',['action' => 'edit']); |
|
94 | - $this->visit($url); |
|
95 | - } |
|
88 | + /** |
|
89 | + * @Given I go to create job page |
|
90 | + */ |
|
91 | + public function iGoToCreateJob() |
|
92 | + { |
|
93 | + $url = $this->buildUrl('lang/jobs/manage',['action' => 'edit']); |
|
94 | + $this->visit($url); |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * @Given I go to job overview page |
|
99 | - */ |
|
100 | - public function iGoToJobOverviewPage() |
|
101 | - { |
|
102 | - $this->visit('/jobs'); |
|
103 | - } |
|
97 | + /** |
|
98 | + * @Given I go to job overview page |
|
99 | + */ |
|
100 | + public function iGoToJobOverviewPage() |
|
101 | + { |
|
102 | + $this->visit('/jobs'); |
|
103 | + } |
|
104 | 104 | |
105 | - /** |
|
106 | - * @Given I go to edit job draft with title :jobTitle |
|
107 | - * @param $jobTitle |
|
108 | - * @throws \Exception when job is not found |
|
109 | - */ |
|
110 | - public function iGoToEditJobWithTitle($jobTitle) |
|
111 | - { |
|
112 | - $job = $this->getJobRepository()->findOneBy(['title' => $jobTitle]); |
|
113 | - if(!$job instanceof Job){ |
|
114 | - throw new \Exception(sprintf('Job with title "%s" is not found',$jobTitle)); |
|
115 | - } |
|
116 | - $this->currentJob = $job; |
|
117 | - $url = $this->buildUrl('lang/jobs/manage',[ |
|
118 | - 'id' => $job->getId() |
|
105 | + /** |
|
106 | + * @Given I go to edit job draft with title :jobTitle |
|
107 | + * @param $jobTitle |
|
108 | + * @throws \Exception when job is not found |
|
109 | + */ |
|
110 | + public function iGoToEditJobWithTitle($jobTitle) |
|
111 | + { |
|
112 | + $job = $this->getJobRepository()->findOneBy(['title' => $jobTitle]); |
|
113 | + if(!$job instanceof Job){ |
|
114 | + throw new \Exception(sprintf('Job with title "%s" is not found',$jobTitle)); |
|
115 | + } |
|
116 | + $this->currentJob = $job; |
|
117 | + $url = $this->buildUrl('lang/jobs/manage',[ |
|
118 | + 'id' => $job->getId() |
|
119 | 119 | ]); |
120 | - $this->visit($url); |
|
121 | - } |
|
120 | + $this->visit($url); |
|
121 | + } |
|
122 | 122 | |
123 | - /** |
|
124 | - * @Given I don't have any classification data |
|
125 | - */ |
|
126 | - public function iDonTHaveAnyClassificationData() |
|
127 | - { |
|
128 | - $this->currentJob->setClassifications(new Classifications()); |
|
129 | - $this->getJobRepository()->store($this->currentJob); |
|
130 | - } |
|
123 | + /** |
|
124 | + * @Given I don't have any classification data |
|
125 | + */ |
|
126 | + public function iDonTHaveAnyClassificationData() |
|
127 | + { |
|
128 | + $this->currentJob->setClassifications(new Classifications()); |
|
129 | + $this->getJobRepository()->store($this->currentJob); |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * @When I don't have any posted job |
|
134 | - */ |
|
135 | - public function iDonTHaveAnyPostedJob() |
|
136 | - { |
|
137 | - /* @var $jobRepository JobRepository */ |
|
138 | - /* @var $job Job */ |
|
139 | - $user = $this->getUserContext()->getCurrentUser(); |
|
132 | + /** |
|
133 | + * @When I don't have any posted job |
|
134 | + */ |
|
135 | + public function iDonTHaveAnyPostedJob() |
|
136 | + { |
|
137 | + /* @var $jobRepository JobRepository */ |
|
138 | + /* @var $job Job */ |
|
139 | + $user = $this->getUserContext()->getCurrentUser(); |
|
140 | 140 | |
141 | - $jobRepository = $this->getJobRepository(); |
|
142 | - $results = $jobRepository->getUserJobs($user->getId()); |
|
143 | - foreach($results as $job){ |
|
144 | - $jobRepository->remove($job,true); |
|
145 | - } |
|
146 | - $this->currentJob = null; |
|
147 | - } |
|
141 | + $jobRepository = $this->getJobRepository(); |
|
142 | + $results = $jobRepository->getUserJobs($user->getId()); |
|
143 | + foreach($results as $job){ |
|
144 | + $jobRepository->remove($job,true); |
|
145 | + } |
|
146 | + $this->currentJob = null; |
|
147 | + } |
|
148 | 148 | |
149 | - /** |
|
150 | - * @When I fill job location search with :search and choose :choice |
|
151 | - * |
|
152 | - */ |
|
153 | - public function iFillJobLocationAndChoose($search,$choice) |
|
154 | - { |
|
155 | - $select2 = $this->select2Context; |
|
156 | - $select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice); |
|
157 | - } |
|
149 | + /** |
|
150 | + * @When I fill job location search with :search and choose :choice |
|
151 | + * |
|
152 | + */ |
|
153 | + public function iFillJobLocationAndChoose($search,$choice) |
|
154 | + { |
|
155 | + $select2 = $this->select2Context; |
|
156 | + $select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice); |
|
157 | + } |
|
158 | 158 | |
159 | - /** |
|
160 | - * @When I choose :value from :field |
|
161 | - */ |
|
162 | - public function iJobClassificationSelect($value,$field) |
|
163 | - { |
|
164 | - $field = Inflector::camelize($field); |
|
159 | + /** |
|
160 | + * @When I choose :value from :field |
|
161 | + */ |
|
162 | + public function iJobClassificationSelect($value,$field) |
|
163 | + { |
|
164 | + $field = Inflector::camelize($field); |
|
165 | 165 | |
166 | - $mapSelect2 = [ |
|
167 | - 'professions' => '#classifications-professions-span .select2-container', |
|
168 | - 'industries' => '#classifications-industries-span .select2-container', |
|
169 | - 'employmentTypes' => '#classifications-employmentTypes-span .select2-container', |
|
170 | - ]; |
|
166 | + $mapSelect2 = [ |
|
167 | + 'professions' => '#classifications-professions-span .select2-container', |
|
168 | + 'industries' => '#classifications-industries-span .select2-container', |
|
169 | + 'employmentTypes' => '#classifications-employmentTypes-span .select2-container', |
|
170 | + ]; |
|
171 | 171 | |
172 | - $mapMultiple = [ |
|
173 | - 'professions' => "select#classifications-professions", |
|
174 | - 'industries' => "select#classifications-industries", |
|
175 | - 'employmentTypes' => "select#classifications-employmentTypes", |
|
176 | - ]; |
|
172 | + $mapMultiple = [ |
|
173 | + 'professions' => "select#classifications-professions", |
|
174 | + 'industries' => "select#classifications-industries", |
|
175 | + 'employmentTypes' => "select#classifications-employmentTypes", |
|
176 | + ]; |
|
177 | 177 | |
178 | - if(!isset($mapSelect2[$field])){ |
|
179 | - throw new \Exception('Undefined field selection value "'.$field.'"'); |
|
180 | - } |
|
178 | + if(!isset($mapSelect2[$field])){ |
|
179 | + throw new \Exception('Undefined field selection value "'.$field.'"'); |
|
180 | + } |
|
181 | 181 | |
182 | - $multipleField = $mapMultiple[$field]; |
|
183 | - $page = $this->minkContext->getSession()->getPage(); |
|
184 | - $element = $page->find('css',$mapMultiple[$field]); |
|
185 | - if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){ |
|
186 | - $this->minkContext->selectOption($value,$multipleField); |
|
187 | - }else{ |
|
188 | - $locator = $mapSelect2[$field]; |
|
189 | - $this->select2Context->iFillInSelect2Field($locator,$value); |
|
190 | - } |
|
191 | - } |
|
182 | + $multipleField = $mapMultiple[$field]; |
|
183 | + $page = $this->minkContext->getSession()->getPage(); |
|
184 | + $element = $page->find('css',$mapMultiple[$field]); |
|
185 | + if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){ |
|
186 | + $this->minkContext->selectOption($value,$multipleField); |
|
187 | + }else{ |
|
188 | + $locator = $mapSelect2[$field]; |
|
189 | + $this->select2Context->iFillInSelect2Field($locator,$value); |
|
190 | + } |
|
191 | + } |
|
192 | 192 | |
193 | - /** |
|
194 | - * @return JobRepository |
|
195 | - */ |
|
196 | - public function getJobRepository() |
|
197 | - { |
|
198 | - return $this->getRepository('Jobs/Job'); |
|
199 | - } |
|
193 | + /** |
|
194 | + * @return JobRepository |
|
195 | + */ |
|
196 | + public function getJobRepository() |
|
197 | + { |
|
198 | + return $this->getRepository('Jobs/Job'); |
|
199 | + } |
|
200 | 200 | |
201 | - /** |
|
202 | - * @return CategoriesRepo |
|
203 | - */ |
|
204 | - public function getCategoriesRepository() |
|
205 | - { |
|
206 | - return $this->getRepository('Jobs/Category'); |
|
207 | - } |
|
201 | + /** |
|
202 | + * @return CategoriesRepo |
|
203 | + */ |
|
204 | + public function getCategoriesRepository() |
|
205 | + { |
|
206 | + return $this->getRepository('Jobs/Category'); |
|
207 | + } |
|
208 | 208 | |
209 | - /** |
|
210 | - * @When I have a :status job with the following: |
|
211 | - * @param TableNode $fields |
|
212 | - */ |
|
213 | - public function iHaveAJobWithTheFollowing($status,TableNode $fields) |
|
214 | - { |
|
215 | - $this->buildJob($status,$fields->getRowsHash()); |
|
216 | - } |
|
209 | + /** |
|
210 | + * @When I have a :status job with the following: |
|
211 | + * @param TableNode $fields |
|
212 | + */ |
|
213 | + public function iHaveAJobWithTheFollowing($status,TableNode $fields) |
|
214 | + { |
|
215 | + $this->buildJob($status,$fields->getRowsHash()); |
|
216 | + } |
|
217 | 217 | |
218 | - public function buildJob($status, $definitions,$organization = null) |
|
218 | + public function buildJob($status, $definitions,$organization = null) |
|
219 | 219 | { |
220 | 220 | $normalizedField = [ |
221 | 221 | 'template' => 'modern', |
@@ -284,84 +284,84 @@ discard block |
||
284 | 284 | } |
285 | 285 | |
286 | 286 | |
287 | - private function setLocation(Job $job, $term) |
|
288 | - { |
|
289 | - /* @var $client Photon */ |
|
290 | - $client = $this->coreContext->getServiceManager()->get('Geo/Client'); |
|
291 | - $result = $client->queryOne($term); |
|
292 | - $location = new Location(); |
|
293 | - $serialized = Json::encode($result); |
|
294 | - $location->fromString($serialized); |
|
287 | + private function setLocation(Job $job, $term) |
|
288 | + { |
|
289 | + /* @var $client Photon */ |
|
290 | + $client = $this->coreContext->getServiceManager()->get('Geo/Client'); |
|
291 | + $result = $client->queryOne($term); |
|
292 | + $location = new Location(); |
|
293 | + $serialized = Json::encode($result); |
|
294 | + $location->fromString($serialized); |
|
295 | 295 | |
296 | - $locations = $job->getLocations(); |
|
297 | - if(count($locations)){ |
|
298 | - $locations->clear(); |
|
299 | - } |
|
300 | - $job->getLocations()->add($location); |
|
301 | - } |
|
296 | + $locations = $job->getLocations(); |
|
297 | + if(count($locations)){ |
|
298 | + $locations->clear(); |
|
299 | + } |
|
300 | + $job->getLocations()->add($location); |
|
301 | + } |
|
302 | 302 | |
303 | - private function addProfessions(Job &$job,$terms) |
|
304 | - { |
|
305 | - $professions = $this->getCategories($terms); |
|
306 | - foreach($professions as $profession){ |
|
307 | - $values = $job->getClassifications()->getProfessions()->getValues(); |
|
308 | - if(!is_array($values) || !in_array($profession,$values)){ |
|
309 | - $job->getClassifications()->getProfessions()->getItems()->add($profession); |
|
310 | - } |
|
311 | - } |
|
312 | - } |
|
303 | + private function addProfessions(Job &$job,$terms) |
|
304 | + { |
|
305 | + $professions = $this->getCategories($terms); |
|
306 | + foreach($professions as $profession){ |
|
307 | + $values = $job->getClassifications()->getProfessions()->getValues(); |
|
308 | + if(!is_array($values) || !in_array($profession,$values)){ |
|
309 | + $job->getClassifications()->getProfessions()->getItems()->add($profession); |
|
310 | + } |
|
311 | + } |
|
312 | + } |
|
313 | 313 | |
314 | - private function addIndustries(Job &$job, $terms) |
|
315 | - { |
|
316 | - $industries = $this->getCategories($terms); |
|
317 | - foreach($industries as $industry){ |
|
318 | - $values = $job->getClassifications()->getIndustries()->getValues(); |
|
319 | - if(!is_array($values) || !in_array($industry,$values)){ |
|
320 | - $job->getClassifications()->getIndustries()->getItems()->add($industry); |
|
321 | - } |
|
322 | - } |
|
323 | - } |
|
314 | + private function addIndustries(Job &$job, $terms) |
|
315 | + { |
|
316 | + $industries = $this->getCategories($terms); |
|
317 | + foreach($industries as $industry){ |
|
318 | + $values = $job->getClassifications()->getIndustries()->getValues(); |
|
319 | + if(!is_array($values) || !in_array($industry,$values)){ |
|
320 | + $job->getClassifications()->getIndustries()->getItems()->add($industry); |
|
321 | + } |
|
322 | + } |
|
323 | + } |
|
324 | 324 | |
325 | - /** |
|
326 | - * @param array $categories |
|
327 | - * |
|
328 | - * @return mixed |
|
329 | - */ |
|
330 | - private function getCategories(array $categories) |
|
331 | - { |
|
332 | - $catRepo = $this->getCategoriesRepository(); |
|
325 | + /** |
|
326 | + * @param array $categories |
|
327 | + * |
|
328 | + * @return mixed |
|
329 | + */ |
|
330 | + private function getCategories(array $categories) |
|
331 | + { |
|
332 | + $catRepo = $this->getCategoriesRepository(); |
|
333 | 333 | |
334 | - // get a professions |
|
335 | - $qb = $catRepo->createQueryBuilder() |
|
336 | - ->field('name')->in($categories) |
|
337 | - ->getQuery() |
|
338 | - ; |
|
339 | - $results = $qb->execute(); |
|
340 | - return $results->toArray(); |
|
341 | - } |
|
334 | + // get a professions |
|
335 | + $qb = $catRepo->createQueryBuilder() |
|
336 | + ->field('name')->in($categories) |
|
337 | + ->getQuery() |
|
338 | + ; |
|
339 | + $results = $qb->execute(); |
|
340 | + return $results->toArray(); |
|
341 | + } |
|
342 | 342 | |
343 | 343 | |
344 | - /** |
|
345 | - * @return Job |
|
346 | - */ |
|
347 | - private function getCurrentUserJobDraft($jobTitle) |
|
348 | - { |
|
349 | - $repo = $this->getJobRepository(); |
|
350 | - $user = $this->getCurrentUser(); |
|
344 | + /** |
|
345 | + * @return Job |
|
346 | + */ |
|
347 | + private function getCurrentUserJobDraft($jobTitle) |
|
348 | + { |
|
349 | + $repo = $this->getJobRepository(); |
|
350 | + $user = $this->getCurrentUser(); |
|
351 | 351 | |
352 | - $job = $repo->findDraft($user); |
|
352 | + $job = $repo->findDraft($user); |
|
353 | 353 | |
354 | - if(is_null($job)){ |
|
355 | - $job = new Job(); |
|
356 | - $job |
|
357 | - ->setUser($user) |
|
358 | - ->setOrganization($user->getOrganization()->getOrganization()) |
|
359 | - ->setStatus(StatusInterface::CREATED) |
|
360 | - ; |
|
361 | - $job->setIsDraft(true); |
|
362 | - } |
|
363 | - $job->setTitle($jobTitle); |
|
364 | - $repo->store($job); |
|
365 | - return $job; |
|
366 | - } |
|
354 | + if(is_null($job)){ |
|
355 | + $job = new Job(); |
|
356 | + $job |
|
357 | + ->setUser($user) |
|
358 | + ->setOrganization($user->getOrganization()->getOrganization()) |
|
359 | + ->setStatus(StatusInterface::CREATED) |
|
360 | + ; |
|
361 | + $job->setIsDraft(true); |
|
362 | + } |
|
363 | + $job->setTitle($jobTitle); |
|
364 | + $repo->store($job); |
|
365 | + return $job; |
|
366 | + } |
|
367 | 367 | } |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class OrganizationContext implements Context |
32 | 32 | { |
33 | - use CommonContextTrait; |
|
33 | + use CommonContextTrait; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @var JobContext |
37 | 37 | */ |
38 | - private $jobContext; |
|
38 | + private $jobContext; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * @BeforeScenario |
@@ -47,51 +47,51 @@ discard block |
||
47 | 47 | $this->jobContext = $scope->getEnvironment()->getContext(JobContext::class); |
48 | 48 | } |
49 | 49 | |
50 | - /** |
|
51 | - * @Given I go to my organization page |
|
52 | - */ |
|
53 | - public function iGoToMyOrganizationPage() |
|
54 | - { |
|
50 | + /** |
|
51 | + * @Given I go to my organization page |
|
52 | + */ |
|
53 | + public function iGoToMyOrganizationPage() |
|
54 | + { |
|
55 | 55 | $url = $this->buildUrl('lang/my-organization'); |
56 | - $this->visit($url); |
|
57 | - } |
|
56 | + $this->visit($url); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * @When I hover over name form |
|
61 | - */ |
|
62 | - public function iMouseOverOrganizationNameForm() |
|
63 | - { |
|
64 | - $locator = '#sf-nameForm .sf-summary'; |
|
65 | - $this->coreContext->iHoverOverTheElement($locator); |
|
66 | - } |
|
59 | + /** |
|
60 | + * @When I hover over name form |
|
61 | + */ |
|
62 | + public function iMouseOverOrganizationNameForm() |
|
63 | + { |
|
64 | + $locator = '#sf-nameForm .sf-summary'; |
|
65 | + $this->coreContext->iHoverOverTheElement($locator); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @Given I go to create new organization page |
|
70 | - */ |
|
71 | - public function iGoToCreateNewOrganizationPage() |
|
72 | - { |
|
73 | - //$this->visit('/organizations/edit'); |
|
68 | + /** |
|
69 | + * @Given I go to create new organization page |
|
70 | + */ |
|
71 | + public function iGoToCreateNewOrganizationPage() |
|
72 | + { |
|
73 | + //$this->visit('/organizations/edit'); |
|
74 | 74 | $url = $this->buildUrl('lang/organizations/edit'); |
75 | 75 | $this->visit($url); |
76 | - } |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @Given I go to organization overview page |
|
80 | - */ |
|
81 | - public function iGoToOrganizationOverviewPage() |
|
82 | - { |
|
83 | - //$this->visit('/organizations'); |
|
84 | - $url = $this->buildUrl('lang/organizations'); |
|
85 | - $this->visit($url); |
|
86 | - } |
|
78 | + /** |
|
79 | + * @Given I go to organization overview page |
|
80 | + */ |
|
81 | + public function iGoToOrganizationOverviewPage() |
|
82 | + { |
|
83 | + //$this->visit('/organizations'); |
|
84 | + $url = $this->buildUrl('lang/organizations'); |
|
85 | + $this->visit($url); |
|
86 | + } |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * @Given I want to see list organization profiles |
90 | 90 | */ |
91 | - public function iWantToSeeListOrganizationProfiles() |
|
91 | + public function iWantToSeeListOrganizationProfiles() |
|
92 | 92 | { |
93 | - $url = $this->buildUrl('lang/organizations/profile'); |
|
94 | - $this->visit($url); |
|
93 | + $url = $this->buildUrl('lang/organizations/profile'); |
|
94 | + $this->visit($url); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @internal param string $name |
101 | 101 | * @internal param TableNode|null $table |
102 | 102 | */ |
103 | - public function iHaveOrganization($name) |
|
103 | + public function iHaveOrganization($name) |
|
104 | 104 | { |
105 | 105 | $user = $this->getUserContext()->getCurrentUser(); |
106 | 106 | $organization = $this->findOrganizationByName($name,false); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | $LINKEDIN_APP_SECRET = getenv('LINKEDIN_APP_SECRET'); |
7 | 7 | |
8 | 8 | return array( |
9 | - 'hybridauth' => array( |
|
9 | + 'hybridauth' => array( |
|
10 | 10 | "Facebook" => array ( |
11 | 11 | "enabled" => true, |
12 | 12 | "keys" => array ( "id" => $FACEBOOK_APP_ID, "secret" => $FACEBOOK_APP_SECRET ), |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | "scope" => '' |
31 | 31 | ), |
32 | 32 | "Google" => array( |
33 | - // see http://hybridauth.sourceforge.net/userguide/IDProvider_info_Google.html |
|
34 | - "enabled" => false, |
|
35 | - 'keys' => array ( "id" => '###Your Google Client-ID ###', 'secret' => '###Your GitHub Secret###'), |
|
36 | - "scope" => "https://www.googleapis.com/auth/userinfo.profile ". // optional |
|
37 | - "https://www.googleapis.com/auth/userinfo.email" , // optional |
|
38 | - "access_type" => "offline", // optional |
|
39 | - "approval_prompt" => "force", // optional |
|
33 | + // see http://hybridauth.sourceforge.net/userguide/IDProvider_info_Google.html |
|
34 | + "enabled" => false, |
|
35 | + 'keys' => array ( "id" => '###Your Google Client-ID ###', 'secret' => '###Your GitHub Secret###'), |
|
36 | + "scope" => "https://www.googleapis.com/auth/userinfo.profile ". // optional |
|
37 | + "https://www.googleapis.com/auth/userinfo.email" , // optional |
|
38 | + "access_type" => "offline", // optional |
|
39 | + "approval_prompt" => "force", // optional |
|
40 | 40 | ), |
41 | 41 | |
42 | 42 | |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | ), |
48 | 48 | |
49 | 49 | 'Auth' => array( |
50 | - 'first_login' => array ( |
|
51 | - 'role' => '%%role%%', // role set on the first login. |
|
52 | - 'auth_suffix' => '%%auth.suffix%%', // an auth suffix is needed, if you plan to add external apps. |
|
53 | - ), |
|
54 | - // this allows an external application to use the YAWIK API |
|
55 | - // applications[USERPOSTFIX] => AppKey |
|
50 | + 'first_login' => array ( |
|
51 | + 'role' => '%%role%%', // role set on the first login. |
|
52 | + 'auth_suffix' => '%%auth.suffix%%', // an auth suffix is needed, if you plan to add external apps. |
|
53 | + ), |
|
54 | + // this allows an external application to use the YAWIK API |
|
55 | + // applications[USERPOSTFIX] => AppKey |
|
56 | 56 | 'external_applications' => array( |
57 | 57 | '%%external.app.prefix%%' => '%%external.app.key%%', |
58 | 58 | ), |
@@ -17,10 +17,10 @@ |
||
17 | 17 | class Module |
18 | 18 | { |
19 | 19 | /** |
20 | - * Loads module specific configuration. |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
20 | + * Loads module specific configuration. |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | 24 | public function getConfig() |
25 | 25 | { |
26 | 26 | return include __DIR__ . '/../config/module.config.php'; |