Completed
Pull Request — develop (#457)
by ANTHONIUS
08:05
created
module/Behat/src/UserContext.php 1 patch
Indentation   +332 added lines, -332 removed lines patch added patch discarded remove patch
@@ -37,384 +37,384 @@
 block discarded – undo
37 37
 {
38 38
     use CommonContextTrait;
39 39
 	
40
-	/**
41
-	 * @var User[]
42
-	 */
43
-	static private $users = [];
40
+    /**
41
+     * @var User[]
42
+     */
43
+    static private $users = [];
44 44
 	
45
-	/**
46
-	 * @var UserRepository
47
-	 */
48
-	static private $userRepo;
45
+    /**
46
+     * @var UserRepository
47
+     */
48
+    static private $userRepo;
49 49
 	
50
-	/**
51
-	 * @var string
52
-	 */
53
-	static private $currentSession;
50
+    /**
51
+     * @var string
52
+     */
53
+    static private $currentSession;
54 54
 	
55
-	private $socialLoginInfo = [];
55
+    private $socialLoginInfo = [];
56 56
 	
57
-	/**
58
-	 * @var UserInterface
59
-	 */
60
-	private $loggedInUser;
57
+    /**
58
+     * @var UserInterface
59
+     */
60
+    private $loggedInUser;
61 61
 
62 62
     /**
63 63
      * @var User
64 64
      */
65 65
     protected $currentUser;
66 66
 	
67
-	public function __construct($parameters=[])
68
-	{
69
-		$defaultLoginInfo = [
70
-			'facebook' => [
71
-				'email' => getenv('FACEBOOK_USER_EMAIL'),
72
-				'pass' => getenv('FACEBOOK_USER_PASSWORD')
73
-			],
74
-			'linkedin' => [
75
-				'session_key-login' => getenv('LINKEDIN_USER_EMAIL'),
76
-				'session_password-login' => getenv('LINKEDIN_USER_PASSWORD')
77
-			],
78
-		];
79
-		$socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info']:[];
80
-		$this->socialLoginInfo = array_merge($defaultLoginInfo,$socialLoginConfig);
81
-	}
67
+    public function __construct($parameters=[])
68
+    {
69
+        $defaultLoginInfo = [
70
+            'facebook' => [
71
+                'email' => getenv('FACEBOOK_USER_EMAIL'),
72
+                'pass' => getenv('FACEBOOK_USER_PASSWORD')
73
+            ],
74
+            'linkedin' => [
75
+                'session_key-login' => getenv('LINKEDIN_USER_EMAIL'),
76
+                'session_password-login' => getenv('LINKEDIN_USER_PASSWORD')
77
+            ],
78
+        ];
79
+        $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info']:[];
80
+        $this->socialLoginInfo = array_merge($defaultLoginInfo,$socialLoginConfig);
81
+    }
82 82
 
83
-	/**
84
-	 * @AfterSuite
85
-	 * @param AfterSuiteScope $scope
86
-	 */
87
-	static public function afterSuite(AfterSuiteScope $scope)
88
-	{
89
-		$repo = static::$userRepo;
90
-		foreach(static::$users as $user){
91
-			if($repo->findByLogin($user->getLogin())){
92
-				try{
93
-					JobContext::removeJobByUser($user);
94
-					$repo->remove($user,true);
95
-				}catch (\Exception $e){
83
+    /**
84
+     * @AfterSuite
85
+     * @param AfterSuiteScope $scope
86
+     */
87
+    static public function afterSuite(AfterSuiteScope $scope)
88
+    {
89
+        $repo = static::$userRepo;
90
+        foreach(static::$users as $user){
91
+            if($repo->findByLogin($user->getLogin())){
92
+                try{
93
+                    JobContext::removeJobByUser($user);
94
+                    $repo->remove($user,true);
95
+                }catch (\Exception $e){
96 96
 				
97
-				}
98
-			}
99
-		}
100
-	}
97
+                }
98
+            }
99
+        }
100
+    }
101 101
 	
102
-	/**
103
-	 * @BeforeScenario
104
-	 * @param BeforeScenarioScope $scope
105
-	 */
106
-	public function beforeScenario(BeforeScenarioScope $scope)
107
-	{
108
-		$this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class);
109
-		$this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class);
110
-		static::$userRepo = $this->getUserRepository();
111
-	}
102
+    /**
103
+     * @BeforeScenario
104
+     * @param BeforeScenarioScope $scope
105
+     */
106
+    public function beforeScenario(BeforeScenarioScope $scope)
107
+    {
108
+        $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class);
109
+        $this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class);
110
+        static::$userRepo = $this->getUserRepository();
111
+    }
112 112
 	
113
-	/**
114
-	 * @When I fill in login form with :provider user
115
-	 */
116
-	public function iSignInWithSocialUser($provider)
117
-	{
118
-		$provider = strtolower($provider);
119
-		$mink = $this->minkContext;
120
-		foreach($this->socialLoginInfo[$provider] as $field=>$value){
121
-			$mink->fillField($field,$value);
122
-		}
123
-	}
113
+    /**
114
+     * @When I fill in login form with :provider user
115
+     */
116
+    public function iSignInWithSocialUser($provider)
117
+    {
118
+        $provider = strtolower($provider);
119
+        $mink = $this->minkContext;
120
+        foreach($this->socialLoginInfo[$provider] as $field=>$value){
121
+            $mink->fillField($field,$value);
122
+        }
123
+    }
124 124
 	
125
-	/**
126
-	 * @Given I am logged in as a recruiter
127
-	 * @Given I am logged in as a recruiter with :organization as organization
128
-	 */
129
-	public function iAmLoggedInAsARecruiter($organization=null)
130
-	{
131
-		$user = $this->thereIsAUserIdentifiedBy(
132
-			'[email protected]',
133
-			'test',User::ROLE_RECRUITER,
134
-			'Test Recruiter',
135
-			$organization
136
-		);
137
-		$this->startLogin($user,'test');
138
-	}
125
+    /**
126
+     * @Given I am logged in as a recruiter
127
+     * @Given I am logged in as a recruiter with :organization as organization
128
+     */
129
+    public function iAmLoggedInAsARecruiter($organization=null)
130
+    {
131
+        $user = $this->thereIsAUserIdentifiedBy(
132
+            '[email protected]',
133
+            'test',User::ROLE_RECRUITER,
134
+            'Test Recruiter',
135
+            $organization
136
+        );
137
+        $this->startLogin($user,'test');
138
+    }
139 139
 	
