@@ -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) |
@@ -47,17 +47,17 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * Always enabled even if there are no active jobs |
49 | 49 | */ |
50 | - const PROFILE_ALWAYS_ENABLE = 'always'; |
|
50 | + const PROFILE_ALWAYS_ENABLE = 'always'; |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Hide if there are no jobs available |
54 | 54 | */ |
55 | - const PROFILE_ACTIVE_JOBS = 'active-jobs'; |
|
55 | + const PROFILE_ACTIVE_JOBS = 'active-jobs'; |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Always disabled profile |
59 | 59 | */ |
60 | - const PROFILE_DISABLED = 'disabled'; |
|
60 | + const PROFILE_DISABLED = 'disabled'; |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * Event name of post construct event. |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | */ |
286 | 286 | public function getParent($returnSelf = false) |
287 | 287 | { |
288 | - return $this->parent ? : ($returnSelf ? $this : null); |
|
288 | + return $this->parent ?: ($returnSelf ? $this : null); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | */ |
517 | 517 | public function getPermissionsResourceId() |
518 | 518 | { |
519 | - return 'organization:' . $this->getId(); |
|
519 | + return 'organization:'.$this->getId(); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | /** |
@@ -513,10 +513,10 @@ discard block |
||
513 | 513 | public function getLocation() |
514 | 514 | { |
515 | 515 | if (null === $this->location) { |
516 | - $array=[]; |
|
517 | - if(null != $this->locations){ |
|
516 | + $array = []; |
|
517 | + if (null != $this->locations) { |
|
518 | 518 | foreach ($this->locations as $location) { /* @var \Core\Entity\LocationInterface $location */ |
519 | - $array[]=$location->getCity(); |
|
519 | + $array[] = $location->getCity(); |
|
520 | 520 | } |
521 | 521 | return implode(', ', $array); |
522 | 522 | } |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | if ($removePermissions) { |
572 | 572 | $this->getPermissions()->revoke($this->user, Permissions::PERMISSION_ALL); |
573 | 573 | } |
574 | - $this->user=null; |
|
574 | + $this->user = null; |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | return $this; |
@@ -579,8 +579,8 @@ discard block |
||
579 | 579 | |
580 | 580 | public function unsetOrganization($removePermissions = true) |
581 | 581 | { |
582 | - if($this->organization && $removePermissions){ |
|
583 | - $this->getPermissions()->revoke($this->organization,Permissions::PERMISSION_ALL); |
|
582 | + if ($this->organization && $removePermissions) { |
|
583 | + $this->getPermissions()->revoke($this->organization, Permissions::PERMISSION_ALL); |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | $this->organization = null; |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | $organization = $this->organization; |
833 | 833 | if (is_object($organization) && $organization->getImage()) { |
834 | 834 | $organizationImage = $organization->getImage(); |
835 | - return "/file/Organizations.OrganizationImage/" . $organizationImage->getId(); |
|
835 | + return "/file/Organizations.OrganizationImage/".$organizationImage->getId(); |
|
836 | 836 | } |
837 | 837 | return $this->logoRef; |
838 | 838 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | protected $currentUser; |
65 | 65 | |
66 | - public function __construct($parameters=[]) |
|
66 | + public function __construct($parameters = []) |
|
67 | 67 | { |
68 | 68 | $defaultLoginInfo = [ |
69 | 69 | 'facebook' => [ |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | 'session_password-login' => getenv('LINKEDIN_USER_PASSWORD') |
76 | 76 | ], |
77 | 77 | ]; |
78 | - $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info']:[]; |
|
79 | - $this->socialLoginInfo = array_merge($defaultLoginInfo,$socialLoginConfig); |
|
78 | + $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info'] : []; |
|
79 | + $this->socialLoginInfo = array_merge($defaultLoginInfo, $socialLoginConfig); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'Auth\Entity\UserImage', |
99 | 99 | 'Organizations\Entity\OrganizationName', |
100 | 100 | ]; |
101 | - foreach($documents as $document){ |
|
101 | + foreach ($documents as $document) { |
|
102 | 102 | $dm->createQueryBuilder($document) |
103 | 103 | ->remove() |
104 | 104 | ->getQuery() |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | { |
127 | 127 | $provider = strtolower($provider); |
128 | 128 | $mink = $this->minkContext; |
129 | - foreach($this->socialLoginInfo[$provider] as $field=>$value){ |
|
130 | - $mink->fillField($field,$value); |
|
129 | + foreach ($this->socialLoginInfo[$provider] as $field=>$value) { |
|
130 | + $mink->fillField($field, $value); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | * @Given I am logged in as a recruiter |
136 | 136 | * @Given I am logged in as a recruiter with :organization as organization |
137 | 137 | */ |
138 | - public function iAmLoggedInAsARecruiter($organization=null) |
|
138 | + public function iAmLoggedInAsARecruiter($organization = null) |
|
139 | 139 | { |
140 | 140 | $user = $this->thereIsAUserIdentifiedBy( |
141 | 141 | '[email protected]', |
142 | - 'test',User::ROLE_RECRUITER, |
|
142 | + 'test', User::ROLE_RECRUITER, |
|
143 | 143 | 'Test Recruiter', |
144 | 144 | $organization |
145 | 145 | ); |
146 | - $this->startLogin($user,'test'); |
|
147 | - if(!is_null($organization)){ |
|
148 | - $this->iHaveMainOrganization($user,$organization); |
|
146 | + $this->startLogin($user, 'test'); |
|
147 | + if (!is_null($organization)) { |
|
148 | + $this->iHaveMainOrganization($user, $organization); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | public function iDonTHaveUser($login) |
157 | 157 | { |
158 | 158 | $repo = $this->getUserRepository(); |
159 | - $user=$repo->findByLogin($login); |
|
160 | - if($user instanceof UserInterface){ |
|
161 | - $repo->remove($user,true); |
|
159 | + $user = $repo->findByLogin($login); |
|
160 | + if ($user instanceof UserInterface) { |
|
161 | + $repo->remove($user, true); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param $role |
168 | 168 | * @param TableNode $fields |
169 | 169 | */ |
170 | - public function iHaveUserWithTheFollowing($role,TableNode $fields) |
|
170 | + public function iHaveUserWithTheFollowing($role, TableNode $fields) |
|
171 | 171 | { |
172 | 172 | $normalizedFields = [ |
173 | 173 | 'login' => '[email protected]', |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | 'password' => 'test', |
177 | 177 | 'organization' => 'Cross Solution' |
178 | 178 | ]; |
179 | - foreach($fields->getRowsHash() as $field=>$value){ |
|
179 | + foreach ($fields->getRowsHash() as $field=>$value) { |
|
180 | 180 | $field = Inflector::camelize($field); |
181 | 181 | $normalizedFields[$field] = $value; |
182 | 182 | } |
@@ -196,14 +196,14 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function iAmLoggedInAsAnAdmin() |
198 | 198 | { |
199 | - $user = $this->thereIsAUserIdentifiedBy('[email protected]','test',User::ROLE_ADMIN); |
|
200 | - $this->startLogin($user,'test'); |
|
199 | + $user = $this->thereIsAUserIdentifiedBy('[email protected]', 'test', User::ROLE_ADMIN); |
|
200 | + $this->startLogin($user, 'test'); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | private function startLogin(UserInterface $user, $password) |
204 | 204 | { |
205 | 205 | $currentUser = $this->currentUser; |
206 | - if(!is_object($currentUser) || $user->getId()!=$currentUser->getId()){ |
|
206 | + if (!is_object($currentUser) || $user->getId() != $currentUser->getId()) { |
|
207 | 207 | $this->iWantToLogIn(); |
208 | 208 | $this->iSpecifyTheUsernameAs($user->getLogin()); |
209 | 209 | $this->iSpecifyThePasswordAs($password); |
@@ -223,15 +223,15 @@ discard block |
||
223 | 223 | /** |
224 | 224 | * @Given there is a user :email identified by :password |
225 | 225 | */ |
226 | - public function thereIsAUserIdentifiedBy($email, $password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter",$organization=null) |
|
226 | + public function thereIsAUserIdentifiedBy($email, $password, $role = User::ROLE_RECRUITER, $fullname = "Test Recruiter", $organization = null) |
|
227 | 227 | { |
228 | 228 | $repo = $this->getUserRepository(); |
229 | - if(!is_object($user=$repo->findByEmail($email))){ |
|
230 | - $user = $this->createUser($email,$password,$role,$fullname,$organization); |
|
229 | + if (!is_object($user = $repo->findByEmail($email))) { |
|
230 | + $user = $this->createUser($email, $password, $role, $fullname, $organization); |
|
231 | 231 | } |
232 | 232 | |
233 | - if(!is_null($organization)){ |
|
234 | - $this->iHaveMainOrganization($user,$organization); |
|
233 | + if (!is_null($organization)) { |
|
234 | + $this->iHaveMainOrganization($user, $organization); |
|
235 | 235 | } |
236 | 236 | $this->addCreatedUser($user); |
237 | 237 | $repo->getDocumentManager()->refresh($user); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @return \Auth\Entity\UserInterface |
249 | 249 | */ |
250 | - public function createUser($email,$password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter") |
|
250 | + public function createUser($email, $password, $role = User::ROLE_RECRUITER, $fullname = "Test Recruiter") |
|
251 | 251 | { |
252 | 252 | /* @var Register $service */ |
253 | 253 | /* @var User $user */ |
@@ -258,10 +258,10 @@ discard block |
||
258 | 258 | $user->setRole($role); |
259 | 259 | $settings = $user->getSettings('Applications'); |
260 | 260 | |
261 | - $expFullName = explode(' ',$fullname); |
|
261 | + $expFullName = explode(' ', $fullname); |
|
262 | 262 | $info = $user->getInfo(); |
263 | 263 | $info->setFirstName(array_shift($expFullName)); |
264 | - $info->setLastName(count($expFullName)>0 ? implode(' ',$expFullName):''); |
|
264 | + $info->setLastName(count($expFullName) > 0 ? implode(' ', $expFullName) : ''); |
|
265 | 265 | $info->setEmail($email); |
266 | 266 | $info->setEmailVerified(true); |
267 | 267 | $repo->store($user); |
@@ -286,20 +286,20 @@ discard block |
||
286 | 286 | * @When I have :organization as my main organization |
287 | 287 | * @param $orgName |
288 | 288 | */ |
289 | - public function iHaveMainOrganization(UserInterface $user,$orgName) |
|
289 | + public function iHaveMainOrganization(UserInterface $user, $orgName) |
|
290 | 290 | { |
291 | 291 | /* @var $repoOrganization OrganizationRepository */ |
292 | 292 | $repoOrganization = $this->coreContext->getRepositories()->get('Organizations/Organization'); |
293 | 293 | $result = $repoOrganization->findByName($orgName); |
294 | - $organization = count($result) > 0 ? $result[0]:null; |
|
295 | - if(!$organization instanceof Organization){ |
|
294 | + $organization = count($result) > 0 ? $result[0] : null; |
|
295 | + if (!$organization instanceof Organization) { |
|
296 | 296 | $organization = new Organization(); |
297 | 297 | $organizationName = new OrganizationName($orgName); |
298 | 298 | $organization->setOrganizationName($organizationName); |
299 | 299 | } |
300 | 300 | $organization->setProfileSetting(Organization::PROFILE_ALWAYS_ENABLE); |
301 | 301 | $permissions = $organization->getPermissions(); |
302 | - $permissions->grant($user,Permissions::PERMISSION_ALL); |
|
302 | + $permissions->grant($user, Permissions::PERMISSION_ALL); |
|
303 | 303 | |
304 | 304 | $organization->setUser($user); |
305 | 305 | $repoOrganization->store($organization); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | */ |
333 | 333 | public function iSpecifyTheUsernameAs($username) |
334 | 334 | { |
335 | - $this->minkContext->fillField('Login name',$username); |
|
335 | + $this->minkContext->fillField('Login name', $username); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function iSpecifyThePasswordAs($password) |
342 | 342 | { |
343 | - $this->minkContext->fillField('Password',$password); |
|
343 | + $this->minkContext->fillField('Password', $password); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | $repo = $this->getUserRepository(); |
352 | 352 | $user = $repo->findByLogin($username); |
353 | 353 | |
354 | - if(!$user instanceof User){ |
|
355 | - throw new \Exception(sprintf('There is no user with this login: "%s"',$username)); |
|
354 | + if (!$user instanceof User) { |
|
355 | + throw new \Exception(sprintf('There is no user with this login: "%s"', $username)); |
|
356 | 356 | } |
357 | 357 | $this->iWantToLogIn(); |
358 | 358 | $this->iSpecifyTheUsernameAs($username); |
@@ -408,13 +408,13 @@ discard block |
||
408 | 408 | { |
409 | 409 | $repo = $this->getUserRepository(); |
410 | 410 | $data = $table->getRowsHash(); |
411 | - $email = isset($data['email']) ? $data['email']:'[email protected]'; |
|
412 | - $password = isset($data['password']) ? $data['password']:'test'; |
|
413 | - $fullname = isset($data['fullname']) ? $data['fullname']:'Test User'; |
|
414 | - $role = isset($data['role']) ? $data['role']:User::ROLE_RECRUITER; |
|
411 | + $email = isset($data['email']) ? $data['email'] : '[email protected]'; |
|
412 | + $password = isset($data['password']) ? $data['password'] : 'test'; |
|
413 | + $fullname = isset($data['fullname']) ? $data['fullname'] : 'Test User'; |
|
414 | + $role = isset($data['role']) ? $data['role'] : User::ROLE_RECRUITER; |
|
415 | 415 | |
416 | - if(!is_object($user=$repo->findByLogin($email))){ |
|
417 | - $user = $this->createUser($email,$password,$role,$fullname); |
|
416 | + if (!is_object($user = $repo->findByLogin($email))) { |
|
417 | + $user = $this->createUser($email, $password, $role, $fullname); |
|
418 | 418 | } |
419 | 419 | $this->currentUser = $user; |
420 | 420 | $this->addCreatedUser($user); |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | |
423 | 423 | private function addCreatedUser(UserInterface $user) |
424 | 424 | { |
425 | - if(!in_array($user,static::$users)){ |
|
425 | + if (!in_array($user, static::$users)) { |
|
426 | 426 | static::$users[] = $user; |
427 | 427 | } |
428 | 428 | } |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | */ |
443 | 443 | public function getCurrentUser() |
444 | 444 | { |
445 | - if(!$this->currentUser instanceof User){ |
|
445 | + if (!$this->currentUser instanceof User) { |
|
446 | 446 | throw new FailedExpectationException('Need to login first before use this step'); |
447 | 447 | } |
448 | 448 | return $this->currentUser; |
@@ -31,60 +31,60 @@ discard block |
||
31 | 31 | { |
32 | 32 | use CommonContextTrait; |
33 | 33 | |
34 | - /** |
|
35 | - * @var User[] |
|
36 | - */ |
|
37 | - static private $users = []; |
|
34 | + /** |
|
35 | + * @var User[] |
|
36 | + */ |
|
37 | + static private $users = []; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @var UserRepository |
|
41 | - */ |
|
42 | - static private $userRepo; |
|
39 | + /** |
|
40 | + * @var UserRepository |
|
41 | + */ |
|
42 | + static private $userRepo; |
|
43 | 43 | |
44 | - private $socialLoginInfo = []; |
|
44 | + private $socialLoginInfo = []; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @var DocumentManager |
48 | 48 | */ |
49 | - static private $dm; |
|
49 | + static private $dm; |
|
50 | 50 | |
51 | - /** |
|
52 | - * @var UserInterface |
|
53 | - */ |
|
54 | - private $loggedInUser; |
|
51 | + /** |
|
52 | + * @var UserInterface |
|
53 | + */ |
|
54 | + private $loggedInUser; |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * @var Organization |
58 | 58 | */ |
59 | - private $mainOrganization; |
|
59 | + private $mainOrganization; |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @var User |
63 | 63 | */ |
64 | 64 | protected $currentUser; |
65 | 65 | |
66 | - public function __construct($parameters=[]) |
|
67 | - { |
|
68 | - $defaultLoginInfo = [ |
|
69 | - 'facebook' => [ |
|
70 | - 'email' => getenv('FACEBOOK_USER_EMAIL'), |
|
71 | - 'pass' => getenv('FACEBOOK_USER_PASSWORD') |
|
72 | - ], |
|
73 | - 'linkedin' => [ |
|
74 | - 'session_key-login' => getenv('LINKEDIN_USER_EMAIL'), |
|
75 | - 'session_password-login' => getenv('LINKEDIN_USER_PASSWORD') |
|
76 | - ], |
|
77 | - ]; |
|
78 | - $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info']:[]; |
|
79 | - $this->socialLoginInfo = array_merge($defaultLoginInfo,$socialLoginConfig); |
|
80 | - } |
|
66 | + public function __construct($parameters=[]) |
|
67 | + { |
|
68 | + $defaultLoginInfo = [ |
|
69 | + 'facebook' => [ |
|
70 | + 'email' => getenv('FACEBOOK_USER_EMAIL'), |
|
71 | + 'pass' => getenv('FACEBOOK_USER_PASSWORD') |
|
72 | + ], |
|
73 | + 'linkedin' => [ |
|
74 | + 'session_key-login' => getenv('LINKEDIN_USER_EMAIL'), |
|
75 | + 'session_password-login' => getenv('LINKEDIN_USER_PASSWORD') |
|
76 | + ], |
|
77 | + ]; |
|
78 | + $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info']:[]; |
|
79 | + $this->socialLoginInfo = array_merge($defaultLoginInfo,$socialLoginConfig); |
|
80 | + } |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Empty all data every each tests |
84 | 84 | * |
85 | 85 | * @AfterSuite |
86 | 86 | */ |
87 | - static public function tearDown() |
|
87 | + static public function tearDown() |
|
88 | 88 | { |
89 | 89 | $dm = static::$dm; |
90 | 90 | |
@@ -107,47 +107,47 @@ discard block |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | - /** |
|
111 | - * @BeforeScenario |
|
112 | - * @param BeforeScenarioScope $scope |
|
113 | - */ |
|
114 | - public function beforeScenario(BeforeScenarioScope $scope) |
|
115 | - { |
|
116 | - $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
117 | - $this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class); |
|
118 | - static::$userRepo = $this->getUserRepository(); |
|
119 | - static::$dm = $this->getUserRepository()->getDocumentManager(); |
|
120 | - } |
|
110 | + /** |
|
111 | + * @BeforeScenario |
|
112 | + * @param BeforeScenarioScope $scope |
|
113 | + */ |
|
114 | + public function beforeScenario(BeforeScenarioScope $scope) |
|
115 | + { |
|
116 | + $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
117 | + $this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class); |
|
118 | + static::$userRepo = $this->getUserRepository(); |
|
119 | + static::$dm = $this->getUserRepository()->getDocumentManager(); |
|
120 | + } |
|
121 | 121 | |
122 | - /** |
|
123 | - * @When I fill in login form with :provider user |
|
124 | - */ |
|
125 | - public function iSignInWithSocialUser($provider) |
|
126 | - { |
|
127 | - $provider = strtolower($provider); |
|
128 | - $mink = $this->minkContext; |
|
129 | - foreach($this->socialLoginInfo[$provider] as $field=>$value){ |
|
130 | - $mink->fillField($field,$value); |
|
131 | - } |
|
132 | - } |
|
122 | + /** |
|
123 | + * @When I fill in login form with :provider user |
|
124 | + */ |
|
125 | + public function iSignInWithSocialUser($provider) |
|
126 | + { |
|
127 | + $provider = strtolower($provider); |
|
128 | + $mink = $this->minkContext; |
|
129 | + foreach($this->socialLoginInfo[$provider] as $field=>$value){ |
|
130 | + $mink->fillField($field,$value); |
|
131 | + } |
|
132 | + } |
|
133 | 133 | |
134 | - /** |
|
135 | - * @Given I am logged in as a recruiter |
|
136 | - * @Given I am logged in as a recruiter with :organization as organization |
|
137 | - */ |
|
138 | - public function iAmLoggedInAsARecruiter($organization=null) |
|
139 | - { |
|
140 | - $user = $this->thereIsAUserIdentifiedBy( |
|
141 | - '[email protected]', |
|
142 | - 'test',User::ROLE_RECRUITER, |
|
143 | - 'Test Recruiter', |
|
144 | - $organization |
|
145 | - ); |
|
146 | - $this->startLogin($user,'test'); |
|
147 | - if(!is_null($organization)){ |
|
134 | + /** |
|
135 | + * @Given I am logged in as a recruiter |
|
136 | + * @Given I am logged in as a recruiter with :organization as organization |
|
137 | + */ |
|
138 | + public function iAmLoggedInAsARecruiter($organization=null) |
|
139 | + { |
|
140 | + $user = $this->thereIsAUserIdentifiedBy( |
|
141 | + '[email protected]', |
|
142 | + 'test',User::ROLE_RECRUITER, |
|
143 | + 'Test Recruiter', |
|
144 | + $organization |
|
145 | + ); |
|
146 | + $this->startLogin($user,'test'); |
|
147 | + if(!is_null($organization)){ |
|
148 | 148 | $this->iHaveMainOrganization($user,$organization); |
149 | 149 | } |
150 | - } |
|
150 | + } |
|
151 | 151 | |
152 | 152 | /** |
153 | 153 | * @Given I am logged out |
@@ -159,156 +159,156 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | |
162 | - /** |
|
163 | - * @Given I don't have :login user |
|
164 | - * @param string $login |
|
165 | - */ |
|
166 | - public function iDonTHaveUser($login) |
|
167 | - { |
|
168 | - $repo = $this->getUserRepository(); |
|
169 | - $user=$repo->findByLogin($login); |
|
170 | - if($user instanceof UserInterface){ |
|
171 | - $repo->remove($user,true); |
|
172 | - } |
|
173 | - } |
|
162 | + /** |
|
163 | + * @Given I don't have :login user |
|
164 | + * @param string $login |
|
165 | + */ |
|
166 | + public function iDonTHaveUser($login) |
|
167 | + { |
|
168 | + $repo = $this->getUserRepository(); |
|
169 | + $user=$repo->findByLogin($login); |
|
170 | + if($user instanceof UserInterface){ |
|
171 | + $repo->remove($user,true); |
|
172 | + } |
|
173 | + } |
|
174 | 174 | |
175 | - /** |
|
176 | - * @Given I have a :role with the following: |
|
175 | + /** |
|
176 | + * @Given I have a :role with the following: |
|
177 | 177 | * @Given I have an :role with the following: |
178 | 178 | * |
179 | - * @param $role |
|
180 | - * @param TableNode $fields |
|
181 | - */ |
|
182 | - public function iHaveUserWithTheFollowing($role,TableNode $fields) |
|
183 | - { |
|
184 | - $normalizedFields = [ |
|
185 | - 'login' => '[email protected]', |
|
186 | - 'fullName' => 'Test Login', |
|
187 | - 'role' => $role, |
|
188 | - 'password' => 'test', |
|
189 | - 'organization' => 'Cross Solution' |
|
190 | - ]; |
|
191 | - foreach($fields->getRowsHash() as $field=>$value){ |
|
192 | - $field = Inflector::camelize($field); |
|
193 | - $normalizedFields[$field] = $value; |
|
194 | - } |
|
179 | + * @param $role |
|
180 | + * @param TableNode $fields |
|
181 | + */ |
|
182 | + public function iHaveUserWithTheFollowing($role,TableNode $fields) |
|
183 | + { |
|
184 | + $normalizedFields = [ |
|
185 | + 'login' => '[email protected]', |
|
186 | + 'fullName' => 'Test Login', |
|
187 | + 'role' => $role, |
|
188 | + 'password' => 'test', |
|
189 | + 'organization' => 'Cross Solution' |
|
190 | + ]; |
|
191 | + foreach($fields->getRowsHash() as $field=>$value){ |
|
192 | + $field = Inflector::camelize($field); |
|
193 | + $normalizedFields[$field] = $value; |
|
194 | + } |
|
195 | 195 | |
196 | - $this->thereIsAUserIdentifiedBy( |
|
197 | - $normalizedFields['login'], |
|
198 | - $normalizedFields['password'], |
|
199 | - $role, |
|
200 | - $normalizedFields['fullName'], |
|
201 | - $normalizedFields['organization'] |
|
202 | - ); |
|
196 | + $this->thereIsAUserIdentifiedBy( |
|
197 | + $normalizedFields['login'], |
|
198 | + $normalizedFields['password'], |
|
199 | + $role, |
|
200 | + $normalizedFields['fullName'], |
|
201 | + $normalizedFields['organization'] |
|
202 | + ); |
|
203 | 203 | |
204 | - } |
|
204 | + } |
|
205 | 205 | |
206 | - /** |
|
207 | - * @Given I am logged in as an administrator |
|
208 | - */ |
|
209 | - public function iAmLoggedInAsAnAdmin() |
|
210 | - { |
|
211 | - $user = $this->thereIsAUserIdentifiedBy('[email protected]','test',User::ROLE_ADMIN); |
|
212 | - $this->startLogin($user,'test'); |
|
213 | - } |
|
206 | + /** |
|
207 | + * @Given I am logged in as an administrator |
|
208 | + */ |
|
209 | + public function iAmLoggedInAsAnAdmin() |
|
210 | + { |
|
211 | + $user = $this->thereIsAUserIdentifiedBy('[email protected]','test',User::ROLE_ADMIN); |
|
212 | + $this->startLogin($user,'test'); |
|
213 | + } |
|
214 | 214 | |
215 | - private function startLogin(UserInterface $user, $password) |
|
216 | - { |
|
217 | - $currentUser = $this->currentUser; |
|
218 | - if(!is_object($currentUser) || $user->getId()!=$currentUser->getId()){ |
|
219 | - $this->iWantToLogIn(); |
|
220 | - $this->iSpecifyTheUsernameAs($user->getLogin()); |
|
221 | - $this->iSpecifyThePasswordAs($password); |
|
222 | - $this->iLogIn(); |
|
223 | - $this->currentUser = $user; |
|
224 | - } |
|
225 | - } |
|
215 | + private function startLogin(UserInterface $user, $password) |
|
216 | + { |
|
217 | + $currentUser = $this->currentUser; |
|
218 | + if(!is_object($currentUser) || $user->getId()!=$currentUser->getId()){ |
|
219 | + $this->iWantToLogIn(); |
|
220 | + $this->iSpecifyTheUsernameAs($user->getLogin()); |
|
221 | + $this->iSpecifyThePasswordAs($password); |
|
222 | + $this->iLogIn(); |
|
223 | + $this->currentUser = $user; |
|
224 | + } |
|
225 | + } |
|
226 | 226 | |
227 | - /** |
|
228 | - * @return UserRepository |
|
229 | - */ |
|
230 | - public function getUserRepository() |
|
231 | - { |
|
232 | - return $this->coreContext->getRepositories()->get('Auth\Entity\User'); |
|
233 | - } |
|
227 | + /** |
|
228 | + * @return UserRepository |
|
229 | + */ |
|
230 | + public function getUserRepository() |
|
231 | + { |
|
232 | + return $this->coreContext->getRepositories()->get('Auth\Entity\User'); |
|
233 | + } |
|
234 | 234 | |
235 | - /** |
|
236 | - * @Given there is a user :email identified by :password |
|
237 | - */ |
|
238 | - public function thereIsAUserIdentifiedBy($email, $password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter",$organization=null) |
|
239 | - { |
|
240 | - $repo = $this->getUserRepository(); |
|
241 | - if(!is_object($user=$repo->findByEmail($email))){ |
|
242 | - $user = $this->createUser($email,$password,$role,$fullname,$organization); |
|
243 | - } |
|
235 | + /** |
|
236 | + * @Given there is a user :email identified by :password |
|
237 | + */ |
|
238 | + public function thereIsAUserIdentifiedBy($email, $password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter",$organization=null) |
|
239 | + { |
|
240 | + $repo = $this->getUserRepository(); |
|
241 | + if(!is_object($user=$repo->findByEmail($email))){ |
|
242 | + $user = $this->createUser($email,$password,$role,$fullname,$organization); |
|
243 | + } |
|
244 | 244 | |
245 | - if(!is_null($organization)){ |
|
246 | - $this->iHaveMainOrganization($user,$organization); |
|
247 | - } |
|
248 | - $this->addCreatedUser($user); |
|
249 | - $repo->getDocumentManager()->refresh($user); |
|
250 | - return $user; |
|
251 | - } |
|
245 | + if(!is_null($organization)){ |
|
246 | + $this->iHaveMainOrganization($user,$organization); |
|
247 | + } |
|
248 | + $this->addCreatedUser($user); |
|
249 | + $repo->getDocumentManager()->refresh($user); |
|
250 | + return $user; |
|
251 | + } |
|
252 | 252 | |
253 | - /** |
|
254 | - * @param $email |
|
255 | - * @param $password |
|
256 | - * @param $username |
|
257 | - * @param string $fullname |
|
258 | - * @param string $role |
|
259 | - * |
|
260 | - * @return \Auth\Entity\UserInterface |
|
261 | - */ |
|
262 | - public function createUser($email,$password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter") |
|
263 | - { |
|
264 | - /* @var Register $service */ |
|
265 | - /* @var User $user */ |
|
266 | - $repo = $this->getUserRepository(); |
|
267 | - $user = $repo->create([]); |
|
268 | - $user->setLogin($email); |
|
269 | - $user->setPassword($password); |
|
270 | - $user->setRole($role); |
|
271 | - $settings = $user->getSettings('Applications'); |
|
253 | + /** |
|
254 | + * @param $email |
|
255 | + * @param $password |
|
256 | + * @param $username |
|
257 | + * @param string $fullname |
|
258 | + * @param string $role |
|
259 | + * |
|
260 | + * @return \Auth\Entity\UserInterface |
|
261 | + */ |
|
262 | + public function createUser($email,$password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter") |
|
263 | + { |
|
264 | + /* @var Register $service */ |
|
265 | + /* @var User $user */ |
|
266 | + $repo = $this->getUserRepository(); |
|
267 | + $user = $repo->create([]); |
|
268 | + $user->setLogin($email); |
|
269 | + $user->setPassword($password); |
|
270 | + $user->setRole($role); |
|
271 | + $settings = $user->getSettings('Applications'); |
|
272 | 272 | |
273 | - $expFullName = explode(' ',$fullname); |
|
274 | - $info = $user->getInfo(); |
|
275 | - $info->setFirstName(array_shift($expFullName)); |
|
276 | - $info->setLastName(count($expFullName)>0 ? implode(' ',$expFullName):''); |
|
277 | - $info->setEmail($email); |
|
278 | - $info->setEmailVerified(true); |
|
279 | - $repo->store($user); |
|
280 | - $repo->getDocumentManager()->refresh($user); |
|
273 | + $expFullName = explode(' ',$fullname); |
|
274 | + $info = $user->getInfo(); |
|
275 | + $info->setFirstName(array_shift($expFullName)); |
|
276 | + $info->setLastName(count($expFullName)>0 ? implode(' ',$expFullName):''); |
|
277 | + $info->setEmail($email); |
|
278 | + $info->setEmailVerified(true); |
|
279 | + $repo->store($user); |
|
280 | + $repo->getDocumentManager()->refresh($user); |
|
281 | 281 | |
282 | - $eventArgs = new LifecycleEventArgs($user, $repo->getDocumentManager()); |
|
283 | - $repo->getDocumentManager()->getEventManager()->dispatchEvent( |
|
284 | - Events::postLoad, |
|
285 | - $eventArgs |
|
286 | - ); |
|
287 | - /* @var \Core\EventManager\EventManager $events */ |
|
288 | - /* @var \Auth\Listener\Events\AuthEvent $event */ |
|
289 | - //@TODO: [Behat] event not working in travis |
|
290 | - //$events = $this->coreContext->getEventManager(); |
|
291 | - //$event = $events->getEvent(AuthEvent::EVENT_USER_REGISTERED, $this); |
|
292 | - //$event->setUser($user); |
|
293 | - //$events->triggerEvent($event); |
|
294 | - return $user; |
|
295 | - } |
|
282 | + $eventArgs = new LifecycleEventArgs($user, $repo->getDocumentManager()); |
|
283 | + $repo->getDocumentManager()->getEventManager()->dispatchEvent( |
|
284 | + Events::postLoad, |
|
285 | + $eventArgs |
|
286 | + ); |
|
287 | + /* @var \Core\EventManager\EventManager $events */ |
|
288 | + /* @var \Auth\Listener\Events\AuthEvent $event */ |
|
289 | + //@TODO: [Behat] event not working in travis |
|
290 | + //$events = $this->coreContext->getEventManager(); |
|
291 | + //$event = $events->getEvent(AuthEvent::EVENT_USER_REGISTERED, $this); |
|
292 | + //$event->setUser($user); |
|
293 | + //$events->triggerEvent($event); |
|
294 | + return $user; |
|
295 | + } |
|
296 | 296 | |
297 | - /** |
|
298 | - * @When I have :organization as my main organization |
|
299 | - * @param $orgName |
|
300 | - */ |
|
301 | - public function iHaveMainOrganization(UserInterface $user,$orgName) |
|
302 | - { |
|
303 | - /* @var $repoOrganization OrganizationRepository */ |
|
304 | - $repoOrganization = $this->coreContext->getRepositories()->get('Organizations/Organization'); |
|
305 | - $result = $repoOrganization->findByName($orgName); |
|
306 | - $organization = count($result) > 0 ? $result[0]:null; |
|
307 | - if(!$organization instanceof Organization){ |
|
308 | - $organization = new Organization(); |
|
309 | - $organizationName = new OrganizationName($orgName); |
|
310 | - $organization->setOrganizationName($organizationName); |
|
311 | - } |
|
297 | + /** |
|
298 | + * @When I have :organization as my main organization |
|
299 | + * @param $orgName |
|
300 | + */ |
|
301 | + public function iHaveMainOrganization(UserInterface $user,$orgName) |
|
302 | + { |
|
303 | + /* @var $repoOrganization OrganizationRepository */ |
|
304 | + $repoOrganization = $this->coreContext->getRepositories()->get('Organizations/Organization'); |
|
305 | + $result = $repoOrganization->findByName($orgName); |
|
306 | + $organization = count($result) > 0 ? $result[0]:null; |
|
307 | + if(!$organization instanceof Organization){ |
|
308 | + $organization = new Organization(); |
|
309 | + $organizationName = new OrganizationName($orgName); |
|
310 | + $organization->setOrganizationName($organizationName); |
|
311 | + } |
|
312 | 312 | $organization->setProfileSetting(Organization::PROFILE_ALWAYS_ENABLE); |
313 | 313 | $permissions = $organization->getPermissions(); |
314 | 314 | $permissions->grant($user,Permissions::PERMISSION_ALL); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $repoOrganization->getDocumentManager()->refresh($organization); |
319 | 319 | |
320 | 320 | $this->mainOrganization = $organization; |
321 | - } |
|
321 | + } |
|
322 | 322 | |
323 | 323 | /** |
324 | 324 | * @return Organization |
@@ -328,130 +328,130 @@ discard block |
||
328 | 328 | return $this->mainOrganization; |
329 | 329 | } |
330 | 330 | |
331 | - /** |
|
332 | - * @When I want to log in |
|
333 | - */ |
|
334 | - public function iWantToLogIn() |
|
335 | - { |
|
336 | - $session = $this->minkContext->getSession(); |
|
337 | - $url = $this->buildUrl('lang/auth'); |
|
338 | - $session->visit($url); |
|
339 | - } |
|
331 | + /** |
|
332 | + * @When I want to log in |
|
333 | + */ |
|
334 | + public function iWantToLogIn() |
|
335 | + { |
|
336 | + $session = $this->minkContext->getSession(); |
|
337 | + $url = $this->buildUrl('lang/auth'); |
|
338 | + $session->visit($url); |
|
339 | + } |
|
340 | 340 | |
341 | - /** |
|
342 | - * @When I specify the username as :username |
|
343 | - */ |
|
344 | - public function iSpecifyTheUsernameAs($username) |
|
345 | - { |
|
346 | - $this->minkContext->fillField('Login name',$username); |
|
347 | - } |
|
341 | + /** |
|
342 | + * @When I specify the username as :username |
|
343 | + */ |
|
344 | + public function iSpecifyTheUsernameAs($username) |
|
345 | + { |
|
346 | + $this->minkContext->fillField('Login name',$username); |
|
347 | + } |
|
348 | 348 | |
349 | - /** |
|
350 | - * @When I specify the password as :password |
|
351 | - */ |
|
352 | - public function iSpecifyThePasswordAs($password) |
|
353 | - { |
|
354 | - $this->minkContext->fillField('Password',$password); |
|
355 | - } |
|
349 | + /** |
|
350 | + * @When I specify the password as :password |
|
351 | + */ |
|
352 | + public function iSpecifyThePasswordAs($password) |
|
353 | + { |
|
354 | + $this->minkContext->fillField('Password',$password); |
|
355 | + } |
|
356 | 356 | |
357 | - /** |
|
358 | - * @Given I am logged in as :username identified by :password |
|
359 | - */ |
|
360 | - public function iAmLoggedInAsIdentifiedBy($username, $password) |
|
361 | - { |
|
362 | - $repo = $this->getUserRepository(); |
|
363 | - $user = $repo->findByLogin($username); |
|
357 | + /** |
|
358 | + * @Given I am logged in as :username identified by :password |
|
359 | + */ |
|
360 | + public function iAmLoggedInAsIdentifiedBy($username, $password) |
|
361 | + { |
|
362 | + $repo = $this->getUserRepository(); |
|
363 | + $user = $repo->findByLogin($username); |
|
364 | 364 | |
365 | - if(!$user instanceof User){ |
|
366 | - throw new \Exception(sprintf('There is no user with this login: "%s"',$username)); |
|
367 | - } |
|
368 | - $this->iWantToLogIn(); |
|
369 | - $this->iSpecifyTheUsernameAs($username); |
|
370 | - $this->iSpecifyThePasswordAs($password); |
|
371 | - $this->iLogIn(); |
|
365 | + if(!$user instanceof User){ |
|
366 | + throw new \Exception(sprintf('There is no user with this login: "%s"',$username)); |
|
367 | + } |
|
368 | + $this->iWantToLogIn(); |
|
369 | + $this->iSpecifyTheUsernameAs($username); |
|
370 | + $this->iSpecifyThePasswordAs($password); |
|
371 | + $this->iLogIn(); |
|
372 | 372 | $this->currentUser = $user; |
373 | - } |
|
373 | + } |
|
374 | 374 | |
375 | - /** |
|
376 | - * @When I log in |
|
377 | - */ |
|
378 | - public function iLogIn() |
|
379 | - { |
|
380 | - $this->minkContext->pressButton('login'); |
|
381 | - } |
|
375 | + /** |
|
376 | + * @When I log in |
|
377 | + */ |
|
378 | + public function iLogIn() |
|
379 | + { |
|
380 | + $this->minkContext->pressButton('login'); |
|
381 | + } |
|
382 | 382 | |
383 | - /** |
|
384 | - * @When I press logout link |
|
385 | - */ |
|
386 | - public function iPressLogoutLink() |
|
387 | - { |
|
388 | - $url = $this->buildUrl('auth-logout'); |
|
389 | - $this->visit($url); |
|
390 | - } |
|
383 | + /** |
|
384 | + * @When I press logout link |
|
385 | + */ |
|
386 | + public function iPressLogoutLink() |
|
387 | + { |
|
388 | + $url = $this->buildUrl('auth-logout'); |
|
389 | + $this->visit($url); |
|
390 | + } |
|
391 | 391 | |
392 | - /** |
|
393 | - * @Given I log in with username :username and password :password |
|
394 | - */ |
|
395 | - public function iLogInWith($username, $password) |
|
396 | - { |
|
397 | - $repo = $this->getUserRepository(); |
|
398 | - $user = $repo->findByLogin($username); |
|
399 | - $this->iWantToLogIn(); |
|
400 | - $this->iSpecifyTheUsernameAs($username); |
|
401 | - $this->iSpecifyThePasswordAs($password); |
|
402 | - $this->iLogIn(); |
|
403 | - $this->loggedInUser = $user; |
|
404 | - } |
|
392 | + /** |
|
393 | + * @Given I log in with username :username and password :password |
|
394 | + */ |
|
395 | + public function iLogInWith($username, $password) |
|
396 | + { |
|
397 | + $repo = $this->getUserRepository(); |
|
398 | + $user = $repo->findByLogin($username); |
|
399 | + $this->iWantToLogIn(); |
|
400 | + $this->iSpecifyTheUsernameAs($username); |
|
401 | + $this->iSpecifyThePasswordAs($password); |
|
402 | + $this->iLogIn(); |
|
403 | + $this->loggedInUser = $user; |
|
404 | + } |
|
405 | 405 | |
406 | - /** |
|
407 | - * @When I go to profile page |
|
408 | - */ |
|
409 | - public function iGoToProfilePage() |
|
410 | - { |
|
411 | - $url = $this->buildUrl('lang/my'); |
|
412 | - $this->visit($url); |
|
413 | - } |
|
406 | + /** |
|
407 | + * @When I go to profile page |
|
408 | + */ |
|
409 | + public function iGoToProfilePage() |
|
410 | + { |
|
411 | + $url = $this->buildUrl('lang/my'); |
|
412 | + $this->visit($url); |
|
413 | + } |
|
414 | 414 | |
415 | - /** |
|
416 | - * @Given there is a user with the following: |
|
417 | - */ |
|
418 | - public function thereIsAUserWithTheFollowing(TableNode $table) |
|
419 | - { |
|
420 | - $repo = $this->getUserRepository(); |
|
421 | - $data = $table->getRowsHash(); |
|
422 | - $email = isset($data['email']) ? $data['email']:'[email protected]'; |
|
423 | - $password = isset($data['password']) ? $data['password']:'test'; |
|
424 | - $fullname = isset($data['fullname']) ? $data['fullname']:'Test User'; |
|
425 | - $role = isset($data['role']) ? $data['role']:User::ROLE_RECRUITER; |
|
415 | + /** |
|
416 | + * @Given there is a user with the following: |
|
417 | + */ |
|
418 | + public function thereIsAUserWithTheFollowing(TableNode $table) |
|
419 | + { |
|
420 | + $repo = $this->getUserRepository(); |
|
421 | + $data = $table->getRowsHash(); |
|
422 | + $email = isset($data['email']) ? $data['email']:'[email protected]'; |
|
423 | + $password = isset($data['password']) ? $data['password']:'test'; |
|
424 | + $fullname = isset($data['fullname']) ? $data['fullname']:'Test User'; |
|
425 | + $role = isset($data['role']) ? $data['role']:User::ROLE_RECRUITER; |
|
426 | 426 | |
427 | - if(!is_object($user=$repo->findByLogin($email))){ |
|
428 | - $user = $this->createUser($email,$password,$role,$fullname); |
|
429 | - } |
|
430 | - $this->currentUser = $user; |
|
431 | - $this->addCreatedUser($user); |
|
432 | - } |
|
427 | + if(!is_object($user=$repo->findByLogin($email))){ |
|
428 | + $user = $this->createUser($email,$password,$role,$fullname); |
|
429 | + } |
|
430 | + $this->currentUser = $user; |
|
431 | + $this->addCreatedUser($user); |
|
432 | + } |
|
433 | 433 | |
434 | - private function addCreatedUser(UserInterface $user) |
|
435 | - { |
|
436 | - if(!in_array($user,static::$users)){ |
|
437 | - static::$users[] = $user; |
|
438 | - } |
|
439 | - } |
|
434 | + private function addCreatedUser(UserInterface $user) |
|
435 | + { |
|
436 | + if(!in_array($user,static::$users)){ |
|
437 | + static::$users[] = $user; |
|
438 | + } |
|
439 | + } |
|
440 | 440 | |
441 | - /** |
|
442 | - * @When I want to change my password |
|
443 | - */ |
|
444 | - public function iWantToChangeMyPassword() |
|
445 | - { |
|
446 | - $url = $this->buildUrl('lang/my-password'); |
|
447 | - $this->visit($url); |
|
448 | - } |
|
441 | + /** |
|
442 | + * @When I want to change my password |
|
443 | + */ |
|
444 | + public function iWantToChangeMyPassword() |
|
445 | + { |
|
446 | + $url = $this->buildUrl('lang/my-password'); |
|
447 | + $this->visit($url); |
|
448 | + } |
|
449 | 449 | |
450 | 450 | /** |
451 | 451 | * @return User |
452 | 452 | * @throws FailedExpectationException |
453 | 453 | */ |
454 | - public function getCurrentUser() |
|
454 | + public function getCurrentUser() |
|
455 | 455 | { |
456 | 456 | if(!$this->currentUser instanceof User){ |
457 | 457 | throw new FailedExpectationException('Need to login first before use this step'); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | 'controllers' => [ |
51 | 51 | 'factories' => [ |
52 | - 'Organizations/InviteEmployee' => \Organizations\Factory\Controller\InviteEmployeeControllerFactory::class, |
|
52 | + 'Organizations/InviteEmployee' => \Organizations\Factory\Controller\InviteEmployeeControllerFactory::class, |
|
53 | 53 | 'Organizations/Index' => 'Organizations\Factory\Controller\IndexControllerFactory', |
54 | 54 | 'Organizations/Profile' => 'Organizations\Factory\Controller\ProfileControllerFactory' |
55 | 55 | ] |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | 'view_manager' => [ |
67 | 67 | // Map template to files. Speeds up the lookup through the template stack. |
68 | 68 | 'template_map' => [ |
69 | - 'organizations/index/edit' => __DIR__ . '/../view/organizations/index/form.phtml', |
|
70 | - 'organizations/form/employees-fieldset' => __DIR__ . '/../view/form/employees-fieldset.phtml', |
|
71 | - 'organizations/form/employee-fieldset' => __DIR__ .'/../view/form/employee-fieldset.phtml', |
|
72 | - 'organizations/form/invite-employee-bar' => __DIR__ . '/../view/form/invite-employee-bar.phtml', |
|
73 | - 'organizations/error/no-parent' => __DIR__ . '/../view/error/no-parent.phtml', |
|
74 | - 'organizations/error/invite' => __DIR__ . '/../view/error/invite.phtml', |
|
75 | - 'organizations/mail/invite-employee' => __DIR__ . '/../view/mail/invite-employee.phtml', |
|
76 | - 'organizations/form/workflow-fieldset' => __DIR__ . '/../view/form/workflow-fieldset.phtml', |
|
69 | + 'organizations/index/edit' => __DIR__ . '/../view/organizations/index/form.phtml', |
|
70 | + 'organizations/form/employees-fieldset' => __DIR__ . '/../view/form/employees-fieldset.phtml', |
|
71 | + 'organizations/form/employee-fieldset' => __DIR__ .'/../view/form/employee-fieldset.phtml', |
|
72 | + 'organizations/form/invite-employee-bar' => __DIR__ . '/../view/form/invite-employee-bar.phtml', |
|
73 | + 'organizations/error/no-parent' => __DIR__ . '/../view/error/no-parent.phtml', |
|
74 | + 'organizations/error/invite' => __DIR__ . '/../view/error/invite.phtml', |
|
75 | + 'organizations/mail/invite-employee' => __DIR__ . '/../view/mail/invite-employee.phtml', |
|
76 | + 'organizations/form/workflow-fieldset' => __DIR__ . '/../view/form/workflow-fieldset.phtml', |
|
77 | 77 | ], |
78 | 78 | // Where to look for view templates not mapped above |
79 | 79 | 'template_path_stack' => [ |
@@ -82,24 +82,24 @@ discard block |
||
82 | 82 | ], |
83 | 83 | 'form_elements' => [ |
84 | 84 | 'invokables' => [ |
85 | - 'Organizations/Form' => 'Organizations\Form\Organizations', |
|
86 | - 'Organizations/OrganizationsContactForm' => 'Organizations\Form\OrganizationsContactForm', |
|
87 | - 'Organizations/OrganizationsNameForm' => 'Organizations\Form\OrganizationsNameForm', |
|
88 | - 'Organizations/OrganizationsDescriptionForm' => 'Organizations\Form\OrganizationsDescriptionForm', |
|
89 | - 'Organizations/OrganizationsContactFieldset' => 'Organizations\Form\OrganizationsContactFieldset', |
|
90 | - 'Organizations/OrganizationsDescriptionFieldset' => 'Organizations\Form\OrganizationsDescriptionFieldset', |
|
91 | - //'Organizations/OrganizationFieldset' => 'Organizations\Form\OrganizationFieldset', |
|
92 | - 'Organizations/EmployeesContainer' => 'Organizations\Form\EmployeesContainer', |
|
93 | - 'Organizations/Employees' => 'Organizations\Form\Employees', |
|
94 | - 'Organizations/InviteEmployeeBar' => 'Organizations\Form\Element\InviteEmployeeBar', |
|
95 | - 'Organizations/Employee' => 'Organizations\Form\Element\Employee', |
|
96 | - 'Organizations/WorkflowSettings' => 'Organizations\Form\WorkflowSettings', |
|
97 | - 'Organizations/WorkflowSettingsFieldset' => 'Organizations\Form\WorkflowSettingsFieldset', |
|
98 | - 'Organizations/Profile' => \Organizations\Form\OrganizationsProfileForm::class, |
|
99 | - 'Organizations/ProfileFieldset' => \Organizations\Form\OrganizationsProfileFieldset::class |
|
85 | + 'Organizations/Form' => 'Organizations\Form\Organizations', |
|
86 | + 'Organizations/OrganizationsContactForm' => 'Organizations\Form\OrganizationsContactForm', |
|
87 | + 'Organizations/OrganizationsNameForm' => 'Organizations\Form\OrganizationsNameForm', |
|
88 | + 'Organizations/OrganizationsDescriptionForm' => 'Organizations\Form\OrganizationsDescriptionForm', |
|
89 | + 'Organizations/OrganizationsContactFieldset' => 'Organizations\Form\OrganizationsContactFieldset', |
|
90 | + 'Organizations/OrganizationsDescriptionFieldset' => 'Organizations\Form\OrganizationsDescriptionFieldset', |
|
91 | + //'Organizations/OrganizationFieldset' => 'Organizations\Form\OrganizationFieldset', |
|
92 | + 'Organizations/EmployeesContainer' => 'Organizations\Form\EmployeesContainer', |
|
93 | + 'Organizations/Employees' => 'Organizations\Form\Employees', |
|
94 | + 'Organizations/InviteEmployeeBar' => 'Organizations\Form\Element\InviteEmployeeBar', |
|
95 | + 'Organizations/Employee' => 'Organizations\Form\Element\Employee', |
|
96 | + 'Organizations/WorkflowSettings' => 'Organizations\Form\WorkflowSettings', |
|
97 | + 'Organizations/WorkflowSettingsFieldset' => 'Organizations\Form\WorkflowSettingsFieldset', |
|
98 | + 'Organizations/Profile' => \Organizations\Form\OrganizationsProfileForm::class, |
|
99 | + 'Organizations/ProfileFieldset' => \Organizations\Form\OrganizationsProfileFieldset::class |
|
100 | 100 | ], |
101 | 101 | 'factories' => [ |
102 | - 'Organizations/OrganizationsNameFieldset' => \Organizations\Factory\Form\OrganizationsNameFieldsetFactory::class, |
|
102 | + 'Organizations/OrganizationsNameFieldset' => \Organizations\Factory\Form\OrganizationsNameFieldsetFactory::class, |
|
103 | 103 | 'Organizations/Image' => \Organizations\Form\LogoImageFactory::class, |
104 | 104 | 'Organizations/EmployeesFieldset' => 'Organizations\Factory\Form\EmployeesFieldsetFactory', |
105 | 105 | 'Organizations/EmployeeFieldset' => 'Organizations\Factory\Form\EmployeeFieldsetFactory', |
@@ -207,13 +207,13 @@ discard block |
||
207 | 207 | |
208 | 208 | 'service_manager' => [ |
209 | 209 | 'invokables' => [ |
210 | - 'Organizations\Auth\Dependency\EmployeeListListener' => 'Organizations\Auth\Dependency\EmployeeListListener' |
|
210 | + 'Organizations\Auth\Dependency\EmployeeListListener' => 'Organizations\Auth\Dependency\EmployeeListListener' |
|
211 | 211 | ], |
212 | 212 | 'factories' => [ |
213 | - 'Organizations\Auth\Dependency\ListListener' => 'Organizations\Factory\Auth\Dependency\ListListenerFactory', |
|
214 | - 'Organizations\ImageFileCache\Manager' => 'Organizations\Factory\ImageFileCache\ManagerFactory', |
|
215 | - 'Organizations\ImageFileCache\ODMListener' => 'Organizations\Factory\ImageFileCache\ODMListenerFactory', |
|
216 | - 'Organizations\ImageFileCache\ApplicationListener' => 'Organizations\Factory\ImageFileCache\ApplicationListenerFactory', |
|
213 | + 'Organizations\Auth\Dependency\ListListener' => 'Organizations\Factory\Auth\Dependency\ListListenerFactory', |
|
214 | + 'Organizations\ImageFileCache\Manager' => 'Organizations\Factory\ImageFileCache\ManagerFactory', |
|
215 | + 'Organizations\ImageFileCache\ODMListener' => 'Organizations\Factory\ImageFileCache\ODMListenerFactory', |
|
216 | + 'Organizations\ImageFileCache\ApplicationListener' => 'Organizations\Factory\ImageFileCache\ApplicationListenerFactory', |
|
217 | 217 | ], |
218 | 218 | ], |
219 | 219 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | ], |
14 | 14 | ], |
15 | 15 | 'annotation' => [ |
16 | - 'paths' => [ __DIR__ . '/../src/Organizations/Entity'] |
|
16 | + 'paths' => [__DIR__.'/../src/Organizations/Entity'] |
|
17 | 17 | ], |
18 | 18 | ], |
19 | 19 | 'eventmanager' => [ |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'translation_file_patterns' => [ |
41 | 41 | [ |
42 | 42 | 'type' => 'gettext', |
43 | - 'base_dir' => __DIR__ . '/../language', |
|
43 | + 'base_dir' => __DIR__.'/../language', |
|
44 | 44 | 'pattern' => '%s.mo', |
45 | 45 | ], |
46 | 46 | ], |
@@ -66,18 +66,18 @@ discard block |
||
66 | 66 | 'view_manager' => [ |
67 | 67 | // Map template to files. Speeds up the lookup through the template stack. |
68 | 68 | 'template_map' => [ |
69 | - 'organizations/index/edit' => __DIR__ . '/../view/organizations/index/form.phtml', |
|
70 | - 'organizations/form/employees-fieldset' => __DIR__ . '/../view/form/employees-fieldset.phtml', |
|
71 | - 'organizations/form/employee-fieldset' => __DIR__ .'/../view/form/employee-fieldset.phtml', |
|
72 | - 'organizations/form/invite-employee-bar' => __DIR__ . '/../view/form/invite-employee-bar.phtml', |
|
73 | - 'organizations/error/no-parent' => __DIR__ . '/../view/error/no-parent.phtml', |
|
74 | - 'organizations/error/invite' => __DIR__ . '/../view/error/invite.phtml', |
|
75 | - 'organizations/mail/invite-employee' => __DIR__ . '/../view/mail/invite-employee.phtml', |
|
76 | - 'organizations/form/workflow-fieldset' => __DIR__ . '/../view/form/workflow-fieldset.phtml', |
|
69 | + 'organizations/index/edit' => __DIR__.'/../view/organizations/index/form.phtml', |
|
70 | + 'organizations/form/employees-fieldset' => __DIR__.'/../view/form/employees-fieldset.phtml', |
|
71 | + 'organizations/form/employee-fieldset' => __DIR__.'/../view/form/employee-fieldset.phtml', |
|
72 | + 'organizations/form/invite-employee-bar' => __DIR__.'/../view/form/invite-employee-bar.phtml', |
|
73 | + 'organizations/error/no-parent' => __DIR__.'/../view/error/no-parent.phtml', |
|
74 | + 'organizations/error/invite' => __DIR__.'/../view/error/invite.phtml', |
|
75 | + 'organizations/mail/invite-employee' => __DIR__.'/../view/mail/invite-employee.phtml', |
|
76 | + 'organizations/form/workflow-fieldset' => __DIR__.'/../view/form/workflow-fieldset.phtml', |
|
77 | 77 | ], |
78 | 78 | // Where to look for view templates not mapped above |
79 | 79 | 'template_path_stack' => [ |
80 | - __DIR__ . '/../view', |
|
80 | + __DIR__.'/../view', |
|
81 | 81 | ], |
82 | 82 | ], |
83 | 83 | 'form_elements' => [ |
@@ -155,13 +155,13 @@ discard block |
||
155 | 155 | 'allow' => [ |
156 | 156 | 'Entity/OrganizationImage', |
157 | 157 | 'route/lang/organizations/invite', |
158 | - 'Organizations/InviteEmployee' => [ 'accept' ], |
|
158 | + 'Organizations/InviteEmployee' => ['accept'], |
|
159 | 159 | 'route/lang/organizations/profile', |
160 | 160 | 'route/lang/organizations/profileDetail', |
161 | 161 | ], |
162 | 162 | 'deny' => [ |
163 | 163 | 'route/lang/organizations', |
164 | - 'Organizations/InviteEmployee' => [ 'invite' ], |
|
164 | + 'Organizations/InviteEmployee' => ['invite'], |
|
165 | 165 | ], |
166 | 166 | ], |
167 | 167 | // recruiters are allowed to view their companies |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | 'allow' => [ |
170 | 170 | 'route/lang/organizations', |
171 | 171 | 'Organizations/InviteEmployee', |
172 | - 'Entity/Organization' => [ 'edit' => 'Organizations/Write' ], |
|
172 | + 'Entity/Organization' => ['edit' => 'Organizations/Write'], |
|
173 | 173 | 'route/lang/organizations/profile', |
174 | 174 | 'route/lang/organizations/profileDetail' |
175 | 175 | ], |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | 'organizations' => [ |
188 | 188 | 'label' => 'Organizations', |
189 | 189 | 'route' => 'lang/organizations', |
190 | - 'order' => 65, // allows to order the menu items |
|
191 | - 'resource' => 'route/lang/organizations', // if a resource is defined, the acl will be applied. |
|
190 | + 'order' => 65, // allows to order the menu items |
|
191 | + 'resource' => 'route/lang/organizations', // if a resource is defined, the acl will be applied. |
|
192 | 192 | |
193 | 193 | 'pages' => [ |
194 | 194 | 'list' => [ |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | private $orgRepo; |
37 | 37 | |
38 | - public function __construct( |
|
38 | + public function __construct( |
|
39 | 39 | OrganizationRepository $orgRepo |
40 | 40 | ) |
41 | 41 | { |
@@ -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',[ |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @var String |
35 | 35 | */ |
36 | - protected $repositoryName="Organizations/Organization"; |
|
36 | + protected $repositoryName = "Organizations/Organization"; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Sortable fields |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | */ |
92 | 92 | $auth = $this->authService; |
93 | 93 | $user = $auth->getUser(); |
94 | - $ignored = [null,'guest',UserInterface::ROLE_USER]; |
|
95 | - if(!in_array($user->getRole(),$ignored)){ |
|
94 | + $ignored = [null, 'guest', UserInterface::ROLE_USER]; |
|
95 | + if (!in_array($user->getRole(), $ignored)) { |
|
96 | 96 | $queryBuilder->field('permissions.view')->equals($user->getId()); |
97 | 97 | } |
98 | 98 | |
99 | - if (isset($params['q']) && $params['q'] && $params['q'] != 'en/organizations/profile' ) { |
|
99 | + if (isset($params['q']) && $params['q'] && $params['q'] != 'en/organizations/profile') { |
|
100 | 100 | $queryBuilder->text($params['q'])->language('none'); |
101 | 101 | } |
102 | 102 | |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | |
107 | 107 | $queryBuilder->sort($this->filterSort($value['sort'])); |
108 | 108 | |
109 | - if(isset($params['type']) && $params['type'] === 'profile'){ |
|
109 | + if (isset($params['type']) && $params['type'] === 'profile') { |
|
110 | 110 | //@TODO: we should use aggregate query here |
111 | 111 | $queryBuilder->field('profileSetting') |
112 | - ->in([Organization::PROFILE_ALWAYS_ENABLE,Organization::PROFILE_ACTIVE_JOBS]) |
|
112 | + ->in([Organization::PROFILE_ALWAYS_ENABLE, Organization::PROFILE_ACTIVE_JOBS]) |
|
113 | 113 | ; |
114 | 114 | |
115 | 115 | $filters = $this->getOrganizationProfileFilters($queryBuilder); |
116 | - if(count($filters) > 0){ |
|
116 | + if (count($filters) > 0) { |
|
117 | 117 | $queryBuilder->field('id')->notIn($filters); |
118 | 118 | } |
119 | 119 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | $results = $queryBuilder->getQuery()->execute(); |
134 | 134 | |
135 | 135 | $filters = []; |
136 | - foreach($results->toArray() as $organization){ |
|
137 | - if($organization->getProfileSetting()==Organization::PROFILE_ACTIVE_JOBS){ |
|
136 | + foreach ($results->toArray() as $organization) { |
|
137 | + if ($organization->getProfileSetting() == Organization::PROFILE_ACTIVE_JOBS) { |
|
138 | 138 | $qb = $jobRepository->createQueryBuilder(); |
139 | 139 | $qb |
140 | 140 | ->field('organization')->equals($organization->getId()) |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | ->field('isDraft')->notEqual(true) |
143 | 143 | ; |
144 | 144 | $count = $qb->getQuery()->execute()->count(); |
145 | - if($count == 0){ |
|
145 | + if ($count == 0) { |
|
146 | 146 | $filters[] = $organization->getId(); |
147 | 147 | } |
148 | 148 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | /* @TODO: $jobRepository should be removed when using aggregation query in filtering profile */ |
38 | 38 | $authService = $container->get('AuthenticationService'); |
39 | 39 | $jobRepository = $container->get('Core/RepositoryService')->get('Jobs/Job'); |
40 | - $filter = new PaginationQuery($jobRepository,$authService); |
|
40 | + $filter = new PaginationQuery($jobRepository, $authService); |
|
41 | 41 | return $filter; |
42 | 42 | } |
43 | 43 | } |