@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $core = $scope->getEnvironment()->getContext(CoreContext::class); |
| 50 | 50 | /* @var FileTransport $transport */ |
| 51 | 51 | $transport = $core->getServiceManager()->get('Core/MailService')->getTransport(); |
| 52 | - $path = $transport->getOptions()->getPath() . '/*.eml'; |
|
| 52 | + $path = $transport->getOptions()->getPath().'/*.eml'; |
|
| 53 | 53 | foreach (glob($path) as $filename) { |
| 54 | 54 | unlink($filename); |
| 55 | 55 | } |
@@ -105,25 +105,25 @@ discard block |
||
| 105 | 105 | $regex = '/.*('.preg_quote($text).').*/im'; |
| 106 | 106 | $matches = []; |
| 107 | 107 | $multiMessages = false; |
| 108 | - if(count($this->messages) > 1){ |
|
| 108 | + if (count($this->messages) > 1) { |
|
| 109 | 109 | $multiMessages = true; |
| 110 | 110 | } |
| 111 | 111 | $content = ""; |
| 112 | - foreach($this->messages as $key=>$definition){ |
|
| 112 | + foreach ($this->messages as $key=>$definition) { |
|
| 113 | 113 | $content = $definition['contents']; |
| 114 | - if(preg_match($regex,$content,$match)){ |
|
| 114 | + if (preg_match($regex, $content, $match)) { |
|
| 115 | 115 | $matches[] = $match; |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | - $failMessage = sprintf('Can not find text "%s" in any email sent',$text); |
|
| 119 | - if(!$multiMessages){ |
|
| 118 | + $failMessage = sprintf('Can not find text "%s" in any email sent', $text); |
|
| 119 | + if (!$multiMessages) { |
|
| 120 | 120 | $failMessage = sprintf( |
| 121 | 121 | 'Can not find text "%s" in sent email. Here\'s the email content: %s', |
| 122 | 122 | $text, |
| 123 | 123 | PHP_EOL.PHP_EOL.$content |
| 124 | 124 | ); |
| 125 | 125 | } |
| 126 | - Assert::true(count($matches)>0,$failMessage); |
|
| 126 | + Assert::true(count($matches) > 0, $failMessage); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -136,16 +136,16 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | $path = $transport->getOptions()->getPath().'/*.eml'; |
| 138 | 138 | |
| 139 | - foreach(glob($path) as $filename){ |
|
| 139 | + foreach (glob($path) as $filename) { |
|
| 140 | 140 | $id = md5($filename); |
| 141 | - if(!isset($this->messages[$id])){ |
|
| 141 | + if (!isset($this->messages[$id])) { |
|
| 142 | 142 | $contents = file_get_contents($filename); |
| 143 | - $this->messages[$id] = $this->parseEmail($contents); |
|
| 143 | + $this->messages[$id] = $this->parseEmail($contents); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | Assert::true( |
| 148 | - count($this->messages)>0, |
|
| 148 | + count($this->messages) > 0, |
|
| 149 | 149 | 'No email have been sent' |
| 150 | 150 | ); |
| 151 | 151 | } |
@@ -153,28 +153,28 @@ discard block |
||
| 153 | 153 | private function parseEmail($contents) |
| 154 | 154 | { |
| 155 | 155 | $addresses = $this->parseEmailAddress($contents); |
| 156 | - $subject =$this->parseSubject($contents); |
|
| 156 | + $subject = $this->parseSubject($contents); |
|
| 157 | 157 | |
| 158 | 158 | $contents = strip_tags($contents); |
| 159 | 159 | $contents = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $contents); |
| 160 | 160 | |
| 161 | - return array_merge($addresses,$subject,['contents' => $contents]); |
|
| 161 | + return array_merge($addresses, $subject, ['contents' => $contents]); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | private function parseEmailAddress($contents) |
| 165 | 165 | { |
| 166 | 166 | // pattern to get email address |
| 167 | - $radd = '(\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b)'; |
|
| 167 | + $radd = '(\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b)'; |
|
| 168 | 168 | |
| 169 | 169 | // get email from address |
| 170 | - $regex = sprintf('/^From\:.*%s/im',$radd); |
|
| 171 | - $hasMatch = preg_match($regex,$contents,$matches); |
|
| 172 | - $fromAddress = $hasMatch ? $matches[1]:null; |
|
| 170 | + $regex = sprintf('/^From\:.*%s/im', $radd); |
|
| 171 | + $hasMatch = preg_match($regex, $contents, $matches); |
|
| 172 | + $fromAddress = $hasMatch ? $matches[1] : null; |
|
| 173 | 173 | |
| 174 | 174 | // get email to address |
| 175 | - $regex = sprintf('/^To\:\s+%s/im',$radd); |
|
| 176 | - $hasMatch = preg_match($regex,$contents,$matches); |
|
| 177 | - $toAddress = $hasMatch ? $matches[1]:null; |
|
| 175 | + $regex = sprintf('/^To\:\s+%s/im', $radd); |
|
| 176 | + $hasMatch = preg_match($regex, $contents, $matches); |
|
| 177 | + $toAddress = $hasMatch ? $matches[1] : null; |
|
| 178 | 178 | |
| 179 | 179 | $this->fromMails[] = $fromAddress; |
| 180 | 180 | $this->toMails[] = $toAddress; |
@@ -188,8 +188,8 @@ discard block |
||
| 188 | 188 | private function parseSubject($contents) |
| 189 | 189 | { |
| 190 | 190 | $pattern = '/Subject\:(.*)/i'; |
| 191 | - preg_match($pattern,$contents,$matches); |
|
| 192 | - $subject = isset($matches[1]) ? $matches[1]:null; |
|
| 191 | + preg_match($pattern, $contents, $matches); |
|
| 192 | + $subject = isset($matches[1]) ? $matches[1] : null; |
|
| 193 | 193 | $this->subjects[] = $subject; |
| 194 | 194 | return [ |
| 195 | 195 | 'subject' => trim($subject) |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | { |
| 33 | 33 | $options = $this->options; |
| 34 | 34 | $filename = call_user_func($options->getCallback(), $this); |
| 35 | - $file = $options->getPath() . DIRECTORY_SEPARATOR . $filename; |
|
| 35 | + $file = $options->getPath().DIRECTORY_SEPARATOR.$filename; |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | $contents = $message->toString(); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | class MailServiceFactory implements FactoryInterface |
| 28 | 28 | { |
| 29 | - public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
| 29 | + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
| 30 | 30 | { |
| 31 | 31 | $config = $container->get('Config'); |
| 32 | 32 | $mails = isset($config['mails']) ? $config['mails'] : []; |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | $configArray = array_merge($configArray, $mails); |
| 49 | 49 | |
| 50 | 50 | $config = new MailServiceConfig($configArray); |
| 51 | - $service = new MailService($container,$config->toArray()); |
|
| 51 | + $service = new MailService($container, $config->toArray()); |
|
| 52 | 52 | $config->configureServiceManager($service); |
| 53 | - foreach($config->toArray() as $name=>$value){ |
|
| 53 | + foreach ($config->toArray() as $name=>$value) { |
|
| 54 | 54 | $method = 'set'.$name; |
| 55 | - if(method_exists($service,$method)){ |
|
| 56 | - call_user_func([$service,$method],$value); |
|
| 55 | + if (method_exists($service, $method)) { |
|
| 56 | + call_user_func([$service, $method], $value); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | $type = $mailServiceOptions->getTransportClass(); |
| 66 | 66 | if (MailService::TRANSPORT_SMTP == $type) { |
| 67 | 67 | return new Smtp($mailServiceOptions); |
| 68 | - }elseif(MailService::TRANSPORT_FILE == $type){ |
|
| 68 | + }elseif (MailService::TRANSPORT_FILE == $type) { |
|
| 69 | 69 | $fileOptions = new FileOptions(); |
| 70 | 70 | $fileOptions->setPath($mailServiceOptions->getPath()); |
| 71 | 71 | return new FileTransport($fileOptions); |
| 72 | - }elseif(MailService::TRANSPORT_SENDMAIL == $type){ |
|
| 72 | + }elseif (MailService::TRANSPORT_SENDMAIL == $type) { |
|
| 73 | 73 | return new Sendmail(); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -65,11 +65,11 @@ |
||
| 65 | 65 | $type = $mailServiceOptions->getTransportClass(); |
| 66 | 66 | if (MailService::TRANSPORT_SMTP == $type) { |
| 67 | 67 | return new Smtp($mailServiceOptions); |
| 68 | - }elseif(MailService::TRANSPORT_FILE == $type){ |
|
| 68 | + } elseif(MailService::TRANSPORT_FILE == $type){ |
|
| 69 | 69 | $fileOptions = new FileOptions(); |
| 70 | 70 | $fileOptions->setPath($mailServiceOptions->getPath()); |
| 71 | 71 | return new FileTransport($fileOptions); |
| 72 | - }elseif(MailService::TRANSPORT_SENDMAIL == $type){ |
|
| 72 | + } elseif(MailService::TRANSPORT_SENDMAIL == $type){ |
|
| 73 | 73 | return new Sendmail(); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | return $this; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function getUsername(){ |
|
| 102 | + public function getUsername() { |
|
| 103 | 103 | return $this->connectionConfig['username']; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | return $this; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - public function getPassword(){ |
|
| 113 | + public function getPassword() { |
|
| 114 | 114 | return $this->connectionConfig['password']; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | return $this; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - public function getSsl(){ |
|
| 124 | + public function getSsl() { |
|
| 125 | 125 | return $this->connectionConfig['ssl']; |
| 126 | 126 | } |
| 127 | 127 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | return $this; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - public function getTransportClass(){ |
|
| 133 | + public function getTransportClass() { |
|
| 134 | 134 | return $this->transportClass; |
| 135 | 135 | } |
| 136 | 136 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function getPath() |
| 141 | 141 | { |
| 142 | - if(is_null($this->path)){ |
|
| 142 | + if (is_null($this->path)) { |
|
| 143 | 143 | $this->setPath(sys_get_temp_dir().'/yawik/mails'); |
| 144 | 144 | } |
| 145 | 145 | return $this->path; |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | public function setPath($path) |
| 153 | 153 | { |
| 154 | - if(!is_dir($path)){ |
|
| 155 | - mkdir($path,0777,true); |
|
| 156 | - chmod($path,0777); |
|
| 154 | + if (!is_dir($path)) { |
|
| 155 | + mkdir($path, 0777, true); |
|
| 156 | + chmod($path, 0777); |
|
| 157 | 157 | } |
| 158 | 158 | $this->path = $path; |
| 159 | 159 | return $this; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | protected $currentUser; |
| 66 | 66 | |
| 67 | - public function __construct($parameters=[]) |
|
| 67 | + public function __construct($parameters = []) |
|
| 68 | 68 | { |
| 69 | 69 | $defaultLoginInfo = [ |
| 70 | 70 | 'facebook' => [ |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | 'session_password-login' => getenv('LINKEDIN_USER_PASSWORD') |
| 77 | 77 | ], |
| 78 | 78 | ]; |
| 79 | - $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info']:[]; |
|
| 80 | - $this->socialLoginInfo = array_merge($defaultLoginInfo,$socialLoginConfig); |
|
| 79 | + $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info'] : []; |
|
| 80 | + $this->socialLoginInfo = array_merge($defaultLoginInfo, $socialLoginConfig); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -87,13 +87,13 @@ discard block |
||
| 87 | 87 | static public function afterSuite(AfterSuiteScope $scope) |
| 88 | 88 | { |
| 89 | 89 | $repo = static::$userRepo; |
| 90 | - foreach(static::$users as $user){ |
|
| 91 | - if($repo->findByLogin($user->getLogin())){ |
|
| 92 | - try{ |
|
| 90 | + foreach (static::$users as $user) { |
|
| 91 | + if ($repo->findByLogin($user->getLogin())) { |
|
| 92 | + try { |
|
| 93 | 93 | JobContext::removeJobByUser($user); |
| 94 | - $repo->remove($user,true); |
|
| 94 | + $repo->remove($user, true); |
|
| 95 | 95 | $repo->getDocumentManager()->refresh($user); |
| 96 | - }catch (\Exception $e){ |
|
| 96 | + } catch (\Exception $e) { |
|
| 97 | 97 | |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | $provider = strtolower($provider); |
| 120 | 120 | $mink = $this->minkContext; |
| 121 | - foreach($this->socialLoginInfo[$provider] as $field=>$value){ |
|
| 122 | - $mink->fillField($field,$value); |
|
| 121 | + foreach ($this->socialLoginInfo[$provider] as $field=>$value) { |
|
| 122 | + $mink->fillField($field, $value); |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
@@ -127,15 +127,15 @@ discard block |
||
| 127 | 127 | * @Given I am logged in as a recruiter |
| 128 | 128 | * @Given I am logged in as a recruiter with :organization as organization |
| 129 | 129 | */ |
| 130 | - public function iAmLoggedInAsARecruiter($organization=null) |
|
| 130 | + public function iAmLoggedInAsARecruiter($organization = null) |
|
| 131 | 131 | { |
| 132 | 132 | $user = $this->thereIsAUserIdentifiedBy( |
| 133 | 133 | '[email protected]', |
| 134 | - 'test',User::ROLE_RECRUITER, |
|
| 134 | + 'test', User::ROLE_RECRUITER, |
|
| 135 | 135 | 'Test Recruiter', |
| 136 | 136 | $organization |
| 137 | 137 | ); |
| 138 | - $this->startLogin($user,'test'); |
|
| 138 | + $this->startLogin($user, 'test'); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -145,9 +145,9 @@ discard block |
||
| 145 | 145 | public function iDonTHaveUser($login) |
| 146 | 146 | { |
| 147 | 147 | $repo = $this->getUserRepository(); |
| 148 | - $user=$repo->findByLogin($login); |
|
| 149 | - if($user instanceof UserInterface){ |
|
| 150 | - $repo->remove($user,true); |
|
| 148 | + $user = $repo->findByLogin($login); |
|
| 149 | + if ($user instanceof UserInterface) { |
|
| 150 | + $repo->remove($user, true); |
|
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @param $role |
| 157 | 157 | * @param TableNode $fields |
| 158 | 158 | */ |
| 159 | - public function iHaveUserWithTheFollowing($role,TableNode $fields) |
|
| 159 | + public function iHaveUserWithTheFollowing($role, TableNode $fields) |
|
| 160 | 160 | { |
| 161 | 161 | $normalizedFields = [ |
| 162 | 162 | 'login' => '[email protected]', |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | 'password' => 'test', |
| 166 | 166 | 'organization' => 'Cross Solution' |
| 167 | 167 | ]; |
| 168 | - foreach($fields->getRowsHash() as $field=>$value){ |
|
| 168 | + foreach ($fields->getRowsHash() as $field=>$value) { |
|
| 169 | 169 | $field = Inflector::camelize($field); |
| 170 | 170 | $normalizedFields[$field] = $value; |
| 171 | 171 | } |
@@ -184,14 +184,14 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public function iAmLoggedInAsAnAdmin() |
| 186 | 186 | { |
| 187 | - $user = $this->thereIsAUserIdentifiedBy('[email protected]','test',User::ROLE_ADMIN); |
|
| 188 | - $this->startLogin($user,'test'); |
|
| 187 | + $user = $this->thereIsAUserIdentifiedBy('[email protected]', 'test', User::ROLE_ADMIN); |
|
| 188 | + $this->startLogin($user, 'test'); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | private function startLogin(UserInterface $user, $password) |
| 192 | 192 | { |
| 193 | 193 | $currentUser = $this->currentUser; |
| 194 | - if(!is_object($currentUser) || $user->getId()!=$currentUser->getId()){ |
|
| 194 | + if (!is_object($currentUser) || $user->getId() != $currentUser->getId()) { |
|
| 195 | 195 | $this->iWantToLogIn(); |
| 196 | 196 | $this->iSpecifyTheUsernameAs($user->getLogin()); |
| 197 | 197 | $this->iSpecifyThePasswordAs($password); |
@@ -211,16 +211,16 @@ discard block |
||
| 211 | 211 | /** |
| 212 | 212 | * @Given there is a user :email identified by :password |
| 213 | 213 | */ |
| 214 | - public function thereIsAUserIdentifiedBy($email, $password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter",$organization=null) |
|
| 214 | + public function thereIsAUserIdentifiedBy($email, $password, $role = User::ROLE_RECRUITER, $fullname = "Test Recruiter", $organization = null) |
|
| 215 | 215 | { |
| 216 | 216 | $repo = $this->getUserRepository(); |
| 217 | 217 | |
| 218 | - if(!is_object($user=$repo->findByEmail($email))){ |
|
| 219 | - $user = $this->createUser($email,$password,$role,$fullname,$organization); |
|
| 218 | + if (!is_object($user = $repo->findByEmail($email))) { |
|
| 219 | + $user = $this->createUser($email, $password, $role, $fullname, $organization); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if(!is_null($organization)){ |
|
| 223 | - $this->iHaveMainOrganization($user,$organization); |
|
| 222 | + if (!is_null($organization)) { |
|
| 223 | + $this->iHaveMainOrganization($user, $organization); |
|
| 224 | 224 | } |
| 225 | 225 | $this->addCreatedUser($user); |
| 226 | 226 | return $user; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * |
| 236 | 236 | * @return \Auth\Entity\UserInterface |
| 237 | 237 | */ |
| 238 | - public function createUser($email,$password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter") |
|
| 238 | + public function createUser($email, $password, $role = User::ROLE_RECRUITER, $fullname = "Test Recruiter") |
|
| 239 | 239 | { |
| 240 | 240 | /* @var Register $service */ |
| 241 | 241 | /* @var User $user */ |
@@ -246,10 +246,10 @@ discard block |
||
| 246 | 246 | $user->setRole($role); |
| 247 | 247 | $settings = $user->getSettings('Applications'); |
| 248 | 248 | |
| 249 | - $expFullName = explode(' ',$fullname); |
|
| 249 | + $expFullName = explode(' ', $fullname); |
|
| 250 | 250 | $info = $user->getInfo(); |
| 251 | 251 | $info->setFirstName(array_shift($expFullName)); |
| 252 | - $info->setLastName(count($expFullName)>0 ? implode(' ',$expFullName):''); |
|
| 252 | + $info->setLastName(count($expFullName) > 0 ? implode(' ', $expFullName) : ''); |
|
| 253 | 253 | $info->setEmail($email); |
| 254 | 254 | $info->setEmailVerified(true); |
| 255 | 255 | $repo->store($user); |
@@ -269,19 +269,19 @@ discard block |
||
| 269 | 269 | * @When I have :organization as my main organization |
| 270 | 270 | * @param $orgName |
| 271 | 271 | */ |
| 272 | - public function iHaveMainOrganization(UserInterface $user,$orgName) |
|
| 272 | + public function iHaveMainOrganization(UserInterface $user, $orgName) |
|
| 273 | 273 | { |
| 274 | 274 | /* @var $repoOrganization OrganizationRepository */ |
| 275 | 275 | $repoOrganization = $this->coreContext->getRepositories()->get('Organizations/Organization'); |
| 276 | - $organization=$repoOrganization->findByName($orgName); |
|
| 277 | - if(!$organization instanceof Organization){ |
|
| 276 | + $organization = $repoOrganization->findByName($orgName); |
|
| 277 | + if (!$organization instanceof Organization) { |
|
| 278 | 278 | $organization = new Organization(); |
| 279 | 279 | $organizationName = new OrganizationName($orgName); |
| 280 | 280 | $organization->setOrganizationName($organizationName); |
| 281 | 281 | $permissions = $organization->getPermissions(); |
| 282 | - $permissions->grant($user,Permissions::PERMISSION_ALL); |
|
| 283 | - }else { |
|
| 284 | - $organization->getPermissions()->grant($user,Permissions::PERMISSION_ALL); |
|
| 282 | + $permissions->grant($user, Permissions::PERMISSION_ALL); |
|
| 283 | + } else { |
|
| 284 | + $organization->getPermissions()->grant($user, Permissions::PERMISSION_ALL); |
|
| 285 | 285 | } |
| 286 | 286 | $organization->setUser($user); |
| 287 | 287 | $repoOrganization->store($organization); |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | public function iSpecifyTheUsernameAs($username) |
| 305 | 305 | { |
| 306 | - $this->minkContext->fillField('Login name',$username); |
|
| 306 | + $this->minkContext->fillField('Login name', $username); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | */ |
| 312 | 312 | public function iSpecifyThePasswordAs($password) |
| 313 | 313 | { |
| 314 | - $this->minkContext->fillField('Password',$password); |
|
| 314 | + $this->minkContext->fillField('Password', $password); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
@@ -322,8 +322,8 @@ discard block |
||
| 322 | 322 | $repo = $this->getUserRepository(); |
| 323 | 323 | $user = $repo->findByLogin($username); |
| 324 | 324 | |
| 325 | - if(!$user instanceof User){ |
|
| 326 | - throw new \Exception(sprintf('There is no user with this login: "%s"',$username)); |
|
| 325 | + if (!$user instanceof User) { |
|
| 326 | + throw new \Exception(sprintf('There is no user with this login: "%s"', $username)); |
|
| 327 | 327 | } |
| 328 | 328 | $this->iWantToLogIn(); |
| 329 | 329 | $this->iSpecifyTheUsernameAs($username); |
@@ -379,13 +379,13 @@ discard block |
||
| 379 | 379 | { |
| 380 | 380 | $repo = $this->getUserRepository(); |
| 381 | 381 | $data = $table->getRowsHash(); |
| 382 | - $email = isset($data['email']) ? $data['email']:'[email protected]'; |
|
| 383 | - $password = isset($data['password']) ? $data['password']:'test'; |
|
| 384 | - $fullname = isset($data['fullname']) ? $data['fullname']:'Test User'; |
|
| 385 | - $role = isset($data['role']) ? $data['role']:User::ROLE_RECRUITER; |
|
| 382 | + $email = isset($data['email']) ? $data['email'] : '[email protected]'; |
|
| 383 | + $password = isset($data['password']) ? $data['password'] : 'test'; |
|
| 384 | + $fullname = isset($data['fullname']) ? $data['fullname'] : 'Test User'; |
|
| 385 | + $role = isset($data['role']) ? $data['role'] : User::ROLE_RECRUITER; |
|
| 386 | 386 | |
| 387 | - if(!is_object($user=$repo->findByLogin($email))){ |
|
| 388 | - $user = $this->createUser($email,$password,$role,$fullname); |
|
| 387 | + if (!is_object($user = $repo->findByLogin($email))) { |
|
| 388 | + $user = $this->createUser($email, $password, $role, $fullname); |
|
| 389 | 389 | } |
| 390 | 390 | $this->currentUser = $user; |
| 391 | 391 | $this->addCreatedUser($user); |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | |
| 394 | 394 | private function addCreatedUser(UserInterface $user) |
| 395 | 395 | { |
| 396 | - if(!in_array($user,static::$users)){ |
|
| 396 | + if (!in_array($user, static::$users)) { |
|
| 397 | 397 | static::$users[] = $user; |
| 398 | 398 | } |
| 399 | 399 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | JobContext::removeJobByUser($user); |
| 94 | 94 | $repo->remove($user,true); |
| 95 | 95 | $repo->getDocumentManager()->refresh($user); |
| 96 | - }catch (\Exception $e){ |
|
| 96 | + } catch (\Exception $e){ |
|
| 97 | 97 | |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $organization->setOrganizationName($organizationName); |
| 281 | 281 | $permissions = $organization->getPermissions(); |
| 282 | 282 | $permissions->grant($user,Permissions::PERMISSION_ALL); |
| 283 | - }else { |
|
| 283 | + } else { |
|
| 284 | 284 | $organization->getPermissions()->grant($user,Permissions::PERMISSION_ALL); |
| 285 | 285 | } |
| 286 | 286 | $organization->setUser($user); |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $repo = static::$jobRepo; |
| 59 | 59 | $results = $repo->findBy(['user' => $user]); |
| 60 | - foreach($results as $result){ |
|
| 61 | - $repo->remove($result,true); |
|
| 60 | + foreach ($results as $result) { |
|
| 61 | + $repo->remove($result, true); |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | public function beforeScenario(BeforeScenarioScope $scope) |
| 71 | 71 | { |
| 72 | 72 | $this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class); |
| 73 | - if(is_null(static::$jobRepo)){ |
|
| 73 | + if (is_null(static::$jobRepo)) { |
|
| 74 | 74 | $this->gatherContexts($scope); |
| 75 | 75 | static::$jobRepo = $this->getJobRepository(); |
| 76 | 76 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function iGoToCreateJob() |
| 91 | 91 | { |
| 92 | - $url = $this->generateUrl('lang/jobs/manage',['action' => 'edit']); |
|
| 92 | + $url = $this->generateUrl('lang/jobs/manage', ['action' => 'edit']); |
|
| 93 | 93 | $this->visit($url); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | public function iGoToEditJobWithTitle($jobTitle) |
| 110 | 110 | { |
| 111 | 111 | $job = $this->getJobRepository()->findOneBy(['title' => $jobTitle]); |
| 112 | - if(!$job instanceof Job){ |
|
| 113 | - throw new \Exception(sprintf('Job with title "%s" is not found',$jobTitle)); |
|
| 112 | + if (!$job instanceof Job) { |
|
| 113 | + throw new \Exception(sprintf('Job with title "%s" is not found', $jobTitle)); |
|
| 114 | 114 | } |
| 115 | 115 | $this->currentJob = $job; |
| 116 | - $url = $this->generateUrl('lang/jobs/manage',[ |
|
| 116 | + $url = $this->generateUrl('lang/jobs/manage', [ |
|
| 117 | 117 | 'id' => $job->getId() |
| 118 | 118 | ]); |
| 119 | 119 | $this->visit($url); |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | $jobRepository = $this->getJobRepository(); |
| 141 | 141 | $results = $jobRepository->getUserJobs($user->getId()); |
| 142 | - foreach($results as $job){ |
|
| 143 | - $jobRepository->remove($job,true); |
|
| 142 | + foreach ($results as $job) { |
|
| 143 | + $jobRepository->remove($job, true); |
|
| 144 | 144 | } |
| 145 | 145 | $this->currentJob = null; |
| 146 | 146 | } |
@@ -149,16 +149,16 @@ discard block |
||
| 149 | 149 | * @When I fill job location search with :search and choose :choice |
| 150 | 150 | * |
| 151 | 151 | */ |
| 152 | - public function iFillJobLocationAndChoose($search,$choice) |
|
| 152 | + public function iFillJobLocationAndChoose($search, $choice) |
|
| 153 | 153 | { |
| 154 | 154 | $select2 = $this->select2Context; |
| 155 | - $select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice); |
|
| 155 | + $select2->iFillInSelect2FieldWith('jobBase[geoLocation]', $search, $choice); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
| 159 | 159 | * @When I choose :value from :field |
| 160 | 160 | */ |
| 161 | - public function iJobClassificationSelect($value,$field) |
|
| 161 | + public function iJobClassificationSelect($value, $field) |
|
| 162 | 162 | { |
| 163 | 163 | $field = Inflector::camelize($field); |
| 164 | 164 | |
@@ -174,18 +174,18 @@ discard block |
||
| 174 | 174 | 'employmentTypes' => "select#classifications-employmentTypes", |
| 175 | 175 | ]; |
| 176 | 176 | |
| 177 | - if(!isset($mapSelect2[$field])){ |
|
| 177 | + if (!isset($mapSelect2[$field])) { |
|
| 178 | 178 | throw new \Exception('Undefined field selection value "'.$field.'"'); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | $multipleField = $mapMultiple[$field]; |
| 182 | 182 | $page = $this->minkContext->getSession()->getPage(); |
| 183 | - $element = $page->find('css',$mapMultiple[$field]); |
|
| 184 | - if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){ |
|
| 185 | - $this->minkContext->selectOption($value,$multipleField); |
|
| 186 | - }else{ |
|
| 183 | + $element = $page->find('css', $mapMultiple[$field]); |
|
| 184 | + if (!is_null($element) && $element->getAttribute('multiple') == 'multiple') { |
|
| 185 | + $this->minkContext->selectOption($value, $multipleField); |
|
| 186 | + } else { |
|
| 187 | 187 | $locator = $mapSelect2[$field]; |
| 188 | - $this->select2Context->iFillInSelect2Field($locator,$value); |
|
| 188 | + $this->select2Context->iFillInSelect2Field($locator, $value); |
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | |
@@ -209,62 +209,62 @@ discard block |
||
| 209 | 209 | * @When I have a :status job with the following: |
| 210 | 210 | * @param TableNode $fields |
| 211 | 211 | */ |
| 212 | - public function iHaveAJobWithTheFollowing($status,TableNode $fields) |
|
| 212 | + public function iHaveAJobWithTheFollowing($status, TableNode $fields) |
|
| 213 | 213 | { |
| 214 | 214 | $normalizedField = [ |
| 215 | 215 | 'template' => 'modern', |
| 216 | 216 | ]; |
| 217 | - foreach($fields->getRowsHash() as $field => $value){ |
|
| 217 | + foreach ($fields->getRowsHash() as $field => $value) { |
|
| 218 | 218 | $field = Inflector::camelize($field); |
| 219 | - if($field == 'professions' || $field == 'industries'){ |
|
| 220 | - $value = explode(',',$value); |
|
| 219 | + if ($field == 'professions' || $field == 'industries') { |
|
| 220 | + $value = explode(',', $value); |
|
| 221 | 221 | } |
| 222 | 222 | $normalizedField[$field] = $value; |
| 223 | 223 | } |
| 224 | 224 | $jobRepo = $this->getJobRepository(); |
| 225 | 225 | $job = $jobRepo->findOneBy(['title' => $normalizedField['title']]); |
| 226 | - if(!$job instanceof Job){ |
|
| 226 | + if (!$job instanceof Job) { |
|
| 227 | 227 | $job = new Job(); |
| 228 | 228 | $job->setTitle($normalizedField['title']); |
| 229 | 229 | } |
| 230 | - if(isset($normalizedField['user'])){ |
|
| 230 | + if (isset($normalizedField['user'])) { |
|
| 231 | 231 | /* @var $userRepo UserRepository */ |
| 232 | 232 | $user = $this->getUserContext()->getCurrentUser(); |
| 233 | 233 | $jobRepo->getDocumentManager()->refresh($user); |
| 234 | - if($user instanceof User){ |
|
| 234 | + if ($user instanceof User) { |
|
| 235 | 235 | $job->setUser($user); |
| 236 | 236 | $job->setOrganization($user->getOrganization()->getOrganization()); |
| 237 | - }else{ |
|
| 237 | + } else { |
|
| 238 | 238 | throw new \Exception('There is no user with this login:"'.$normalizedField['user'.'"']); |
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - if($status == 'draft'){ |
|
| 242 | + if ($status == 'draft') { |
|
| 243 | 243 | $job->setIsDraft(true); |
| 244 | - }elseif($status == 'published'){ |
|
| 244 | + }elseif ($status == 'published') { |
|
| 245 | 245 | $job->setIsDraft(false); |
| 246 | 246 | $job->setDatePublishStart(new \DateTime()); |
| 247 | 247 | } |
| 248 | 248 | $job->setStatus(Status::ACTIVE); |
| 249 | 249 | |
| 250 | - if(isset($normalizedField['location'])){ |
|
| 251 | - $this->setLocation($job,$normalizedField['location']); |
|
| 250 | + if (isset($normalizedField['location'])) { |
|
| 251 | + $this->setLocation($job, $normalizedField['location']); |
|
| 252 | 252 | } |
| 253 | - if(isset($normalizedField['companyName'])){ |
|
| 253 | + if (isset($normalizedField['companyName'])) { |
|
| 254 | 254 | //$job->setCompany($normalizedField['companyName']); |
| 255 | 255 | } |
| 256 | - if(isset($normalizedField['professions'])){ |
|
| 257 | - $this->addProfessions($job,$normalizedField['professions']); |
|
| 256 | + if (isset($normalizedField['professions'])) { |
|
| 257 | + $this->addProfessions($job, $normalizedField['professions']); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - if(isset($normalizedField['industries'])){ |
|
| 261 | - $this->addIndustries($job,$normalizedField['industries']); |
|
| 260 | + if (isset($normalizedField['industries'])) { |
|
| 261 | + $this->addIndustries($job, $normalizedField['industries']); |
|
| 262 | 262 | } |
| 263 | - if(isset($normalizedField['employmentTypes'])){ |
|
| 263 | + if (isset($normalizedField['employmentTypes'])) { |
|
| 264 | 264 | $types = $this->getCategories([$normalizedField['employmentTypes']]); |
| 265 | 265 | $type = array_shift($types); |
| 266 | 266 | $values = $job->getClassifications()->getEmploymentTypes()->getValues(); |
| 267 | - if(!is_array($values) || !in_array($type,$values)){ |
|
| 267 | + if (!is_array($values) || !in_array($type, $values)) { |
|
| 268 | 268 | $job->getClassifications()->getEmploymentTypes()->getItems()->add($type); |
| 269 | 269 | } |
| 270 | 270 | } |
@@ -283,18 +283,18 @@ discard block |
||
| 283 | 283 | $location->fromString($serialized); |
| 284 | 284 | |
| 285 | 285 | $locations = $job->getLocations(); |
| 286 | - if(count($locations)){ |
|
| 286 | + if (count($locations)) { |
|
| 287 | 287 | $locations->clear(); |
| 288 | 288 | } |
| 289 | 289 | $job->getLocations()->add($location); |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - private function addProfessions(Job &$job,$terms) |
|
| 292 | + private function addProfessions(Job &$job, $terms) |
|
| 293 | 293 | { |
| 294 | 294 | $professions = $this->getCategories($terms); |
| 295 | - foreach($professions as $profession){ |
|
| 295 | + foreach ($professions as $profession) { |
|
| 296 | 296 | $values = $job->getClassifications()->getProfessions()->getValues(); |
| 297 | - if(!is_array($values) || !in_array($profession,$values)){ |
|
| 297 | + if (!is_array($values) || !in_array($profession, $values)) { |
|
| 298 | 298 | $job->getClassifications()->getProfessions()->getItems()->add($profession); |
| 299 | 299 | } |
| 300 | 300 | } |
@@ -303,9 +303,9 @@ discard block |
||
| 303 | 303 | private function addIndustries(Job &$job, $terms) |
| 304 | 304 | { |
| 305 | 305 | $industries = $this->getCategories($terms); |
| 306 | - foreach($industries as $industry){ |
|
| 306 | + foreach ($industries as $industry) { |
|
| 307 | 307 | $values = $job->getClassifications()->getIndustries()->getValues(); |
| 308 | - if(!is_array($values) || !in_array($industry,$values)){ |
|
| 308 | + if (!is_array($values) || !in_array($industry, $values)) { |
|
| 309 | 309 | $job->getClassifications()->getIndustries()->getItems()->add($industry); |
| 310 | 310 | } |
| 311 | 311 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | |
| 341 | 341 | $job = $repo->findDraft($user); |
| 342 | 342 | |
| 343 | - if(is_null($job)){ |
|
| 343 | + if (is_null($job)) { |
|
| 344 | 344 | $job = new Job(); |
| 345 | 345 | $job |
| 346 | 346 | ->setUser($user) |
@@ -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 | ], |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | 'controllers' => [ |
| 51 | 51 | 'factories' => [ |
| 52 | - 'Organizations/InviteEmployee' => [\Organizations\Controller\InviteEmployeeController::class,'factory'], |
|
| 52 | + 'Organizations/InviteEmployee' => [\Organizations\Controller\InviteEmployeeController::class, 'factory'], |
|
| 53 | 53 | 'Organizations/Index' => 'Organizations\Factory\Controller\IndexControllerFactory', |
| 54 | - 'Organizations/Profile' => [\Organizations\Controller\ProfileController::class,'factory'] |
|
| 54 | + 'Organizations/Profile' => [\Organizations\Controller\ProfileController::class, 'factory'] |
|
| 55 | 55 | ] |
| 56 | 56 | ], |
| 57 | 57 | |
@@ -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' => [ |
@@ -147,11 +147,11 @@ discard block |
||
| 147 | 147 | 'allow' => [ |
| 148 | 148 | 'Entity/OrganizationImage', |
| 149 | 149 | 'route/lang/organizations/invite', |
| 150 | - 'Organizations/InviteEmployee' => [ 'accept' ], |
|
| 150 | + 'Organizations/InviteEmployee' => ['accept'], |
|
| 151 | 151 | ], |
| 152 | 152 | 'deny' => [ |
| 153 | 153 | 'route/lang/organizations', |
| 154 | - 'Organizations/InviteEmployee' => [ 'invite' ], |
|
| 154 | + 'Organizations/InviteEmployee' => ['invite'], |
|
| 155 | 155 | ], |
| 156 | 156 | ], |
| 157 | 157 | // recruiters are allowed to view their companies |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | 'allow' => [ |
| 160 | 160 | 'route/lang/organizations', |
| 161 | 161 | 'Organizations/InviteEmployee', |
| 162 | - 'Entity/Organization' => [ 'edit' => 'Organizations/Write' ], |
|
| 162 | + 'Entity/Organization' => ['edit' => 'Organizations/Write'], |
|
| 163 | 163 | ], |
| 164 | 164 | ], |
| 165 | 165 | ], |
@@ -175,8 +175,8 @@ discard block |
||
| 175 | 175 | 'organizations' => [ |
| 176 | 176 | 'label' => 'Organizations', |
| 177 | 177 | 'route' => 'lang/organizations', |
| 178 | - 'order' => 65, // allows to order the menu items |
|
| 179 | - 'resource' => 'route/lang/organizations', // if a resource is defined, the acl will be applied. |
|
| 178 | + 'order' => 65, // allows to order the menu items |
|
| 179 | + 'resource' => 'route/lang/organizations', // if a resource is defined, the acl will be applied. |
|
| 180 | 180 | |
| 181 | 181 | 'pages' => [ |
| 182 | 182 | 'list' => [ |