140
-	/**
141
-	 * @Given I don't have :login user
142
-	 * @param string $login
143
-	 */
144
-	public function iDonTHaveUser($login)
145
-	{
146
-		$repo = $this->getUserRepository();
147
-		$user=$repo->findByLogin($login);
148
-		if($user instanceof UserInterface){
149
-			$repo->remove($user,true);
150
-		}
151
-	}
140
+    /**
141
+     * @Given I don't have :login user
142
+     * @param string $login
143
+     */
144
+    public function iDonTHaveUser($login)
145
+    {
146
+        $repo = $this->getUserRepository();
147
+        $user=$repo->findByLogin($login);
148
+        if($user instanceof UserInterface){
149
+            $repo->remove($user,true);
150
+        }
151
+    }
152 152
 	
153
-	/**
154
-	 * @Given I have a :role with the following:
155
-	 * @param $role
156
-	 * @param TableNode $fields
157
-	 */
158
-	public function iHaveUserWithTheFollowing($role,TableNode $fields)
159
-	{
160
-		$normalizedFields = [
161
-			'login' => '[email protected]',
162
-			'fullname' => 'Test Login',
163
-			'role' => User::ROLE_USER,
164
-			'password' => 'test',
165
-			'organization' => 'Cross Solution'
166
-		];
167
-		foreach($fields->getRowsHash() as $field=>$value){
168
-			$field = Inflector::camelize($field);
169
-			$normalizedFields[$field] = $value;
170
-		}
153
+    /**
154
+     * @Given I have a :role with the following:
155
+     * @param $role
156
+     * @param TableNode $fields
157
+     */
158
+    public function iHaveUserWithTheFollowing($role,TableNode $fields)
159
+    {
160
+        $normalizedFields = [
161
+            'login' => '[email protected]',
162
+            'fullname' => 'Test Login',
163
+            'role' => User::ROLE_USER,
164
+            'password' => 'test',
165
+            'organization' => 'Cross Solution'
166
+        ];
167
+        foreach($fields->getRowsHash() as $field=>$value){
168
+            $field = Inflector::camelize($field);
169
+            $normalizedFields[$field] = $value;
170
+        }
171 171
 		
172
-		$this->thereIsAUserIdentifiedBy(
173
-			$normalizedFields['login'],
174
-			$normalizedFields['password'],
175
-			$role,
176
-			$normalizedFields['fullname'],
177
-			$normalizedFields['organization']
178
-		);
172
+        $this->thereIsAUserIdentifiedBy(
173
+            $normalizedFields['login'],
174
+            $normalizedFields['password'],
175
+            $role,
176
+            $normalizedFields['fullname'],
177
+            $normalizedFields['organization']
178
+        );
179 179
 		
180
-	}
180
+    }
181 181
 	
182
-	/**
183
-	 * @Given I am logged in as an administrator
184
-	 */
185
-	public function iAmLoggedInAsAnAdmin()
186
-	{
187
-		$user = $this->thereIsAUserIdentifiedBy('[email protected]','test',User::ROLE_ADMIN);
188
-		$this->startLogin($user,'test');
189
-	}
182
+    /**
183
+     * @Given I am logged in as an administrator
184
+     */
185
+    public function iAmLoggedInAsAnAdmin()
186
+    {
187
+        $user = $this->thereIsAUserIdentifiedBy('[email protected]','test',User::ROLE_ADMIN);
188
+        $this->startLogin($user,'test');
189
+    }
190 190
 	
191
-	private function startLogin(UserInterface $user, $password)
192
-	{
193
-		$currentUser = $this->currentUser;
194
-		if(!is_object($currentUser) || $user->getId()!=$currentUser->getId()){
195
-			$this->iWantToLogIn();
196
-			$this->iSpecifyTheUsernameAs($user->getLogin());
197
-			$this->iSpecifyThePasswordAs($password);
198
-			$this->iLogIn();
199
-			$this->currentUser = $user;
200
-		}
201
-	}
191
+    private function startLogin(UserInterface $user, $password)
192
+    {
193
+        $currentUser = $this->currentUser;
194
+        if(!is_object($currentUser) || $user->getId()!=$currentUser->getId()){
195
+            $this->iWantToLogIn();
196
+            $this->iSpecifyTheUsernameAs($user->getLogin());
197
+            $this->iSpecifyThePasswordAs($password);
198
+            $this->iLogIn();
199
+            $this->currentUser = $user;
200
+        }
201
+    }
202 202
 	
203
-	/**
204
-	 * @return UserRepository
205
-	 */
206
-	public function getUserRepository()
207
-	{
208
-		return $this->coreContext->getRepositories()->get('Auth\Entity\User');
209
-	}
203
+    /**
204
+     * @return UserRepository
205
+     */
206
+    public function getUserRepository()
207
+    {
208
+        return $this->coreContext->getRepositories()->get('Auth\Entity\User');
209
+    }
210 210
 	
