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