Completed
Push — develop ( dce9ea...970920 )
by Mathias
30s queued 20s
created
public/index.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,23 +11,23 @@  discard block
 block discarded – undo
11 11
 
12 12
 date_default_timezone_set('Europe/Berlin');
13 13
 
14
-if(!version_compare(PHP_VERSION, '5.6.0', 'ge')){
15
-    echo sprintf('<p>Sorry, YAWIK requires at least PHP 5.6.0 to run, but this server currently provides PHP %s</p>',PHP_VERSION);
14
+if (!version_compare(PHP_VERSION, '5.6.0', 'ge')) {
15
+    echo sprintf('<p>Sorry, YAWIK requires at least PHP 5.6.0 to run, but this server currently provides PHP %s</p>', PHP_VERSION);
16 16
     echo '<p>Please ask your servers\' administrator to install the proper PHP version.</p>';
17 17
     exit;
18 18
 }
19 19
 
20 20
 if (php_sapi_name() == 'cli-server') {
21 21
     $parseUrl = parse_url(substr($_SERVER["REQUEST_URI"], 1));
22
-    $route = isset($parseUrl['path']) ? $parseUrl['path']:null;
23
-    if (is_file(__DIR__ . '/' . $route)) {
24
-        if(substr($route, -4) == ".php"){
25
-            require __DIR__ . '/' . $route;     // Include requested script files
22
+    $route = isset($parseUrl['path']) ? $parseUrl['path'] : null;
23
+    if (is_file(__DIR__.'/'.$route)) {
24
+        if (substr($route, -4) == ".php") {
25
+            require __DIR__.'/'.$route; // Include requested script files
26 26
             exit;
27 27
         }
28
-        return false;           // Serve file as is
28
+        return false; // Serve file as is
29 29
     } else {                    // Fallback to index.php
30
-        $_GET["q"] = $route;    // Try to emulate the behaviour of a .htaccess here.
30
+        $_GET["q"] = $route; // Try to emulate the behaviour of a .htaccess here.
31 31
     }
32 32
 }
33 33
 
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 } else {
48 48
     echo '<p>Could not initialize autoloading. This happens, if the dependencies are not installed yet.</p>';
49 49
     echo '<p>Please try to install the dependencies via: </p>';
50
-    echo '<code>cd '. realpath('.') .'<br>./install.sh</code>';
51
-    echo '<p>exit at ' . __FILE__ . ' in line ' . __LINE__ .'</p>';
50
+    echo '<code>cd '.realpath('.').'<br>./install.sh</code>';
51
+    echo '<p>exit at '.__FILE__.' in line '.__LINE__.'</p>';
52 52
     exit;
53 53
 }
54 54
 
Please login to merge, or discard this patch.
module/Behat/src/ApplicationContext.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@
 block discarded – undo
35 35
 		/* @var $repo JobRepository */
36 36
 		$repo = $this->getRepository('Jobs/Job');
37 37
 		$job = $repo->findOneBy(['title' => $title]);
38
-		if(!$job instanceof Job){
38
+		if (!$job instanceof Job) {
39 39
 			throw new \Exception('There is no job titled: "'.$title.'"');
40 40
 		}
41 41
 		$job->setApplyId($job->getId());
42 42
 		$repo->store($job);
43 43
 
44
-		$url = $this->generateUrl('lang/apply',[
44
+		$url = $this->generateUrl('lang/apply', [
45 45
 		    'applyId' => $job->getApplyId()
46 46
         ]);
47 47
 		$this->visit($url);
Please login to merge, or discard this patch.
module/Behat/src/InstallContext.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 
32 32
     public function __construct()
33 33
     {
34
-        static::$configFile = getcwd() . '/config/autoload/install.module.php';
35
-        static::$yawikGlobalConfig = getcwd() . '/config/autoload/yawik.config.global.php';
34
+        static::$configFile = getcwd().'/config/autoload/install.module.php';
35
+        static::$yawikGlobalConfig = getcwd().'/config/autoload/yawik.config.global.php';
36 36
         static::$yawikBackupConfig = str_replace('yawik.config.global.php', 'yawik.backup', static::$yawikGlobalConfig);
37 37
     }
38 38
 
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
     public function iHaveInstallModuleActivated()
43 43
     {
44 44
         $target = static::$configFile;
45
-        if(!file_exists($target)){
45
+        if (!file_exists($target)) {
46 46
             $source = __DIR__.'/../resources/install.module.php';
47
-            copy($source,$target);
48
-            chmod($target,0777);
47
+            copy($source, $target);
48
+            chmod($target, 0777);
49 49
         }
50 50
 
51 51
         // backup existing file
52 52
         $yawikBackupConfig = static::$yawikBackupConfig;
53 53
         $yawikGlobalConfig = static::$yawikGlobalConfig;
54 54
 
55
-        if(is_file($yawikGlobalConfig)){
56
-            rename($yawikGlobalConfig,$yawikBackupConfig);
55
+        if (is_file($yawikGlobalConfig)) {
56
+            rename($yawikGlobalConfig, $yawikBackupConfig);
57 57
         }
58 58
     }
59 59
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
     static public function restoreConfig()
94 94
     {
95
-        if(is_file($file = static::$configFile)){
95
+        if (is_file($file = static::$configFile)) {
96 96
             unlink($file);
97 97
         }
98 98
 
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
         $yawikBackupConfig = static::$yawikBackupConfig;
101 101
         $yawikGlobalConfig = static::$yawikGlobalConfig;
102 102
 
103
-        if(is_file($yawikBackupConfig)){
104
-            rename($yawikBackupConfig,$yawikGlobalConfig);
103
+        if (is_file($yawikBackupConfig)) {
104
+            rename($yawikBackupConfig, $yawikGlobalConfig);
105 105
         }
106 106
     }
107 107
 
@@ -112,6 +112,6 @@  discard block
 block discarded – undo
112 112
     {
113 113
         $config = $this->getService('config');
114 114
         $connection = $config['doctrine']['connection']['odm_default']['connectionString'];
115
-        $this->minkContext->fillField('db_conn',$connection);
115
+        $this->minkContext->fillField('db_conn', $connection);
116 116
     }
117 117
 }
Please login to merge, or discard this patch.
module/Behat/src/CommonContextTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,16 +51,16 @@
 block discarded – undo
51 51
 		$this->summaryFormContext = $scope->getEnvironment()->getContext(SummaryFormContext::class);
52 52
 	}
53 53
 	
54
-	public function generateUrl($name,array $params=array(),array $options=array())
54
+	public function generateUrl($name, array $params = array(), array $options = array())
55 55
 	{
56 56
 	    $defaults = ['lang'=>'en'];
57
-	    $params = array_merge($defaults,$params);
57
+	    $params = array_merge($defaults, $params);
58 58
         /* @var Url $urlHelper */
59 59
         $urlHelper = $this
60 60
             ->getService('ViewHelperManager')
61 61
             ->get('url')
62 62
         ;
63
-        $url = $urlHelper($name,$params,$options);
63
+        $url = $urlHelper($name, $params, $options);
64 64
 
65 65
         return $this->coreContext->generateUrl($url);
66 66
 	}
Please login to merge, or discard this patch.
module/Behat/src/UserContext.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,12 +87,12 @@  discard block
 block discarded – undo
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);
95
-				}catch (\Exception $e){
94
+					$repo->remove($user, true);
95
+				} catch (\Exception $e) {
96 96
 				
97 97
 				}
98 98
 			}
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	{
118 118
 		$provider = strtolower($provider);
119 119
 		$mink = $this->minkContext;
120
-		foreach($this->socialLoginInfo[$provider] as $field=>$value){
121
-			$mink->fillField($field,$value);
120
+		foreach ($this->socialLoginInfo[$provider] as $field=>$value) {
121
+			$mink->fillField($field, $value);
122 122
 		}
123 123
 	}
124 124
 	
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
 	 * @Given I am logged in as a recruiter
127 127
 	 * @Given I am logged in as a recruiter with :organization as organization
128 128
 	 */
129
-	public function iAmLoggedInAsARecruiter($organization=null)
129
+	public function iAmLoggedInAsARecruiter($organization = null)
130 130
 	{
131 131
 		$user = $this->thereIsAUserIdentifiedBy(
132 132
 			'[email protected]',
133
-			'test',User::ROLE_RECRUITER,
133
+			'test', User::ROLE_RECRUITER,
134 134
 			'Test Recruiter',
135 135
 			$organization
136 136
 		);
137
-		$this->startLogin($user,'test');
137
+		$this->startLogin($user, 'test');
138 138
 	}
139 139
 	
140 140
 	/**
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 	public function iDonTHaveUser($login)
145 145
 	{
146 146
 		$repo = $this->getUserRepository();
147
-		$user=$repo->findByLogin($login);
148
-		if($user instanceof UserInterface){
149
-			$repo->remove($user,true);
147
+		$user = $repo->findByLogin($login);
148
+		if ($user instanceof UserInterface) {
149
+			$repo->remove($user, true);
150 150
 		}
151 151
 	}
152 152
 	
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @param $role
156 156
 	 * @param TableNode $fields
157 157
 	 */
158
-	public function iHaveUserWithTheFollowing($role,TableNode $fields)
158
+	public function iHaveUserWithTheFollowing($role, TableNode $fields)
159 159
 	{
160 160
 		$normalizedFields = [
161 161
 			'login' => '[email protected]',
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 			'password' => 'test',
165 165
 			'organization' => 'Cross Solution'
166 166
 		];
167
-		foreach($fields->getRowsHash() as $field=>$value){
167
+		foreach ($fields->getRowsHash() as $field=>$value) {
168 168
 			$field = Inflector::camelize($field);
169 169
 			$normalizedFields[$field] = $value;
170 170
 		}
@@ -184,14 +184,14 @@  discard block
 block discarded – undo
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,15 +211,15 @@  discard block
 block discarded – undo
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
-		if(!is_object($user=$repo->findByEmail($email))){
218
-			$user = $this->createUser($email,$password,$role,$fullname,$organization);
217
+		if (!is_object($user = $repo->findByEmail($email))) {
218
+			$user = $this->createUser($email, $password, $role, $fullname, $organization);
219 219
 		}
220 220
 		
221
-		if(!is_null($organization)){
222
-			$this->iHaveMainOrganization($user,$organization);
221
+		if (!is_null($organization)) {
222
+			$this->iHaveMainOrganization($user, $organization);
223 223
 		}
224 224
 		$this->addCreatedUser($user);
225 225
 		return $user;
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	 *
235 235
 	 * @return \Auth\Entity\UserInterface
236 236
 	 */
237
-	public function createUser($email,$password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter")
237
+	public function createUser($email, $password, $role = User::ROLE_RECRUITER, $fullname = "Test Recruiter")
238 238
 	{
239 239
 		/* @var Register $service */
240 240
 		/* @var User $user */
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 		$user->setRole($role);
246 246
 		$settings = $user->getSettings('Applications');
247 247
 		
248
-		$expFullName = explode(' ',$fullname);
248
+		$expFullName = explode(' ', $fullname);
249 249
 		$info = $user->getInfo();
250 250
 		$info->setFirstName(array_shift($expFullName));
251
-		$info->setLastName(count($expFullName)>0 ? implode(' ',$expFullName):'');
251
+		$info->setLastName(count($expFullName) > 0 ? implode(' ', $expFullName) : '');
252 252
 		$info->setEmail($email);
253 253
 		$info->setEmailVerified(true);
254 254
 		$repo->store($user);
@@ -273,19 +273,19 @@  discard block
 block discarded – undo
273 273
 	 * @When I have :organization as my main organization
274 274
 	 * @param $orgName
275 275
 	 */
276
-	public function iHaveMainOrganization(UserInterface $user,$orgName)
276
+	public function iHaveMainOrganization(UserInterface $user, $orgName)
277 277
 	{
278 278
 		/* @var $repoOrganization OrganizationRepository */
279 279
 		$repoOrganization = $this->coreContext->getRepositories()->get('Organizations/Organization');
280
-		$organization=$repoOrganization->findByName($orgName);
281
-		if(!$organization instanceof Organization){
280
+		$organization = $repoOrganization->findByName($orgName);
281
+		if (!$organization instanceof Organization) {
282 282
 			$organization = new Organization();
283 283
 			$organizationName = new OrganizationName($orgName);
284 284
 			$organization->setOrganizationName($organizationName);
285 285
 			$permissions = $organization->getPermissions();
286
-			$permissions->grant($user,Permissions::PERMISSION_ALL);
287
-		}else {
288
-			$organization->getPermissions()->grant($user,Permissions::PERMISSION_ALL);
286
+			$permissions->grant($user, Permissions::PERMISSION_ALL);
287
+		} else {
288
+			$organization->getPermissions()->grant($user, Permissions::PERMISSION_ALL);
289 289
 		}
290 290
 		$organization->setUser($user);
291 291
 		$repoOrganization->store($organization);
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 */
308 308
 	public function iSpecifyTheUsernameAs($username)
309 309
 	{
310
-		$this->minkContext->fillField('Login name',$username);
310
+		$this->minkContext->fillField('Login name', $username);
311 311
 	}
312 312
 	
313 313
 	/**
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	public function iSpecifyThePasswordAs($password)
317 317
 	{
318
-		$this->minkContext->fillField('Password',$password);
318
+		$this->minkContext->fillField('Password', $password);
319 319
 	}
320 320
 	
321 321
 	/**
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
 		$repo = $this->getUserRepository();
327 327
 		$user = $repo->findByLogin($username);
328 328
 		
329
-		if(!$user instanceof User){
330
-			throw new \Exception(sprintf('There is no user with this login: "%s"',$username));
329
+		if (!$user instanceof User) {
330
+			throw new \Exception(sprintf('There is no user with this login: "%s"', $username));
331 331
 		}
332 332
 		$this->iWantToLogIn();
333 333
 		$this->iSpecifyTheUsernameAs($username);
@@ -383,13 +383,13 @@  discard block
 block discarded – undo
383 383
 	{
384 384
 		$repo = $this->getUserRepository();
385 385
 		$data = $table->getRowsHash();
386
-		$email = isset($data['email']) ? $data['email']:'[email protected]';
387
-		$password = isset($data['password']) ? $data['password']:'test';
388
-		$fullname = isset($data['fullname']) ? $data['fullname']:'Test User';
389
-		$role = isset($data['role']) ? $data['role']:User::ROLE_RECRUITER;
386
+		$email = isset($data['email']) ? $data['email'] : '[email protected]';
387
+		$password = isset($data['password']) ? $data['password'] : 'test';
388
+		$fullname = isset($data['fullname']) ? $data['fullname'] : 'Test User';
389
+		$role = isset($data['role']) ? $data['role'] : User::ROLE_RECRUITER;
390 390
 		
391
-		if(!is_object($user=$repo->findByLogin($email))){
392
-			$user = $this->createUser($email,$password,$role,$fullname);
391
+		if (!is_object($user = $repo->findByLogin($email))) {
392
+			$user = $this->createUser($email, $password, $role, $fullname);
393 393
 		}
394 394
 		$this->currentUser = $user;
395 395
 		$this->addCreatedUser($user);
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 	
398 398
 	private function addCreatedUser(UserInterface $user)
399 399
 	{
400
-		if(!in_array($user,static::$users)){
400
+		if (!in_array($user, static::$users)) {
401 401
 			static::$users[] = $user;
402 402
 		}
403 403
 	}
Please login to merge, or discard this patch.
module/Behat/src/SettingsContext.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 	 */
32 32
 	public function iGoToEmailTemplatePage()
33 33
 	{
34
-	    $url = $this->generateUrl('lang/settings',[
34
+	    $url = $this->generateUrl('lang/settings', [
35 35
 	        'module' => 'Applications'
36 36
         ]);
37 37
 		$this->visit($url);
Please login to merge, or discard this patch.
module/Behat/src/JobContext.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 			$userRepo = $this->getRepository('Auth\Entity\User');
233 233
 			$user = $userRepo->findOneBy(['login' => $normalizedField['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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.