211
-	/**
212
-	 * @Given there is a user :email identified by :password
213
-	 */
214
-	public function thereIsAUserIdentifiedBy($email, $password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter",$organization=null)
215
-	{
216
-		$repo = $this->getUserRepository();
217
-		if(!is_object($user=$repo->findByEmail($email))){
218
-			$user = $this->createUser($email,$password,$role,$fullname,$organization);
219
-		}
211
+    /**
212
+     * @Given there is a user :email identified by :password
213
+     */
214
+    public function thereIsAUserIdentifiedBy($email, $password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter",$organization=null)
215
+    {
216
+        $repo = $this->getUserRepository();
217
+        if(!is_object($user=$repo->findByEmail($email))){
218
+            $user = $this->createUser($email,$password,$role,$fullname,$organization);
219
+        }
220 220
 		
221
-		if(!is_null($organization)){
222
-			$this->iHaveMainOrganization($user,$organization);
223
-		}
224
-		$this->addCreatedUser($user);
225
-		return $user;
226
-	}
221
+        if(!is_null($organization)){
222
+            $this->iHaveMainOrganization($user,$organization);
223
+        }
224
+        $this->addCreatedUser($user);
225
+        return $user;
226
+    }
227 227
 	
228
-	/**
229
-	 * @param $email
230
-	 * @param $password
231
-	 * @param $username
232
-	 * @param string $fullname
233
-	 * @param string $role
234
-	 *
235
-	 * @return \Auth\Entity\UserInterface
236
-	 */
237
-	public function createUser($email,$password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter")
238
-	{
239
-		/* @var Register $service */
240
-		/* @var User $user */
241
-		$repo = $this->getUserRepository();
242
-		$user = $repo->create([]);
243
-		$user->setLogin($email);
244
-		$user->setPassword($password);
245
-		$user->setRole($role);
246
-		$settings = $user->getSettings('Applications');
228
+    /**
229
+     * @param $email
230
+     * @param $password
231
+     * @param $username
232
+     * @param string $fullname
233
+     * @param string $role
234
+     *
235
+     * @return \Auth\Entity\UserInterface
236
+     */
237
+    public function createUser($email,$password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter")
238
+    {
239
+        /* @var Register $service */
240
+        /* @var User $user */
241
+        $repo = $this->getUserRepository();
242
+        $user = $repo->create([]);
243
+        $user->setLogin($email);
244
+        $user->setPassword($password);
245
+        $user->setRole($role);
246
+        $settings = $user->getSettings('Applications');
247 247
 		
248
-		$expFullName = explode(' ',$fullname);
249
-		$info = $user->getInfo();
250
-		$info->setFirstName(array_shift($expFullName));
251
-		$info->setLastName(count($expFullName)>0 ? implode(' ',$expFullName):'');
252
-		$info->setEmail($email);
253
-		$info->setEmailVerified(true);
254
-		$repo->store($user);
255
-		$repo->getDocumentManager()->refresh($user);
248
+        $expFullName = explode(' ',$fullname);
249
+        $info = $user->getInfo();
250
+        $info->setFirstName(array_shift($expFullName));
251
+        $info->setLastName(count($expFullName)>0 ? implode(' ',$expFullName):'');
252
+        $info->setEmail($email);
253
+        $info->setEmailVerified(true);
254
+        $repo->store($user);
255
+        $repo->getDocumentManager()->refresh($user);
256 256
 		
257
-		$eventArgs = new LifecycleEventArgs($user, $repo->getDocumentManager());
258
-		$repo->getDocumentManager()->getEventManager()->dispatchEvent(
259
-			Events::postLoad,
260
-			$eventArgs
261
-		);
262
-		/* @var \Core\EventManager\EventManager $events */
263
-		/* @var \Auth\Listener\Events\AuthEvent $event */
264
-		//@TODO: [Behat] event not working in travis
265
-		//$events = $this->coreContext->getEventManager();
266
-		//$event  = $events->getEvent(AuthEvent::EVENT_USER_REGISTERED, $this);
267
-		//$event->setUser($user);
268
-		//$events->triggerEvent($event);
269
-		return $user;
270
-	}
257
+        $eventArgs = new LifecycleEventArgs($user, $repo->getDocumentManager());
258
+        $repo->getDocumentManager()->getEventManager()->dispatchEvent(
259
+            Events::postLoad,
260
+            $eventArgs
261
+        );
262
+        /* @var \Core\EventManager\EventManager $events */
263
+        /* @var \Auth\Listener\Events\AuthEvent $event */
264
+        //@TODO: [Behat] event not working in travis
265
+        //$events = $this->coreContext->getEventManager();
266
+        //$event  = $events->getEvent(AuthEvent::EVENT_USER_REGISTERED, $this);
267
+        //$event->setUser($user);
268
+        //$events->triggerEvent($event);
269
+        return $user;
270
+    }
271 271
 	
272
-	/**
273
-	 * @When I have :organization as my main organization
274
-	 * @param $orgName
275
-	 */
276
-	public function iHaveMainOrganization(UserInterface $user,$orgName)
277
-	{
278
-		/* @var $repoOrganization OrganizationRepository */
279
-		$repoOrganization = $this->coreContext->getRepositories()->get('Organizations/Organization');
280
-		$organization=$repoOrganization->findByName($orgName);
281
-		if(!$organization instanceof Organization){
282
-			$organization = new Organization();
283
-			$organizationName = new OrganizationName($orgName);
284
-			$organization->setOrganizationName($organizationName);
285
-			$permissions = $organization->getPermissions();
286
-			$permissions->grant($user,Permissions::PERMISSION_ALL);
287
-		}else {
288
-			$organization->getPermissions()->grant($user,Permissions::PERMISSION_ALL);
289
-		}
290
-		$organization->setUser($user);
291
-		$repoOrganization->store($organization);
292
-		$repoOrganization->getDocumentManager()->refresh($organization);
293
-	}
272
+    /**
273
+     * @When I have :organization as my main organization
274
+     * @param $orgName
275
+     */
276
+    public function iHaveMainOrganization(UserInterface $user,$orgName)
277
+    {
278
+        /* @var $repoOrganization OrganizationRepository */
279
+        $repoOrganization = $this->coreContext->getRepositories()->get('Organizations/Organization');
280
+        $organization=$repoOrganization->findByName($orgName);
281
+        if(!$organization instanceof Organization){
282
+            $organization = new Organization();
283
+            $organizationName = new OrganizationName($orgName);
284
+            $organization->setOrganizationName($organizationName);
285
+            $permissions = $organization->getPermissions();
286
+            $permissions->grant($user,Permissions::PERMISSION_ALL);
287
+        }else {
288
+            $organization->getPermissions()->grant($user,Permissions::PERMISSION_ALL);
289
+        }
290
+        $organization->setUser($user);
291
+        $repoOrganization->store($organization);
292
+        $repoOrganization->getDocumentManager()->refresh($organization);
293
+    }
294 294
 	
295
-	/**
296
-	 * @When I want to log in
297
-	 */
298
-	public function iWantToLogIn()
299
-	{
300
-		$session = $this->minkContext->getSession();
301
-		$url = $this->generateUrl('lang/auth');
302
-		$session->visit($url);
303
-	}
295
+    /**
296
+     * @When I want to log in
297
+     */
298
+    public function iWantToLogIn()
299
+    {
300
+        $session = $this->minkContext->getSession();
301
+        $url = $this->generateUrl('lang/auth');
302
+        $session->visit($url);
303
+    }
304 304
 	
305
-	/**
306
-	 * @When I specify the username as :username
307
-	 */
308
-	public function iSpecifyTheUsernameAs($username)
309
-	{
310
-		$this->minkContext->fillField('Login name',$username);
311
-	}
305
+    /**
306
+     * @When I specify the username as :username
307
+     */
308
+    public function iSpecifyTheUsernameAs($username)
309
+    {
310
+        $this->minkContext->fillField('Login name',$username);
311
+    }
312 312
 	
313
-	/**
314
-	 * @When I specify the password as :password
315
-	 */
316
-	public function iSpecifyThePasswordAs($password)
317
-	{
318
-		$this->minkContext->fillField('Password',$password);
319
-	}
313
+    /**
314
+     * @When I specify the password as :password
315
+     */
316
+    public function iSpecifyThePasswordAs($password)
317
+    {
318
+        $this->minkContext->fillField('Password',$password);
319
+    }
320 320
 	
321
-	/**
322
-	 * @Given I am logged in as :username identified by :password
323
-	 */
324
-	public function iAmLoggedInAsIdentifiedBy($username, $password)
325
-	{
326
-		$repo = $this->getUserRepository();
327
-		$user = $repo->findByLogin($username);
321
+    /**
322
+     * @Given I am logged in as :username identified by :password
323
+     */
324
+    public function iAmLoggedInAsIdentifiedBy($username, $password)
325
+    {
326
+        $repo = $this->getUserRepository();
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));
331
-		}
332
-		$this->iWantToLogIn();
333
-		$this->iSpecifyTheUsernameAs($username);
334
-		$this->iSpecifyThePasswordAs($password);
335
-		$this->iLogIn();
329
+        if(!$user instanceof User){
330
+            throw new \Exception(sprintf('There is no user with this login: "%s"',$username));
331
+        }
332
+        $this->iWantToLogIn();
333
+        $this->iSpecifyTheUsernameAs($username);
334
+        $this->iSpecifyThePasswordAs($password);
335
+        $this->iLogIn();
336 336
         $this->currentUser = $user;
337
-	}
337
+    }
338 338
 	
339
-	/**
340
-	 * @When I log in
341
-	 */
342
-	public function iLogIn()
343
-	{
344
-		$this->minkContext->pressButton('login');
345
-	}
339
+    /**
340
+     * @When I log in
341
+     */
342
+    public function iLogIn()
343
+    {
344
+        $this->minkContext->pressButton('login');
345
+    }
346 346
 	
347
-	/**
348
-	 * @When I press logout link
349
-	 */
350
-	public function iPressLogoutLink()
351
-	{
352
-		$url = $this->generateUrl('auth-logout');
353
-		$this->visit($url);
354
-	}
347
+    /**
348
+     * @When I press logout link
349
+     */
350
+    public function iPressLogoutLink()
351
+    {
352
+        $url = $this->generateUrl('auth-logout');
353
+        $this->visit($url);
354
+    }
355 355
 	
356
-	/**
357
-	 * @Given I log in with username :username and password :password
358
-	 */
359
-	public function iLogInWith($username, $password)
360
-	{
361
-		$repo = $this->getUserRepository();
362
-		$user = $repo->findByLogin($username);
363
-		$this->iWantToLogIn();
364
-		$this->iSpecifyTheUsernameAs($username);
365
-		$this->iSpecifyThePasswordAs($password);
366
-		$this->iLogIn();
367
-		$this->loggedInUser = $user;
368
-	}
356
+    /**
357
+     * @Given I log in with username :username and password :password
358
+     */
359
+    public function iLogInWith($username, $password)
360
+    {
361
+        $repo = $this->getUserRepository();
362
+        $user = $repo->findByLogin($username);
363
+        $this->iWantToLogIn();
364
+        $this->iSpecifyTheUsernameAs($username);
365
+        $this->iSpecifyThePasswordAs($password);
366
+        $this->iLogIn();
367
+        $this->loggedInUser = $user;
368
+    }
369 369
 	
370
-	/**
371
-	 * @When I go to profile page
372
-	 */
373
-	public function iGoToProfilePage()
374
-	{
375
-		$url = $this->generateUrl('lang/my');
376
-		$this->visit($url);
377
-	}
370
+    /**
371
+     * @When I go to profile page
372
+     */
373
+    public function iGoToProfilePage()
374
+    {
375
+        $url = $this->generateUrl('lang/my');
376
+        $this->visit($url);
377
+    }
378 378
 	
379
-	/**
380
-	 * @Given there is a user with the following:
381
-	 */
382
-	public function thereIsAUserWithTheFollowing(TableNode $table)
383
-	{
384
-		$repo = $this->getUserRepository();
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;
379
+    /**
380
+     * @Given there is a user with the following:
381
+     */
382
+    public function thereIsAUserWithTheFollowing(TableNode $table)
383
+    {
384
+        $repo = $this->getUserRepository();
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;
390 390
 		
391
-		if(!is_object($user=$repo->findByLogin($email))){
392
-			$user = $this->createUser($email,$password,$role,$fullname);
393
-		}
394
-		$this->currentUser = $user;
395
-		$this->addCreatedUser($user);
396
-	}
391
+        if(!is_object($user=$repo->findByLogin($email))){
392
+            $user = $this->createUser($email,$password,$role,$fullname);
393
+        }
394
+        $this->currentUser = $user;
395
+        $this->addCreatedUser($user);
396
+    }
397 397
 	
398
-	private function addCreatedUser(UserInterface $user)
399
-	{
400
-		if(!in_array($user,static::$users)){
401
-			static::$users[] = $user;
402
-		}
403
-	}
398
+    private function addCreatedUser(UserInterface $user)
399
+    {
400
+        if(!in_array($user,static::$users)){
401
+            static::$users[] = $user;
402
+        }
403
+    }
404 404
 	
405
-	/**
406
-	 * @When I want to change my password
407
-	 */
408
-	public function iWantToChangeMyPassword()
409
-	{
410
-		$url = $this->generateUrl('lang/my-password');
411
-		$this->visit($url);
412
-	}
405
+    /**
406
+     * @When I want to change my password
407
+     */
408
+    public function iWantToChangeMyPassword()
409
+    {
410
+        $url = $this->generateUrl('lang/my-password');
411
+        $this->visit($url);
412
+    }
413 413
 
414 414
     /**
415 415
      * @return User
416 416
      */
417
-	public function getCurrentUser()
417
+    public function getCurrentUser()
418 418
     {
419 419
         return $this->currentUser;
420 420
     }
Please login to merge, or discard this patch.
module/Behat/src/SettingsContext.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -14,26 +14,26 @@
 block discarded – undo
14 14
 
15 15
 class SettingsContext implements Context
16 16
 {
17
-	use CommonContextTrait;
17
+    use CommonContextTrait;
18 18
 	
19
-	/**
20
-	 * @Given I go to settings page
21
-	 */
22
-	public function iGoToSettingsPage()
23
-	{
24
-		//$this->visit('/settings');
19
+    /**
20
+     * @Given I go to settings page
21
+     */
22
+    public function iGoToSettingsPage()
23
+    {
24
+        //$this->visit('/settings');
25 25
         $url = $this->generateUrl('lang/settings');
26 26
         $this->visit($url);
27
-	}
27
+    }
28 28
 	
29
-	/**
30
-	 * @Given I go to email template settings page
31
-	 */
32
-	public function iGoToEmailTemplatePage()
33
-	{
34
-	    $url = $this->generateUrl('lang/settings',[
35
-	        'module' => 'Applications'
29
+    /**
30
+     * @Given I go to email template settings page
31
+     */
32
+    public function iGoToEmailTemplatePage()
33
+    {
34
+        $url = $this->generateUrl('lang/settings',[
35
+            'module' => 'Applications'
36 36
         ]);
37
-		$this->visit($url);
38
-	}
37
+        $this->visit($url);
38
+    }
39 39
 }
Please login to merge, or discard this patch.
module/Behat/src/JobContext.php 1 patch
Indentation   +284 added lines, -284 removed lines patch added patch discarded remove patch
@@ -33,324 +33,324 @@
 block discarded – undo
33 33
  */
34 34
 class JobContext implements Context
35 35
 {
36
-	use CommonContextTrait;
36
+    use CommonContextTrait;
37 37
 	
38
-	/**
39
-	 * @var Select2Context
40
-	 */
41
-	private $select2Context;
38
+    /**
39
+     * @var Select2Context
40
+     */
41
+    private $select2Context;
42 42
 	
43
-	/**
44
-	 * @var Job
45
-	 */
46
-	private $currentJob;
43
+    /**
44
+     * @var Job
45
+     */
46
+    private $currentJob;
47 47
 	
48
-	/**
49
-	 * @var JobRepository
50
-	 */
51
-	static private $jobRepo;
48
+    /**
49
+     * @var JobRepository
50
+     */
51
+    static private $jobRepo;
52 52
 	
53
-	/**
54
-	 * @param User $user
55
-	 */
56
-	static public function removeJobByUser(User $user)
57
-	{
58
-		$repo = static::$jobRepo;
59
-		$results = $repo->findBy(['user' => $user]);
60
-		foreach($results as $result){
61
-			$repo->remove($result,true);
62
-		}
63
-	}
53
+    /**
54
+     * @param User $user
55
+     */
56
+    static public function removeJobByUser(User $user)
57
+    {
58
+        $repo = static::$jobRepo;
59
+        $results = $repo->findBy(['user' => $user]);
60
+        foreach($results as $result){
61
+            $repo->remove($result,true);
62
+        }
63
+    }
64 64
 	
65
-	/**
66
-	 * @BeforeScenario
67
-	 *
68
-	 * @param BeforeScenarioScope $scope
69
-	 */
70
-	public function beforeScenario(BeforeScenarioScope $scope)
71
-	{
72
-		$this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class);
73
-		if(is_null(static::$jobRepo)){
74
-			$this->gatherContexts($scope);
75
-			static::$jobRepo = $this->getJobRepository();
76
-		}
77
-	}
65
+    /**
66
+     * @BeforeScenario
67
+     *
68
+     * @param BeforeScenarioScope $scope
69
+     */
70
+    public function beforeScenario(BeforeScenarioScope $scope)
71
+    {
72
+        $this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class);
73
+        if(is_null(static::$jobRepo)){
74
+            $this->gatherContexts($scope);
75
+            static::$jobRepo = $this->getJobRepository();
76
+        }
77
+    }
78 78
 	
79
-	/**
80
-	 * @Given I go to job board page
81
-	 */
82
-	public function iGoToJobBoardPage()
83
-	{
84
-		$this->visit('/jobboard');
85
-	}
79
+    /**
80
+     * @Given I go to job board page
81
+     */
82
+    public function iGoToJobBoardPage()
83
+    {
84
+        $this->visit('/jobboard');
85
+    }
86 86
 	
87
-	/**
88
-	 * @Given I go to create job page
89
-	 */
90
-	public function iGoToCreateJob()
91
-	{
92
-	    $url = $this->generateUrl('lang/jobs/manage',['action' => 'edit']);
93
-		$this->visit($url);
94
-	}
87
+    /**
88
+     * @Given I go to create job page
89
+     */
90
+    public function iGoToCreateJob()
91
+    {
92
+        $url = $this->generateUrl('lang/jobs/manage',['action' => 'edit']);
93
+        $this->visit($url);
94
+    }
95 95
 	
96
-	/**
97
-	 * @Given I go to job overview page
98
-	 */
99
-	public function iGoToJobOverviewPage()
100
-	{
101
-		$this->visit('/jobs');
102
-	}
96
+    /**
97
+     * @Given I go to job overview page
98
+     */
99
+    public function iGoToJobOverviewPage()
100
+    {
101
+        $this->visit('/jobs');
102
+    }
103 103
 	
104
-	/**
105
-	 * @Given I go to edit job draft with title :jobTitle
106
-	 * @param $jobTitle
107
-	 * @throws \Exception when job is not found
108
-	 */
109
-	public function iGoToEditJobWithTitle($jobTitle)
110
-	{
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));
114
-		}
115
-		$this->currentJob = $job;
116
-		$url = $this->generateUrl('lang/jobs/manage',[
117
-		    'id' => $job->getId()
104
+    /**
105
+     * @Given I go to edit job draft with title :jobTitle
106
+     * @param $jobTitle
107
+     * @throws \Exception when job is not found
108
+     */
109
+    public function iGoToEditJobWithTitle($jobTitle)
110
+    {
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));
114
+        }
115
+        $this->currentJob = $job;
116
+        $url = $this->generateUrl('lang/jobs/manage',[
117
+            'id' => $job->getId()
118 118
         ]);
