@@ -72,7 +72,7 @@ |
||
72 | 72 | $method = 'iSave'.$type; |
73 | 73 | if(method_exists($this,$method)){ |
74 | 74 | call_user_func([$this,$method]); |
75 | - }else{ |
|
75 | + } else{ |
|
76 | 76 | $locator = $this->elementMap[$type].'-buttons-submit'; |
77 | 77 | $this->coreContext->scrollIntoView($locator); |
78 | 78 | $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
@@ -15,112 +15,112 @@ |
||
15 | 15 | |
16 | 16 | class SummaryFormContext implements Context |
17 | 17 | { |
18 | - use CommonContextTrait; |
|
18 | + use CommonContextTrait; |
|
19 | 19 | |
20 | - private $elementMap = array( |
|
21 | - 'name' => '#sf-nameForm', |
|
22 | - 'location' => '#sf-locationForm', |
|
23 | - 'employees' => '#sf-employeesManagement', |
|
24 | - 'workflow' => '#sf-workflowSettings', |
|
25 | - 'jobTitleAndLocation' => '#general-locationForm', |
|
26 | - 'jobClassification' => '#sf-general-classifications', |
|
27 | - 'customerNote' => '#sf-general-customerNote', |
|
28 | - 'personalInformations' => '#sf-contact-contact', |
|
29 | - 'resumePersonalInformations' => '#sf-contact', |
|
30 | - ); |
|
20 | + private $elementMap = array( |
|
21 | + 'name' => '#sf-nameForm', |
|
22 | + 'location' => '#sf-locationForm', |
|
23 | + 'employees' => '#sf-employeesManagement', |
|
24 | + 'workflow' => '#sf-workflowSettings', |
|
25 | + 'jobTitleAndLocation' => '#general-locationForm', |
|
26 | + 'jobClassification' => '#sf-general-classifications', |
|
27 | + 'customerNote' => '#sf-general-customerNote', |
|
28 | + 'personalInformations' => '#sf-contact-contact', |
|
29 | + 'resumePersonalInformations' => '#sf-contact', |
|
30 | + ); |
|
31 | 31 | |
32 | - /** |
|
33 | - * @When I click edit on :name form |
|
34 | - * @TODO: [ZF3] move this method to CoreContext |
|
35 | - */ |
|
36 | - public function iClickEditOnForm($name) |
|
37 | - { |
|
38 | - $this->iClickForm($name); |
|
39 | - $name = Inflector::camelize($name); |
|
40 | - $type = $this->elementMap[$name]; |
|
41 | - $locator = $type.' .sf-summary .sf-controls button'; |
|
42 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
43 | - if(!$element){ |
|
44 | - throw new \Exception('No element found with this locator: "'.$locator.'"'); |
|
45 | - } |
|
46 | - $element->click(); |
|
47 | - } |
|
32 | + /** |
|
33 | + * @When I click edit on :name form |
|
34 | + * @TODO: [ZF3] move this method to CoreContext |
|
35 | + */ |
|
36 | + public function iClickEditOnForm($name) |
|
37 | + { |
|
38 | + $this->iClickForm($name); |
|
39 | + $name = Inflector::camelize($name); |
|
40 | + $type = $this->elementMap[$name]; |
|
41 | + $locator = $type.' .sf-summary .sf-controls button'; |
|
42 | + $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
43 | + if(!$element){ |
|
44 | + throw new \Exception('No element found with this locator: "'.$locator.'"'); |
|
45 | + } |
|
46 | + $element->click(); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @When I click :form form |
|
51 | - */ |
|
52 | - public function iClickForm($name) |
|
53 | - { |
|
54 | - $name = Inflector::camelize($name); |
|
55 | - $type = $this->elementMap[$name]; |
|
56 | - $locator = $type.' .sf-summary'; |
|
57 | - $session = $this->minkContext->getSession(); |
|
58 | - $script = <<<EOC |
|
49 | + /** |
|
50 | + * @When I click :form form |
|
51 | + */ |
|
52 | + public function iClickForm($name) |
|
53 | + { |
|
54 | + $name = Inflector::camelize($name); |
|
55 | + $type = $this->elementMap[$name]; |
|
56 | + $locator = $type.' .sf-summary'; |
|
57 | + $session = $this->minkContext->getSession(); |
|
58 | + $script = <<<EOC |
|
59 | 59 | var tElement = jQuery("$locator .sf-controls"); |
60 | 60 | tElement.css('display','block'); |
61 | 61 | tElement.css('visibility','visible'); |
62 | 62 | EOC; |
63 | - $session->executeScript($script); |
|
64 | - } |
|
63 | + $session->executeScript($script); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @When I save :type form |
|
68 | - */ |
|
69 | - public function iSaveForm($type) |
|
70 | - { |
|
71 | - $type = Inflector::camelize($type); |
|
72 | - $method = 'iSave'.$type; |
|
73 | - if(method_exists($this,$method)){ |
|
74 | - call_user_func([$this,$method]); |
|
75 | - }else{ |
|
76 | - $locator = $this->elementMap[$type].'-buttons-submit'; |
|
77 | - $this->coreContext->scrollIntoView($locator); |
|
78 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
79 | - $element->click(); |
|
80 | - } |
|
81 | - } |
|
66 | + /** |
|
67 | + * @When I save :type form |
|
68 | + */ |
|
69 | + public function iSaveForm($type) |
|
70 | + { |
|
71 | + $type = Inflector::camelize($type); |
|
72 | + $method = 'iSave'.$type; |
|
73 | + if(method_exists($this,$method)){ |
|
74 | + call_user_func([$this,$method]); |
|
75 | + }else{ |
|
76 | + $locator = $this->elementMap[$type].'-buttons-submit'; |
|
77 | + $this->coreContext->scrollIntoView($locator); |
|
78 | + $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
79 | + $element->click(); |
|
80 | + } |
|
81 | + } |
|
82 | 82 | |
83 | - public function iSaveOrganizationName() |
|
84 | - { |
|
85 | - $locator = '#nameForm-buttons-submit'; |
|
86 | - $this->coreContext->scrollIntoView($locator); |
|
87 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
88 | - $element->click(); |
|
89 | - } |
|
83 | + public function iSaveOrganizationName() |
|
84 | + { |
|
85 | + $locator = '#nameForm-buttons-submit'; |
|
86 | + $this->coreContext->scrollIntoView($locator); |
|
87 | + $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
88 | + $element->click(); |
|
89 | + } |
|
90 | 90 | |
91 | - /** |
|
92 | - * Saving organization workflow |
|
93 | - */ |
|
94 | - public function iSaveWorkflow() |
|
95 | - { |
|
96 | - $locator = '#workflowSettings-buttons-submit'; |
|
97 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
98 | - $element->click(); |
|
99 | - } |
|
91 | + /** |
|
92 | + * Saving organization workflow |
|
93 | + */ |
|
94 | + public function iSaveWorkflow() |
|
95 | + { |
|
96 | + $locator = '#workflowSettings-buttons-submit'; |
|
97 | + $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
98 | + $element->click(); |
|
99 | + } |
|
100 | 100 | |
101 | - public function iSaveOrganizationLocation() |
|
102 | - { |
|
103 | - $locator = '#locationForm-buttons-submit'; |
|
104 | - $this->coreContext->scrollIntoView($locator); |
|
105 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
106 | - $element->click(); |
|
107 | - } |
|
101 | + public function iSaveOrganizationLocation() |
|
102 | + { |
|
103 | + $locator = '#locationForm-buttons-submit'; |
|
104 | + $this->coreContext->scrollIntoView($locator); |
|
105 | + $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
106 | + $element->click(); |
|
107 | + } |
|
108 | 108 | |
109 | 109 | |
110 | - public function iSaveJobClassification() |
|
111 | - { |
|
112 | - $locator = '#general-classifications-buttons-submit'; |
|
113 | - $this->coreContext->scrollIntoView($locator); |
|
114 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
115 | - $element->click(); |
|
116 | - } |
|
110 | + public function iSaveJobClassification() |
|
111 | + { |
|
112 | + $locator = '#general-classifications-buttons-submit'; |
|
113 | + $this->coreContext->scrollIntoView($locator); |
|
114 | + $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
115 | + $element->click(); |
|
116 | + } |
|
117 | 117 | |
118 | - public function iSaveCustomerNote() |
|
119 | - { |
|
120 | - $locator = '#general-customerNote-buttons-submit'; |
|
121 | - $this->coreContext->scrollIntoView('#sf-general-customerNote'); |
|
122 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
123 | - $element->click(); |
|
124 | - } |
|
118 | + public function iSaveCustomerNote() |
|
119 | + { |
|
120 | + $locator = '#general-customerNote-buttons-submit'; |
|
121 | + $this->coreContext->scrollIntoView('#sf-general-customerNote'); |
|
122 | + $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
123 | + $element->click(); |
|
124 | + } |
|
125 | 125 | |
126 | 126 | } |
127 | 127 | \ No newline at end of file |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | $name = Inflector::camelize($name); |
40 | 40 | $type = $this->elementMap[$name]; |
41 | 41 | $locator = $type.' .sf-summary .sf-controls button'; |
42 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
43 | - if(!$element){ |
|
42 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
43 | + if (!$element) { |
|
44 | 44 | throw new \Exception('No element found with this locator: "'.$locator.'"'); |
45 | 45 | } |
46 | 46 | $element->click(); |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | { |
71 | 71 | $type = Inflector::camelize($type); |
72 | 72 | $method = 'iSave'.$type; |
73 | - if(method_exists($this,$method)){ |
|
74 | - call_user_func([$this,$method]); |
|
75 | - }else{ |
|
73 | + if (method_exists($this, $method)) { |
|
74 | + call_user_func([$this, $method]); |
|
75 | + } else { |
|
76 | 76 | $locator = $this->elementMap[$type].'-buttons-submit'; |
77 | 77 | $this->coreContext->scrollIntoView($locator); |
78 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
78 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
79 | 79 | $element->click(); |
80 | 80 | } |
81 | 81 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | $locator = '#nameForm-buttons-submit'; |
86 | 86 | $this->coreContext->scrollIntoView($locator); |
87 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
87 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
88 | 88 | $element->click(); |
89 | 89 | } |
90 | 90 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | public function iSaveWorkflow() |
95 | 95 | { |
96 | 96 | $locator = '#workflowSettings-buttons-submit'; |
97 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
97 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
98 | 98 | $element->click(); |
99 | 99 | } |
100 | 100 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | { |
103 | 103 | $locator = '#locationForm-buttons-submit'; |
104 | 104 | $this->coreContext->scrollIntoView($locator); |
105 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
105 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
106 | 106 | $element->click(); |
107 | 107 | } |
108 | 108 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | $locator = '#general-classifications-buttons-submit'; |
113 | 113 | $this->coreContext->scrollIntoView($locator); |
114 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
114 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
115 | 115 | $element->click(); |
116 | 116 | } |
117 | 117 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | { |
120 | 120 | $locator = '#general-customerNote-buttons-submit'; |
121 | 121 | $this->coreContext->scrollIntoView('#sf-general-customerNote'); |
122 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
122 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
123 | 123 | $element->click(); |
124 | 124 | } |
125 | 125 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $core = $scope->getEnvironment()->getContext(CoreContext::class); |
50 | 50 | /* @var FileTransport $transport */ |
51 | 51 | $transport = $core->getServiceManager()->get('Core/MailService')->getTransport(); |
52 | - $path = $transport->getOptions()->getPath() . '/*.eml'; |
|
52 | + $path = $transport->getOptions()->getPath().'/*.eml'; |
|
53 | 53 | foreach (glob($path) as $filename) { |
54 | 54 | unlink($filename); |
55 | 55 | } |
@@ -105,25 +105,25 @@ discard block |
||
105 | 105 | $regex = '/.*('.preg_quote($text).').*/im'; |
106 | 106 | $matches = []; |
107 | 107 | $multiMessages = false; |
108 | - if(count($this->messages) > 1){ |
|
108 | + if (count($this->messages) > 1) { |
|
109 | 109 | $multiMessages = true; |
110 | 110 | } |
111 | 111 | $content = ""; |
112 | - foreach($this->messages as $key=>$definition){ |
|
112 | + foreach ($this->messages as $key=>$definition) { |
|
113 | 113 | $content = $definition['contents']; |
114 | - if(preg_match($regex,$content,$match)){ |
|
114 | + if (preg_match($regex, $content, $match)) { |
|
115 | 115 | $matches[] = $match; |
116 | 116 | } |
117 | 117 | } |
118 | - $failMessage = sprintf('Can not find text "%s" in any email sent',$text); |
|
119 | - if(!$multiMessages){ |
|
118 | + $failMessage = sprintf('Can not find text "%s" in any email sent', $text); |
|
119 | + if (!$multiMessages) { |
|
120 | 120 | $failMessage = sprintf( |
121 | 121 | 'Can not find text "%s" in sent email. Here\'s the email content: %s', |
122 | 122 | $text, |
123 | 123 | PHP_EOL.PHP_EOL.$content |
124 | 124 | ); |
125 | 125 | } |
126 | - Assert::true(count($matches)>0,$failMessage); |
|
126 | + Assert::true(count($matches) > 0, $failMessage); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -136,16 +136,16 @@ discard block |
||
136 | 136 | |
137 | 137 | $path = $transport->getOptions()->getPath().'/*.eml'; |
138 | 138 | |
139 | - foreach(glob($path) as $filename){ |
|
139 | + foreach (glob($path) as $filename) { |
|
140 | 140 | $id = md5($filename); |
141 | - if(!isset($this->messages[$id])){ |
|
141 | + if (!isset($this->messages[$id])) { |
|
142 | 142 | $contents = file_get_contents($filename); |
143 | - $this->messages[$id] = $this->parseEmail($contents); |
|
143 | + $this->messages[$id] = $this->parseEmail($contents); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | 147 | Assert::true( |
148 | - count($this->messages)>0, |
|
148 | + count($this->messages) > 0, |
|
149 | 149 | 'No email have been sent' |
150 | 150 | ); |
151 | 151 | } |
@@ -153,33 +153,33 @@ discard block |
||
153 | 153 | private function parseEmail($contents) |
154 | 154 | { |
155 | 155 | $addresses = $this->parseEmailAddress($contents); |
156 | - $subject =$this->parseSubject($contents); |
|
156 | + $subject = $this->parseSubject($contents); |
|
157 | 157 | |
158 | 158 | $contents = strip_tags($contents); |
159 | 159 | $contents = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $contents); |
160 | 160 | |
161 | - return array_merge($addresses,$subject,['contents' => $contents]); |
|
161 | + return array_merge($addresses, $subject, ['contents' => $contents]); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | private function parseEmailAddress($contents) |
165 | 165 | { |
166 | 166 | // pattern to get email address |
167 | - $radd = '(\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b)'; |
|
167 | + $radd = '(\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b)'; |
|
168 | 168 | |
169 | 169 | // get email from address |
170 | - $regex = sprintf('/^From\:.*%s/im',$radd); |
|
171 | - $hasMatch = preg_match($regex,$contents,$matches); |
|
172 | - $fromAddress = $hasMatch ? $matches[1]:null; |
|
170 | + $regex = sprintf('/^From\:.*%s/im', $radd); |
|
171 | + $hasMatch = preg_match($regex, $contents, $matches); |
|
172 | + $fromAddress = $hasMatch ? $matches[1] : null; |
|
173 | 173 | |
174 | 174 | // get email to address |
175 | - $regex = sprintf('/^To\:\s+%s/im',$radd); |
|
176 | - $hasMatch = preg_match($regex,$contents,$matches); |
|
177 | - $toAddress1 = $hasMatch ? $matches[1]:null; |
|
175 | + $regex = sprintf('/^To\:\s+%s/im', $radd); |
|
176 | + $hasMatch = preg_match($regex, $contents, $matches); |
|
177 | + $toAddress1 = $hasMatch ? $matches[1] : null; |
|
178 | 178 | |
179 | 179 | // get email to address |
180 | - $regex = sprintf('/^To\:.*%s/im',$radd); |
|
181 | - $hasMatch = preg_match($regex,$contents,$matches); |
|
182 | - $toAddress2 = $hasMatch ? $matches[1]:null; |
|
180 | + $regex = sprintf('/^To\:.*%s/im', $radd); |
|
181 | + $hasMatch = preg_match($regex, $contents, $matches); |
|
182 | + $toAddress2 = $hasMatch ? $matches[1] : null; |
|
183 | 183 | |
184 | 184 | $this->fromMails[] = $fromAddress; |
185 | 185 | $this->toMails[] = $toAddress1; |
@@ -187,15 +187,15 @@ discard block |
||
187 | 187 | |
188 | 188 | return [ |
189 | 189 | 'from' => $fromAddress, |
190 | - 'to' => [$toAddress1,$toAddress2], |
|
190 | + 'to' => [$toAddress1, $toAddress2], |
|
191 | 191 | ]; |
192 | 192 | } |
193 | 193 | |
194 | 194 | private function parseSubject($contents) |
195 | 195 | { |
196 | 196 | $pattern = '/Subject\:(.*)/i'; |
197 | - preg_match($pattern,$contents,$matches); |
|
198 | - $subject = isset($matches[1]) ? $matches[1]:null; |
|
197 | + preg_match($pattern, $contents, $matches); |
|
198 | + $subject = isset($matches[1]) ? $matches[1] : null; |
|
199 | 199 | $this->subjects[] = $subject; |
200 | 200 | return [ |
201 | 201 | 'subject' => trim($subject) |
@@ -215,6 +215,9 @@ |
||
215 | 215 | $this->buildJob($status,$fields->getRowsHash()); |
216 | 216 | } |
217 | 217 | |
218 | + /** |
|
219 | + * @param \Organizations\Entity\Organization $organization |
|
220 | + */ |
|
218 | 221 | public function buildJob($status, $definitions,$organization = null) |
219 | 222 | { |
220 | 223 | $normalizedField = [ |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $element = $page->find('css',$mapMultiple[$field]); |
185 | 185 | if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){ |
186 | 186 | $this->minkContext->selectOption($value,$multipleField); |
187 | - }else{ |
|
187 | + } else{ |
|
188 | 188 | $locator = $mapSelect2[$field]; |
189 | 189 | $this->select2Context->iFillInSelect2Field($locator,$value); |
190 | 190 | } |
@@ -247,14 +247,14 @@ discard block |
||
247 | 247 | if($user instanceof User){ |
248 | 248 | $job->setUser($user); |
249 | 249 | $job->setOrganization($organization); |
250 | - }else{ |
|
250 | + } else{ |
|
251 | 251 | throw new \Exception('There is no user with this login:"'.$normalizedField['user'.'"']); |
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | 255 | if($status == 'draft'){ |
256 | 256 | $job->setIsDraft(true); |
257 | - }elseif($status == 'published'){ |
|
257 | + } elseif($status == 'published'){ |
|
258 | 258 | $job->setIsDraft(false); |
259 | 259 | $job->setDatePublishStart(new \DateTime()); |
260 | 260 | } |
@@ -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 | } |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | { |
59 | 59 | $repo = static::$jobRepo; |
60 | 60 | $results = $repo->findBy(['user' => $user]); |
61 | - foreach($results as $result){ |
|
62 | - $repo->remove($result,true); |
|
61 | + foreach ($results as $result) { |
|
62 | + $repo->remove($result, true); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | public function beforeScenario(BeforeScenarioScope $scope) |
72 | 72 | { |
73 | 73 | $this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class); |
74 | - if(is_null(static::$jobRepo)){ |
|
74 | + if (is_null(static::$jobRepo)) { |
|
75 | 75 | $this->gatherContexts($scope); |
76 | 76 | static::$jobRepo = $this->getJobRepository(); |
77 | 77 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function iGoToCreateJob() |
92 | 92 | { |
93 | - $url = $this->buildUrl('lang/jobs/manage',['action' => 'edit']); |
|
93 | + $url = $this->buildUrl('lang/jobs/manage', ['action' => 'edit']); |
|
94 | 94 | $this->visit($url); |
95 | 95 | } |
96 | 96 | |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | public function iGoToEditJobWithTitle($jobTitle) |
111 | 111 | { |
112 | 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)); |
|
113 | + if (!$job instanceof Job) { |
|
114 | + throw new \Exception(sprintf('Job with title "%s" is not found', $jobTitle)); |
|
115 | 115 | } |
116 | 116 | $this->currentJob = $job; |
117 | - $url = $this->buildUrl('lang/jobs/manage',[ |
|
117 | + $url = $this->buildUrl('lang/jobs/manage', [ |
|
118 | 118 | 'id' => $job->getId() |
119 | 119 | ]); |
120 | 120 | $this->visit($url); |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | |
141 | 141 | $jobRepository = $this->getJobRepository(); |
142 | 142 | $results = $jobRepository->getUserJobs($user->getId()); |
143 | - foreach($results as $job){ |
|
144 | - $jobRepository->remove($job,true); |
|
143 | + foreach ($results as $job) { |
|
144 | + $jobRepository->remove($job, true); |
|
145 | 145 | } |
146 | 146 | $this->currentJob = null; |
147 | 147 | } |
@@ -150,16 +150,16 @@ discard block |
||
150 | 150 | * @When I fill job location search with :search and choose :choice |
151 | 151 | * |
152 | 152 | */ |
153 | - public function iFillJobLocationAndChoose($search,$choice) |
|
153 | + public function iFillJobLocationAndChoose($search, $choice) |
|
154 | 154 | { |
155 | 155 | $select2 = $this->select2Context; |
156 | - $select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice); |
|
156 | + $select2->iFillInSelect2FieldWith('jobBase[geoLocation]', $search, $choice); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
160 | 160 | * @When I choose :value from :field |
161 | 161 | */ |
162 | - public function iJobClassificationSelect($value,$field) |
|
162 | + public function iJobClassificationSelect($value, $field) |
|
163 | 163 | { |
164 | 164 | $field = Inflector::camelize($field); |
165 | 165 | |
@@ -175,18 +175,18 @@ discard block |
||
175 | 175 | 'employmentTypes' => "select#classifications-employmentTypes", |
176 | 176 | ]; |
177 | 177 | |
178 | - if(!isset($mapSelect2[$field])){ |
|
178 | + if (!isset($mapSelect2[$field])) { |
|
179 | 179 | throw new \Exception('Undefined field selection value "'.$field.'"'); |
180 | 180 | } |
181 | 181 | |
182 | 182 | $multipleField = $mapMultiple[$field]; |
183 | 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{ |
|
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 | 188 | $locator = $mapSelect2[$field]; |
189 | - $this->select2Context->iFillInSelect2Field($locator,$value); |
|
189 | + $this->select2Context->iFillInSelect2Field($locator, $value); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -210,20 +210,20 @@ discard block |
||
210 | 210 | * @When I have a :status job with the following: |
211 | 211 | * @param TableNode $fields |
212 | 212 | */ |
213 | - public function iHaveAJobWithTheFollowing($status,TableNode $fields) |
|
213 | + public function iHaveAJobWithTheFollowing($status, TableNode $fields) |
|
214 | 214 | { |
215 | - $this->buildJob($status,$fields->getRowsHash()); |
|
215 | + $this->buildJob($status, $fields->getRowsHash()); |
|
216 | 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', |
222 | 222 | ]; |
223 | - foreach($definitions as $field => $value){ |
|
223 | + foreach ($definitions as $field => $value) { |
|
224 | 224 | $field = Inflector::camelize($field); |
225 | - if($field == 'professions' || $field == 'industries'){ |
|
226 | - $value = explode(',',$value); |
|
225 | + if ($field == 'professions' || $field == 'industries') { |
|
226 | + $value = explode(',', $value); |
|
227 | 227 | } |
228 | 228 | $normalizedField[$field] = $value; |
229 | 229 | } |
@@ -232,49 +232,49 @@ discard block |
||
232 | 232 | $job = $jobRepo->findOneBy([ |
233 | 233 | 'title' => $normalizedField['title'] |
234 | 234 | ]); |
235 | - if(!$job instanceof Job){ |
|
235 | + if (!$job instanceof Job) { |
|
236 | 236 | $job = new Job(); |
237 | 237 | $job->setTitle($normalizedField['title']); |
238 | 238 | } |
239 | 239 | |
240 | - if(isset($normalizedField['user'])){ |
|
240 | + if (isset($normalizedField['user'])) { |
|
241 | 241 | /* @var $userRepo UserRepository */ |
242 | 242 | $userRepo = $this->getRepository('Auth\Entity\User'); |
243 | 243 | $user = $userRepo->findOneBy(['login' => $normalizedField['user']]); |
244 | - if(is_null($organization)){ |
|
244 | + if (is_null($organization)) { |
|
245 | 245 | $organization = $user->getOrganization()->getOrganization(); |
246 | 246 | } |
247 | - if($user instanceof User){ |
|
247 | + if ($user instanceof User) { |
|
248 | 248 | $job->setUser($user); |
249 | 249 | $job->setOrganization($organization); |
250 | - }else{ |
|
250 | + } else { |
|
251 | 251 | throw new \Exception('There is no user with this login:"'.$normalizedField['user'.'"']); |
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | - if($status == 'draft'){ |
|
255 | + if ($status == 'draft') { |
|
256 | 256 | $job->setIsDraft(true); |
257 | - }elseif($status == 'published'){ |
|
257 | + }elseif ($status == 'published') { |
|
258 | 258 | $job->setIsDraft(false); |
259 | 259 | $job->setDatePublishStart(new \DateTime()); |
260 | 260 | } |
261 | 261 | $job->setStatus(Status::ACTIVE); |
262 | 262 | |
263 | - if(isset($normalizedField['location'])){ |
|
264 | - $this->setLocation($job,$normalizedField['location']); |
|
263 | + if (isset($normalizedField['location'])) { |
|
264 | + $this->setLocation($job, $normalizedField['location']); |
|
265 | 265 | } |
266 | - if(isset($normalizedField['professions'])){ |
|
267 | - $this->addProfessions($job,$normalizedField['professions']); |
|
266 | + if (isset($normalizedField['professions'])) { |
|
267 | + $this->addProfessions($job, $normalizedField['professions']); |
|
268 | 268 | } |
269 | 269 | |
270 | - if(isset($normalizedField['industries'])){ |
|
271 | - $this->addIndustries($job,$normalizedField['industries']); |
|
270 | + if (isset($normalizedField['industries'])) { |
|
271 | + $this->addIndustries($job, $normalizedField['industries']); |
|
272 | 272 | } |
273 | - if(isset($normalizedField['employmentTypes'])){ |
|
273 | + if (isset($normalizedField['employmentTypes'])) { |
|
274 | 274 | $types = $this->getCategories([$normalizedField['employmentTypes']]); |
275 | 275 | $type = array_shift($types); |
276 | 276 | $values = $job->getClassifications()->getEmploymentTypes()->getValues(); |
277 | - if(!is_array($values) || !in_array($type,$values)){ |
|
277 | + if (!is_array($values) || !in_array($type, $values)) { |
|
278 | 278 | $job->getClassifications()->getEmploymentTypes()->getItems()->add($type); |
279 | 279 | } |
280 | 280 | } |
@@ -294,18 +294,18 @@ discard block |
||
294 | 294 | $location->fromString($serialized); |
295 | 295 | |
296 | 296 | $locations = $job->getLocations(); |
297 | - if(count($locations)){ |
|
297 | + if (count($locations)) { |
|
298 | 298 | $locations->clear(); |
299 | 299 | } |
300 | 300 | $job->getLocations()->add($location); |
301 | 301 | } |
302 | 302 | |
303 | - private function addProfessions(Job &$job,$terms) |
|
303 | + private function addProfessions(Job &$job, $terms) |
|
304 | 304 | { |
305 | 305 | $professions = $this->getCategories($terms); |
306 | - foreach($professions as $profession){ |
|
306 | + foreach ($professions as $profession) { |
|
307 | 307 | $values = $job->getClassifications()->getProfessions()->getValues(); |
308 | - if(!is_array($values) || !in_array($profession,$values)){ |
|
308 | + if (!is_array($values) || !in_array($profession, $values)) { |
|
309 | 309 | $job->getClassifications()->getProfessions()->getItems()->add($profession); |
310 | 310 | } |
311 | 311 | } |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | private function addIndustries(Job &$job, $terms) |
315 | 315 | { |
316 | 316 | $industries = $this->getCategories($terms); |
317 | - foreach($industries as $industry){ |
|
317 | + foreach ($industries as $industry) { |
|
318 | 318 | $values = $job->getClassifications()->getIndustries()->getValues(); |
319 | - if(!is_array($values) || !in_array($industry,$values)){ |
|
319 | + if (!is_array($values) || !in_array($industry, $values)) { |
|
320 | 320 | $job->getClassifications()->getIndustries()->getItems()->add($industry); |
321 | 321 | } |
322 | 322 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | |
352 | 352 | $job = $repo->findDraft($user); |
353 | 353 | |
354 | - if(is_null($job)){ |
|
354 | + if (is_null($job)) { |
|
355 | 355 | $job = new Job(); |
356 | 356 | $job |
357 | 357 | ->setUser($user) |
@@ -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 | } |
@@ -51,16 +51,16 @@ |
||
51 | 51 | $this->summaryFormContext = $scope->getEnvironment()->getContext(SummaryFormContext::class); |
52 | 52 | } |
53 | 53 | |
54 | - public function buildUrl($name, array $params=array(), array $options=array()) |
|
54 | + public function buildUrl($name, array $params = array(), array $options = array()) |
|
55 | 55 | { |
56 | 56 | $defaults = ['lang'=>'en']; |
57 | - $params = array_merge($defaults,$params); |
|
57 | + $params = array_merge($defaults, $params); |
|
58 | 58 | /* @var Url $urlHelper */ |
59 | 59 | $urlHelper = $this |
60 | 60 | ->getService('ViewHelperManager') |
61 | 61 | ->get('url') |
62 | 62 | ; |
63 | - $url = $urlHelper($name,$params,$options); |
|
63 | + $url = $urlHelper($name, $params, $options); |
|
64 | 64 | |
65 | 65 | return $this->coreContext->generateUrl($url); |
66 | 66 | } |
@@ -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 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function iGoToEmailTemplatePage() |
33 | 33 | { |
34 | - $url = $this->buildUrl('lang/settings',[ |
|
34 | + $url = $this->buildUrl('lang/settings', [ |
|
35 | 35 | 'module' => 'Applications' |
36 | 36 | ]); |
37 | 37 | $this->visit($url); |
@@ -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 | } |
@@ -35,13 +35,13 @@ |
||
35 | 35 | /* @var $repo JobRepository */ |
36 | 36 | $repo = $this->getRepository('Jobs/Job'); |
37 | 37 | $job = $repo->findOneBy(['title' => $title]); |
38 | - if(!$job instanceof Job){ |
|
38 | + if (!$job instanceof Job) { |
|
39 | 39 | throw new \Exception('There is no job titled: "'.$title.'"'); |
40 | 40 | } |
41 | 41 | $job->setApplyId($job->getId()); |
42 | 42 | $repo->store($job); |
43 | 43 | |
44 | - $url = $this->buildUrl('lang/apply',[ |
|
44 | + $url = $this->buildUrl('lang/apply', [ |
|
45 | 45 | 'applyId' => $job->getApplyId() |
46 | 46 | ]); |
47 | 47 | $this->visit($url); |
@@ -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 | } |
@@ -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); |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | public function iHaveOrganization($name) |
104 | 104 | { |
105 | 105 | $user = $this->getUserContext()->getCurrentUser(); |
106 | - $organization = $this->findOrganizationByName($name,false); |
|
106 | + $organization = $this->findOrganizationByName($name, false); |
|
107 | 107 | $repo = $this->getRepository('Organizations/Organization'); |
108 | - if(!$organization instanceof Organization){ |
|
108 | + if (!$organization instanceof Organization) { |
|
109 | 109 | |
110 | 110 | $organization = new Organization(); |
111 | 111 | $organizationName = new OrganizationName($name); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $organization->setParent($parent); |
119 | 119 | $organization->setProfileSetting(Organization::PROFILE_ALWAYS_ENABLE); |
120 | 120 | $permissions = $organization->getPermissions(); |
121 | - $permissions->grant($user,Permissions::PERMISSION_ALL); |
|
121 | + $permissions->grant($user, Permissions::PERMISSION_ALL); |
|
122 | 122 | |
123 | 123 | $repo->store($organization); |
124 | 124 | $repo->getDocumentManager()->refresh($organization); |
@@ -128,19 +128,19 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * @Given organization :name have jobs: |
130 | 130 | */ |
131 | - public function organizationHavePublishedJob($name,TableNode $table) |
|
131 | + public function organizationHavePublishedJob($name, TableNode $table) |
|
132 | 132 | { |
133 | 133 | $user = $this->getUserContext()->getCurrentUser(); |
134 | - if(is_null($user)){ |
|
134 | + if (is_null($user)) { |
|
135 | 135 | throw new FailedExpectationException('Need to login first'); |
136 | 136 | } |
137 | 137 | |
138 | 138 | $organization = $this->findOrganizationByName($name); |
139 | - foreach($table->getColumnsHash() as $index=>$definitions){ |
|
139 | + foreach ($table->getColumnsHash() as $index=>$definitions) { |
|
140 | 140 | $definitions['user'] = $user->getLogin(); |
141 | - $status = isset($definitions['status']) ? $definitions['status']:'draft'; |
|
141 | + $status = isset($definitions['status']) ? $definitions['status'] : 'draft'; |
|
142 | 142 | unset($definitions['status']); |
143 | - $this->jobContext->buildJob($status,$definitions,$organization); |
|
143 | + $this->jobContext->buildJob($status, $definitions, $organization); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @param $name |
150 | 150 | * @param $setting |
151 | 151 | */ |
152 | - public function profileSetting($name,$setting) |
|
152 | + public function profileSetting($name, $setting) |
|
153 | 153 | { |
154 | 154 | $repo = $this->getRepository('Organizations/Organization'); |
155 | 155 | $organization = $this->findOrganizationByName($name); |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | $contact = $organization->getContact(); |
170 | 170 | |
171 | 171 | $definitions = $table->getRowsHash(); |
172 | - foreach($definitions as $name=>$value){ |
|
172 | + foreach ($definitions as $name=>$value) { |
|
173 | 173 | $field = Inflector::camelize($name); |
174 | 174 | $method = 'set'.$field; |
175 | - $callback = array($contact,$method); |
|
176 | - if(is_callable($callback)){ |
|
177 | - call_user_func_array($callback,[$value]); |
|
175 | + $callback = array($contact, $method); |
|
176 | + if (is_callable($callback)) { |
|
177 | + call_user_func_array($callback, [$value]); |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | $this->getRepository('Organizations/Organization')->store($organization); |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | * @param string $name |
187 | 187 | * @throws FailedExpectationException |
188 | 188 | */ |
189 | - public function iGoToOrganizationProfilePage($name=null) |
|
189 | + public function iGoToOrganizationProfilePage($name = null) |
|
190 | 190 | { |
191 | - if(is_null($name)){ |
|
191 | + if (is_null($name)) { |
|
192 | 192 | $organization = $this->getUserContext()->getCurrentUser()->getOrganization()->getOrganization(); |
193 | - }else{ |
|
193 | + } else { |
|
194 | 194 | $organization = $this->findOrganizationByName($name); |
195 | 195 | } |
196 | - $url = $this->buildUrl('lang/organizations/profileDetail',[ |
|
196 | + $url = $this->buildUrl('lang/organizations/profileDetail', [ |
|
197 | 197 | 'id' => $organization->getId() |
198 | 198 | ]); |
199 | 199 | |
@@ -210,10 +210,10 @@ discard block |
||
210 | 210 | /* @var OrganizationRepository $repo */ |
211 | 211 | $repo = $this->getRepository('Organizations/Organization'); |
212 | 212 | $result = $repo->findByName($name); |
213 | - $organization = count($result) > 0 ? $result[0]:null; |
|
214 | - if(!$organization instanceof Organization && $throwException){ |
|
213 | + $organization = count($result) > 0 ? $result[0] : null; |
|
214 | + if (!$organization instanceof Organization && $throwException) { |
|
215 | 215 | throw new FailedExpectationException( |
216 | - sprintf('Organization %s is not found.',$name) |
|
216 | + sprintf('Organization %s is not found.', $name) |
|
217 | 217 | ); |
218 | 218 | } |
219 | 219 | return $organization; |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | $jobRepo = $this->getRepository('Jobs/Job'); |
233 | 233 | $result = $jobRepo->findByOrganization($org->getId()); |
234 | 234 | |
235 | - foreach($result as $job){ |
|
236 | - $jobRepo->remove($job,true); |
|
235 | + foreach ($result as $job) { |
|
236 | + $jobRepo->remove($job, true); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | { |
245 | 245 | $user = $this->getUserContext()->getCurrentUser(); |
246 | 246 | $organization = $user->getOrganization()->getOrganization(); |
247 | - $url = $this->buildUrl('lang/organizations/edit',['id' => $organization->getId()]); |
|
247 | + $url = $this->buildUrl('lang/organizations/edit', ['id' => $organization->getId()]); |
|
248 | 248 | $this->visit($url); |
249 | 249 | } |
250 | 250 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | public function iAttachLogoFromFile($file) |
256 | 256 | { |
257 | 257 | $elementId = 'organizationLogo-original'; |
258 | - $this->minkContext->attachFileToField($elementId,$file); |
|
258 | + $this->minkContext->attachFileToField($elementId, $file); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | public function iRemoveLogoFromOrganization() |
265 | 265 | { |
266 | 266 | $elementId = '#organizationLogo-original-delete'; |
267 | - $element = $this->minkContext->getSession()->getPage()->find('css',$elementId); |
|
267 | + $element = $this->minkContext->getSession()->getPage()->find('css', $elementId); |
|
268 | 268 | $element->click(); |
269 | 269 | } |
270 | 270 | } |
@@ -190,7 +190,7 @@ |
||
190 | 190 | { |
191 | 191 | if(is_null($name)){ |
192 | 192 | $organization = $this->getUserContext()->getCurrentUser()->getOrganization()->getOrganization(); |
193 | - }else{ |
|
193 | + } else{ |
|
194 | 194 | $organization = $this->findOrganizationByName($name); |
195 | 195 | } |
196 | 196 | $url = $this->buildUrl('lang/organizations/profileDetail',[ |
@@ -80,9 +80,9 @@ |
||
80 | 80 | $repo->setEntityPrototype(new User()); |
81 | 81 | |
82 | 82 | $result = true; |
83 | - try{ |
|
83 | + try { |
|
84 | 84 | $repo->store($user); |
85 | - }catch (\Exception $e){ |
|
85 | + } catch (\Exception $e) { |
|
86 | 86 | throw $e; |
87 | 87 | } |
88 | 88 | return $result; |
@@ -82,7 +82,7 @@ |
||
82 | 82 | $result = true; |
83 | 83 | try{ |
84 | 84 | $repo->store($user); |
85 | - }catch (\Exception $e){ |
|
85 | + } catch (\Exception $e){ |
|
86 | 86 | throw $e; |
87 | 87 | } |
88 | 88 | return $result; |