119
-		$this->visit($url);
120
-	}
119
+        $this->visit($url);
120
+    }
121 121
 	
122
-	/**
123
-	 * @Given I don't have any classification data
124
-	 */
125
-	public function iDonTHaveAnyClassificationData()
126
-	{
127
-		$this->currentJob->setClassifications(new Classifications());
128
-		$this->getJobRepository()->store($this->currentJob);
129
-	}
122
+    /**
123
+     * @Given I don't have any classification data
124
+     */
125
+    public function iDonTHaveAnyClassificationData()
126
+    {
127
+        $this->currentJob->setClassifications(new Classifications());
128
+        $this->getJobRepository()->store($this->currentJob);
129
+    }
130 130
 	
131
-	/**
132
-	 * @When I don't have any posted job
133
-	 */
134
-	public function iDonTHaveAnyPostedJob()
135
-	{
136
-		/* @var $jobRepository JobRepository */
137
-		/* @var $job Job */
138
-		$user = $this->getUserContext()->getCurrentUser();
131
+    /**
132
+     * @When I don't have any posted job
133
+     */
134
+    public function iDonTHaveAnyPostedJob()
135
+    {
136
+        /* @var $jobRepository JobRepository */
137
+        /* @var $job Job */
138
+        $user = $this->getUserContext()->getCurrentUser();
139 139
 
140
-		$jobRepository = $this->getJobRepository();
141
-		$results = $jobRepository->getUserJobs($user->getId());
142
-		foreach($results as $job){
143
-			$jobRepository->remove($job,true);
144
-		}
145
-		$this->currentJob = null;
146
-	}
140
+        $jobRepository = $this->getJobRepository();
141
+        $results = $jobRepository->getUserJobs($user->getId());
142
+        foreach($results as $job){
143
+            $jobRepository->remove($job,true);
144
+        }
145
+        $this->currentJob = null;
146
+    }
147 147
 	
148
-	/**
149
-	 * @When I fill job location search with :search and choose :choice
150
-	 *
151
-	 */
152
-	public function iFillJobLocationAndChoose($search,$choice)
153
-	{
154
-		$select2 = $this->select2Context;
155
-		$select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice);
156
-	}
148
+    /**
149
+     * @When I fill job location search with :search and choose :choice
150
+     *
151
+     */
152
+    public function iFillJobLocationAndChoose($search,$choice)
153
+    {
154
+        $select2 = $this->select2Context;
155
+        $select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice);
156
+    }
157 157
 	
158
-	/**
159
-	 * @When I choose :value from :field
160
-	 */
161
-	public function iJobClassificationSelect($value,$field)
162
-	{
163
-		$field = Inflector::camelize($field);
158
+    /**
159
+     * @When I choose :value from :field
160
+     */
161
+    public function iJobClassificationSelect($value,$field)
162
+    {
163
+        $field = Inflector::camelize($field);
164 164
 		
165
-		$mapSelect2 = [
166
-			'professions' => '#classifications-professions-span .select2-container',
167
-			'industries'  => '#classifications-industries-span .select2-container',
168
-			'employmentTypes' => '#classifications-employmentTypes-span .select2-container',
169
-		];
165
+        $mapSelect2 = [
166
+            'professions' => '#classifications-professions-span .select2-container',
167
+            'industries'  => '#classifications-industries-span .select2-container',
168
+            'employmentTypes' => '#classifications-employmentTypes-span .select2-container',
169
+        ];
170 170
 		
171
-		$mapMultiple = [
172
-			'professions'       => "select#classifications-professions",
173
-			'industries'        => "select#classifications-industries",
174
-			'employmentTypes'    => "select#classifications-employmentTypes",
175
-		];
171
+        $mapMultiple = [
172
+            'professions'       => "select#classifications-professions",
173
+            'industries'        => "select#classifications-industries",
174
+            'employmentTypes'    => "select#classifications-employmentTypes",
175
+        ];
176 176
 		
177
-		if(!isset($mapSelect2[$field])){
178
-			throw new \Exception('Undefined field selection value "'.$field.'"');
179
-		}
177
+        if(!isset($mapSelect2[$field])){
178
+            throw new \Exception('Undefined field selection value "'.$field.'"');
179
+        }
180 180
 		
181
-		$multipleField = $mapMultiple[$field];
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{
187
-			$locator = $mapSelect2[$field];
188
-			$this->select2Context->iFillInSelect2Field($locator,$value);
189
-		}
190
-	}
181
+        $multipleField = $mapMultiple[$field];
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{
187
+            $locator = $mapSelect2[$field];
188
+            $this->select2Context->iFillInSelect2Field($locator,$value);
189
+        }
190
+    }
191 191
 	
192
-	/**
193
-	 * @return JobRepository
194
-	 */
195
-	public function getJobRepository()
196
-	{
197
-		return $this->getRepository('Jobs/Job');
198
-	}
192
+    /**
193
+     * @return JobRepository
194
+     */
195
+    public function getJobRepository()
196
+    {
197
+        return $this->getRepository('Jobs/Job');
198
+    }
199 199
 	
200
-	/**
201
-	 * @return CategoriesRepo
202
-	 */
203
-	public function getCategoriesRepository()
204
-	{
205
-		return $this->getRepository('Jobs/Category');
206
-	}
200
+    /**
201
+     * @return CategoriesRepo
202
+     */
203
+    public function getCategoriesRepository()
204
+    {
205
+        return $this->getRepository('Jobs/Category');
206
+    }
207 207
 	
208
-	/**
209
-	 * @When I have a :status job with the following:
210
-	 * @param TableNode $fields
211
-	 */
212
-	public function iHaveAJobWithTheFollowing($status,TableNode $fields)
213
-	{
214
-		$normalizedField = [
215
-			'template' => 'modern',
216
-		];
217
-		foreach($fields->getRowsHash() as $field => $value){
218
-			$field = Inflector::camelize($field);
219
-			if($field == 'professions' || $field == 'industries'){
220
-				$value = explode(',',$value);
221
-			}
222
-			$normalizedField[$field] = $value;
223
-		}
224
-		$jobRepo = $this->getJobRepository();
225
-		$job = $jobRepo->findOneBy(['title' => $normalizedField['title']]);
226
-		if(!$job instanceof Job){
227
-			$job = new Job();
228
-			$job->setTitle($normalizedField['title']);
229
-		}
230
-		if(isset($normalizedField['user'])){
231
-			/* @var $userRepo UserRepository */
232
-			$userRepo = $this->getRepository('Auth\Entity\User');
233
-			$user = $userRepo->findOneBy(['login' => $normalizedField['user']]);
234
-			if($user instanceof User){
235
-				$job->setUser($user);
236
-				$job->setOrganization($user->getOrganization()->getOrganization());
237
-			}else{
238
-				throw new \Exception('There is no user with this login:"'.$normalizedField['user'.'"']);
239
-			}
240
-		}
208
+    /**
209
+     * @When I have a :status job with the following:
210
+     * @param TableNode $fields
211
+     */
212
+    public function iHaveAJobWithTheFollowing($status,TableNode $fields)
213
+    {
214
+        $normalizedField = [
215
+            'template' => 'modern',
216
+        ];
217
+        foreach($fields->getRowsHash() as $field => $value){
218
+            $field = Inflector::camelize($field);
219
+            if($field == 'professions' || $field == 'industries'){
220
+                $value = explode(',',$value);
221
+            }
222
+            $normalizedField[$field] = $value;
223
+        }
224
+        $jobRepo = $this->getJobRepository();
225
+        $job = $jobRepo->findOneBy(['title' => $normalizedField['title']]);
226
+        if(!$job instanceof Job){
227
+            $job = new Job();
228
+            $job->setTitle($normalizedField['title']);
229
+        }
230
+        if(isset($normalizedField['user'])){
231
+            /* @var $userRepo UserRepository */
232
+            $userRepo = $this->getRepository('Auth\Entity\User');
233
+            $user = $userRepo->findOneBy(['login' => $normalizedField['user']]);
234
+            if($user instanceof User){
235
+                $job->setUser($user);
236
+                $job->setOrganization($user->getOrganization()->getOrganization());
237
+            }else{
238
+                throw new \Exception('There is no user with this login:"'.$normalizedField['user'.'"']);
239
+            }
240
+        }
241 241
 		
242
-		if($status == 'draft'){
243
-			$job->setIsDraft(true);
244
-		}elseif($status == 'published'){
245
-			$job->setIsDraft(false);
246
-			$job->setDatePublishStart(new \DateTime());
247
-		}
248
-		$job->setStatus(Status::ACTIVE);
242
+        if($status == 'draft'){
243
+            $job->setIsDraft(true);
244
+        }elseif($status == 'published'){
245
+            $job->setIsDraft(false);
246
+            $job->setDatePublishStart(new \DateTime());
247
+        }
248
+        $job->setStatus(Status::ACTIVE);
249 249
 		
250
-		if(isset($normalizedField['location'])){
251
-			$this->setLocation($job,$normalizedField['location']);
252
-		}
253
-		if(isset($normalizedField['companyName'])){
254
-			//$job->setCompany($normalizedField['companyName']);
255
-		}
256
-		if(isset($normalizedField['professions'])){
257
-			$this->addProfessions($job,$normalizedField['professions']);
258
-		}
250
+        if(isset($normalizedField['location'])){
251
+            $this->setLocation($job,$normalizedField['location']);
252
+        }
253
+        if(isset($normalizedField['companyName'])){
254
+            //$job->setCompany($normalizedField['companyName']);
255
+        }
256
+        if(isset($normalizedField['professions'])){
257
+            $this->addProfessions($job,$normalizedField['professions']);
258
+        }
259 259
 		
260
-		if(isset($normalizedField['industries'])){
261
-			$this->addIndustries($job,$normalizedField['industries']);
262
-		}
263
-		if(isset($normalizedField['employmentTypes'])){
264
-			$types = $this->getCategories([$normalizedField['employmentTypes']]);
265
-			$type = array_shift($types);
266
-			$values = $job->getClassifications()->getEmploymentTypes()->getValues();
267
-			if(!is_array($values) || !in_array($type,$values)){
268
-				$job->getClassifications()->getEmploymentTypes()->getItems()->add($type);
269
-			}
270
-		}
260
+        if(isset($normalizedField['industries'])){
261
+            $this->addIndustries($job,$normalizedField['industries']);
262
+        }
263
+        if(isset($normalizedField['employmentTypes'])){
264
+            $types = $this->getCategories([$normalizedField['employmentTypes']]);
265
+            $type = array_shift($types);
266
+            $values = $job->getClassifications()->getEmploymentTypes()->getValues();
267
+            if(!is_array($values) || !in_array($type,$values)){
268
+                $job->getClassifications()->getEmploymentTypes()->getItems()->add($type);
269
+            }
270
+        }
271 271
 		
272
-		$jobRepo->store($job);
273
-		$this->currentJob = $job;
274
-	}
272
+        $jobRepo->store($job);
273
+        $this->currentJob = $job;
274
+    }
275 275
 	
276
-	private function setLocation(Job $job, $term)
277
-	{
278
-		/* @var $client Photon */
279
-		$client = $this->coreContext->getServiceManager()->get('Geo/Client');
280
-		$result = $client->queryOne($term);
281
-		$location = new Location();
282
-		$serialized = Json::encode($result);
283
-		$location->fromString($serialized);
276
+    private function setLocation(Job $job, $term)
277
+    {
278
+        /* @var $client Photon */
279
+        $client = $this->coreContext->getServiceManager()->get('Geo/Client');
280
+        $result = $client->queryOne($term);
281
+        $location = new Location();
282
+        $serialized = Json::encode($result);
283
+        $location->fromString($serialized);
284 284
 		
285
-		$locations = $job->getLocations();
286
-		if(count($locations)){
287
-			$locations->clear();
288
-		}
289
-		$job->getLocations()->add($location);
290
-	}
285
+        $locations = $job->getLocations();
286
+        if(count($locations)){
287
+            $locations->clear();
288
+        }
289
+        $job->getLocations()->add($location);
290
+    }
291 291
 	
292
-	private function addProfessions(Job &$job,$terms)
293
-	{
294
-		$professions = $this->getCategories($terms);
295
-		foreach($professions as $profession){
296
-			$values = $job->getClassifications()->getProfessions()->getValues();
297
-			if(!is_array($values) || !in_array($profession,$values)){
298
-				$job->getClassifications()->getProfessions()->getItems()->add($profession);
299
-			}
300
-		}
301
-	}
292
+    private function addProfessions(Job &$job,$terms)
293
+    {
294
+        $professions = $this->getCategories($terms);
295
+        foreach($professions as $profession){
296
+            $values = $job->getClassifications()->getProfessions()->getValues();
297
+            if(!is_array($values) || !in_array($profession,$values)){
298
+                $job->getClassifications()->getProfessions()->getItems()->add($profession);
299
+            }
300
+        }
301
+    }
302 302
 	
303
-	private function addIndustries(Job &$job, $terms)
304
-	{
305
-		$industries = $this->getCategories($terms);
306
-		foreach($industries as $industry){
307
-			$values = $job->getClassifications()->getIndustries()->getValues();
308
-			if(!is_array($values) || !in_array($industry,$values)){
309
-				$job->getClassifications()->getIndustries()->getItems()->add($industry);
310
-			}
311
-		}
312
-	}
303
+    private function addIndustries(Job &$job, $terms)
304
+    {
305
+        $industries = $this->getCategories($terms);
306
+        foreach($industries as $industry){
307
+            $values = $job->getClassifications()->getIndustries()->getValues();
308
+            if(!is_array($values) || !in_array($industry,$values)){
309
+                $job->getClassifications()->getIndustries()->getItems()->add($industry);
310
+            }
311
+        }
312
+    }
313 313
 	
314
-	/**
315
-	 * @param array $categories
316
-	 *
317
-	 * @return mixed
318
-	 */
319
-	private function getCategories(array $categories)
320
-	{
321
-		$catRepo = $this->getCategoriesRepository();
314
+    /**
315
+     * @param array $categories
316
+     *
317
+     * @return mixed
318
+     */
319
+    private function getCategories(array $categories)
320
+    {
321
+        $catRepo = $this->getCategoriesRepository();
322 322
 		
323
-		// get a professions
324
-		$qb = $catRepo->createQueryBuilder()
325
-		              ->field('name')->in($categories)
326
-		              ->getQuery()
327
-		;
328
-		$results = $qb->execute();
329
-		return $results->toArray();
330
-	}
323
+        // get a professions
324
+        $qb = $catRepo->createQueryBuilder()
325
+                        ->field('name')->in($categories)
326
+                        ->getQuery()
327
+        ;
328
+        $results = $qb->execute();
329
+        return $results->toArray();
330
+    }
331 331
 	
332 332
 	
333
-	/**
334
-	 * @return Job
335
-	 */
336
-	private function getCurrentUserJobDraft($jobTitle)
337
-	{
338
-		$repo = $this->getJobRepository();
339
-		$user = $this->getCurrentUser();
333
+    /**
334
+     * @return Job
335
+     */
336
+    private function getCurrentUserJobDraft($jobTitle)
337
+    {
338
+        $repo = $this->getJobRepository();
339
+        $user = $this->getCurrentUser();
340 340
 		
341
-		$job = $repo->findDraft($user);
341
+        $job = $repo->findDraft($user);
342 342
 		
343
-		if(is_null($job)){
344
-			$job = new Job();
345
-			$job
346
-				->setUser($user)
347
-				->setOrganization($user->getOrganization()->getOrganization())
348
-				->setStatus(StatusInterface::CREATED)
349
-			;
350
-			$job->setIsDraft(true);
351
-		}
352
-		$job->setTitle($jobTitle);
353
-		$repo->store($job);
354
-		return $job;
355
-	}
343
+        if(is_null($job)){
344
+            $job = new Job();
345
+            $job
346
+                ->setUser($user)
347
+                ->setOrganization($user->getOrganization()->getOrganization())
348
+                ->setStatus(StatusInterface::CREATED)
349
+            ;
350
+            $job->setIsDraft(true);
351
+        }
352
+        $job->setTitle($jobTitle);
353
+        $repo->store($job);
354
+        return $job;
355
+    }
356 356
 }
Please login to merge, or discard this patch.
module/Core/src/Core/Controller/Plugin/Service/NotificationFactory.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -31,17 +31,17 @@
 block discarded – undo
31 31
      * @param array|null            $options
32 32
      * @return Notification
33 33
      */
34
-	public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
35
-	{
36
-		$pluginManager = $container->get('ControllerPluginManager');
37
-		$flashMessenger = $pluginManager->get('FlashMessenger');
38
-		$translator = $container->get('translator');
34
+    public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
35
+    {
36
+        $pluginManager = $container->get('ControllerPluginManager');
37
+        $flashMessenger = $pluginManager->get('FlashMessenger');
38
+        $translator = $container->get('translator');
39 39
 		
40
-		$notificationListener = $container->get('Core/Listener/Notification');
41
-		$notification   = new Notification($flashMessenger);
42
-		$notification->setListener($notificationListener);
43
-		$notification->setTranslator($translator);
40
+        $notificationListener = $container->get('Core/Listener/Notification');
41
+        $notification   = new Notification($flashMessenger);
42
+        $notification->setListener($notificationListener);
43
+        $notification->setTranslator($translator);
44 44
 		
45
-		return $notification;
46
-	}
45
+        return $notification;
46
+    }
47 47
 }
Please login to merge, or discard this patch.
module/Core/src/Core/Controller/Plugin/ContentCollector.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     public function trigger($event, $target = null)
75 75
     {
76 76
         if (empty($this->_template) || !is_string($this->_template)) {
77
-              throw new \InvalidArgumentException('ContentCollector must have a template-name');
77
+                throw new \InvalidArgumentException('ContentCollector must have a template-name');
78 78
         }
79 79
           
80 80
         $responseCollection = $this->getController()->getEventManager()->trigger($event, $target);
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
         $viewModel->setTemplate($this->_template);
83 83
         foreach ($responseCollection as $i => $response) {
84 84
             if (is_string($response)) {
85
-                      $template = $response;
86
-                      $response = new ViewModel(array('target' => $target));
87
-                      $response->setTemplate($template);
85
+                        $template = $response;
86
+                        $response = new ViewModel(array('target' => $target));
87
+                        $response->setTemplate($template);
88 88
             }
89 89
             $viewModel->addChild($response, $this->_captureTo . $i);
90 90
         }
Please login to merge, or discard this patch.
module/Core/src/Core/Controller/Plugin/Mail.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         } elseif (isset($this->config['templateHalf'])) {
226 226
             $template = $this->config['templateHalf'];
227 227
         } else {
228
-              throw new \InvalidArgumentException('No template provided for Mail.');
228
+                throw new \InvalidArgumentException('No template provided for Mail.');
229 229
         }
230 230
         return $template;
231 231
     }
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
         return $erg;
277 277
     }
278 278
     
279
-	/**
280
-	 * @param ContainerInterface $container
281
-	 *
282
-	 * @return static
283
-	 */
279
+    /**
280
+     * @param ContainerInterface $container
281
+     *
282
+     * @return static
283
+     */
284 284
     public static function factory(ContainerInterface $container)
285 285
     {
286 286
         //@TODO: need to define transport to be use during ::send()
Please login to merge, or discard this patch.
module/Core/src/Core/Controller/Plugin/ConfigFactory.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@
 block discarded – undo
13 13
  */
14 14
 class ConfigFactory implements FactoryInterface
15 15
 {
16
-	public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
17
-	{
18
-		$config = $container->get('Config');
19
-		$plugin = new Config($config);
16
+    public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
17
+    {
18
+        $config = $container->get('Config');
19
+        $plugin = new Config($config);
20 20
 		
21
-		return $plugin;
22
-	}
21
+        return $plugin;
22
+    }
23 23
 }
Please login to merge, or discard this patch.
module/Core/src/Core/Controller/Plugin/Mailer.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -87,11 +87,11 @@
 block discarded – undo
87 87
         return $sendMail ? $this->send($mail) : $mail;
88 88
     }
89 89
 	
90
-	/**
91
-	 * @param ContainerInterface $container
92
-	 *
93
-	 * @return Mailer
94
-	 */
90
+    /**
91
+     * @param ContainerInterface $container
92
+     *
93
+     * @return Mailer
94
+     */
95 95
     public static function factory(ContainerInterface $container)
96 96
     {
97 97
         return new static($container->get('Core/MailService'));
Please login to merge, or discard this patch.
module/Core/src/Core/Entity/AbstractIdentifiableEntity.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
  *
18 18
  * @author Anthonius Munthi <[email protected]>
19 19
  * @ODM\MappedSuperclass
20
-  */
20
+ */
21 21
 abstract class AbstractIdentifiableEntity extends AbstractEntity implements IdentifiableEntityInterface
22 22
 {
23 23
     use IdentifiableEntityTrait;
Please login to merge, or discard this patch.