Completed
Pull Request — develop (#453)
by ANTHONIUS
06:53
created
module/Behat/src/Select2Context.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,6 +31,7 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @When /^(?:|I )fill in select2 "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/
33 33
 	 * @When /^(?:|I )fill in select2 "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/
34
+	 * @param string $field
34 35
 	 */
35 36
 	public function iFillInSelect2Field($field, $value)
36 37
 	{
@@ -42,7 +43,7 @@  discard block
 block discarded – undo
42 43
 	
43 44
 	/**
44 45
 	 * @When I fill in select2 search :field with :search and I choose :choice
45
-	 * @param $field
46
+	 * @param string $field
46 47
 	 * @param $value
47 48
 	 */
48 49
 	public function iFillInSelect2FieldWith($field,$search,$choice=null)
Please login to merge, or discard this patch.
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -24,130 +24,130 @@
 block discarded – undo
24 24
  */
25 25
 class Select2Context extends RawMinkContext implements Context
26 26
 {
27
-	protected $timeout = 5;
27
+    protected $timeout = 5;
28 28
 	
29
-	/**
30
-	 * Fills in Select2 field with specified
31
-	 *
32
-	 * @When /^(?:|I )fill in select2 "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/
33
-	 * @When /^(?:|I )fill in select2 "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/
34
-	 */
35
-	public function iFillInSelect2Field($field, $value)
36
-	{
37
-		$page = $this->getSession()->getPage();
29
+    /**
30
+     * Fills in Select2 field with specified
31
+     *
32
+     * @When /^(?:|I )fill in select2 "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/
33
+     * @When /^(?:|I )fill in select2 "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/
34
+     */
35
+    public function iFillInSelect2Field($field, $value)
36
+    {
37
+        $page = $this->getSession()->getPage();
38 38
 		
39
-		$this->openField($page, $field);
40
-		$this->selectValue($page, $field, $value, $this->timeout);
41
-	}
39
+        $this->openField($page, $field);
40
+        $this->selectValue($page, $field, $value, $this->timeout);
41
+    }
42 42
 	
43
-	/**
44
-	 * @When I fill in select2 search :field with :search and I choose :choice
45
-	 * @param $field
46
-	 * @param $value
47
-	 */
48
-	public function iFillInSelect2FieldWith($field,$search,$choice=null)
49
-	{
50
-		$page = $this->getSession()->getPage();
51
-		$this->openField($page, $field);
52
-		$this->fillSearchField($page,$field,$search);
53
-		$this->selectValue($page, $field, $choice);
54
-	}
43
+    /**
44
+     * @When I fill in select2 search :field with :search and I choose :choice
45
+     * @param $field
46
+     * @param $value
47
+     */
48
+    public function iFillInSelect2FieldWith($field,$search,$choice=null)
49
+    {
50
+        $page = $this->getSession()->getPage();
51
+        $this->openField($page, $field);
52
+        $this->fillSearchField($page,$field,$search);
53
+        $this->selectValue($page, $field, $choice);
54
+    }
55 55
 	
56
-	/**
57
-	 * Fill Select2 search field
58
-	 *
59
-	 * @param DocumentElement $page
60
-	 * @param string          $field
61
-	 * @param string          $value
62
-	 * @throws \Exception
63
-	 */
64
-	private function fillSearchField(DocumentElement $page, $field, $value)
65
-	{
66
-		$driver = $this->getSession()->getDriver();
67
-		if ('Behat\Mink\Driver\Selenium2Driver' === get_class($driver)) {
68
-			// Can't use `$this->getSession()->getPage()->find()` because of https://github.com/minkphp/MinkSelenium2Driver/issues/188
56
+    /**
57
+     * Fill Select2 search field
58
+     *
59
+     * @param DocumentElement $page
60
+     * @param string          $field
61
+     * @param string          $value
62
+     * @throws \Exception
63
+     */
64
+    private function fillSearchField(DocumentElement $page, $field, $value)
65
+    {
66
+        $driver = $this->getSession()->getDriver();
67
+        if ('Behat\Mink\Driver\Selenium2Driver' === get_class($driver)) {
68
+            // Can't use `$this->getSession()->getPage()->find()` because of https://github.com/minkphp/MinkSelenium2Driver/issues/188
69 69
 			
70
-			$element = $page->find('css','.select2-container--open .select2-search__field');
71
-			$xpath = $element->getXpath();
72
-			$select2Input = $this->getSession()
73
-				->getDriver()
74
-				->getWebDriverSession()
75
-				->element('xpath',$xpath)
76
-				//->element('xpath', "//html/descendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), ' select2-search__field ')]")
77
-			;
78
-			if (!$select2Input) {
79
-				throw new \Exception(sprintf('No field "%s" found', $field));
80
-			}
70
+            $element = $page->find('css','.select2-container--open .select2-search__field');
71
+            $xpath = $element->getXpath();
72
+            $select2Input = $this->getSession()
73
+                ->getDriver()
74
+                ->getWebDriverSession()
75
+                ->element('xpath',$xpath)
76
+                //->element('xpath', "//html/descendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), ' select2-search__field ')]")
77
+            ;
78
+            if (!$select2Input) {
79
+                throw new \Exception(sprintf('No field "%s" found', $field));
80
+            }
81 81
 			
82
-			$select2Input->postValue(['value' => [$value]]);
83
-		} else {
84
-			$select2Input = $page->find('css', '.select2-search__field');
85
-			if (!$select2Input) {
86
-				throw new \Exception(sprintf('No input found for "%s"', $field));
87
-			}
88
-			$select2Input->setValue($value);
89
-		}
82
+            $select2Input->postValue(['value' => [$value]]);
83
+        } else {
84
+            $select2Input = $page->find('css', '.select2-search__field');
85
+            if (!$select2Input) {
86
+                throw new \Exception(sprintf('No input found for "%s"', $field));
87
+            }
88
+            $select2Input->setValue($value);
89
+        }
90 90
 		
91
-		$this->waitForLoadingResults($this->timeout);
92
-	}
91
+        $this->waitForLoadingResults($this->timeout);
92
+    }
93 93
 	
94
-	/**
95
-	 * Select value in choice list
96
-	 *
97
-	 * @param DocumentElement $page
98
-	 * @param string          $field
99
-	 * @param string          $value
100
-	 * @param int             $time
101
-	 * @throws \Exception
102
-	 */
103
-	private function selectValue(DocumentElement $page, $field, $value, $time=5)
104
-	{
105
-		$this->waitForLoadingResults($time);
94
+    /**
95
+     * Select value in choice list
96
+     *
97
+     * @param DocumentElement $page
98
+     * @param string          $field
99
+     * @param string          $value
100
+     * @param int             $time
101
+     * @throws \Exception
102
+     */
103
+    private function selectValue(DocumentElement $page, $field, $value, $time=5)
104
+    {
105
+        $this->waitForLoadingResults($time);
106 106
 		
107
-		$chosenResults = $page->findAll('css', '.select2-results li');
108
-		foreach ($chosenResults as $result) {
109
-			$text = $result->getText();
110
-			if (false!==strpos($text,$value)) {
111
-				$result->click();
112
-				return;
113
-			}
114
-		}
107
+        $chosenResults = $page->findAll('css', '.select2-results li');
108
+        foreach ($chosenResults as $result) {
109
+            $text = $result->getText();
110
+            if (false!==strpos($text,$value)) {
111
+                $result->click();
112
+                return;
113
+            }
114
+        }
115 115
 		
116
-		throw new \Exception(sprintf('Value "%s" not found for "%s"', $value, $field));
117
-	}
116
+        throw new \Exception(sprintf('Value "%s" not found for "%s"', $value, $field));
117
+    }
118 118
 	
119
-	private function openField(DocumentElement $page, $field)
120
-	{
121
-		$inputField = $page->find('css',$field);
122
-		if(!$inputField){
123
-			$fieldName = sprintf('select[name="%s"] + .select2-container', $field);
124
-			$inputField = $page->find('css', $fieldName);
125
-		}
126
-		if (!$inputField) {
127
-			throw new \Exception(sprintf('No field "%s" found', $field));
128
-		}
119
+    private function openField(DocumentElement $page, $field)
120
+    {
121
+        $inputField = $page->find('css',$field);
122
+        if(!$inputField){
123
+            $fieldName = sprintf('select[name="%s"] + .select2-container', $field);
124
+            $inputField = $page->find('css', $fieldName);
125
+        }
126
+        if (!$inputField) {
127
+            throw new \Exception(sprintf('No field "%s" found', $field));
128
+        }
129 129
 		
130
-		$choice = $inputField->find('css', '.select2-selection');
131
-		if (!$choice) {
132
-			throw new \Exception(sprintf('No select2 choice found for "%s"', $field));
133
-		}
134
-		$choice->press();
135
-	}
130
+        $choice = $inputField->find('css', '.select2-selection');
131
+        if (!$choice) {
132
+            throw new \Exception(sprintf('No select2 choice found for "%s"', $field));
133
+        }
134
+        $choice->press();
135
+    }
136 136
 	
137
-	/**
138
-	 * Wait the end of fetching Select2 results
139
-	 *
140
-	 * @param int $time Time to wait in seconds
141
-	 */
142
-	private function waitForLoadingResults($time)
143
-	{
144
-		for ($i = 0; $i < $time; $i++) {
145
-			if (!$this->getSession()->getPage()->find('css', '.select2-results__option.loading-results')) {
146
-				return;
147
-			}
137
+    /**
138
+     * Wait the end of fetching Select2 results
139
+     *
140
+     * @param int $time Time to wait in seconds
141
+     */
142
+    private function waitForLoadingResults($time)
143
+    {
144
+        for ($i = 0; $i < $time; $i++) {
145
+            if (!$this->getSession()->getPage()->find('css', '.select2-results__option.loading-results')) {
146
+                return;
147
+            }
148 148
 			
149
-			sleep(1);
150
-		}
151
-	}
149
+            sleep(1);
150
+        }
151
+    }
152 152
 	
153 153
 }
154 154
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 	 * @param $field
46 46
 	 * @param $value
47 47
 	 */
48
-	public function iFillInSelect2FieldWith($field,$search,$choice=null)
48
+	public function iFillInSelect2FieldWith($field, $search, $choice = null)
49 49
 	{
50 50
 		$page = $this->getSession()->getPage();
51 51
 		$this->openField($page, $field);
52
-		$this->fillSearchField($page,$field,$search);
52
+		$this->fillSearchField($page, $field, $search);
53 53
 		$this->selectValue($page, $field, $choice);
54 54
 	}
55 55
 	
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 		if ('Behat\Mink\Driver\Selenium2Driver' === get_class($driver)) {
68 68
 			// Can't use `$this->getSession()->getPage()->find()` because of https://github.com/minkphp/MinkSelenium2Driver/issues/188
69 69
 			
70
-			$element = $page->find('css','.select2-container--open .select2-search__field');
70
+			$element = $page->find('css', '.select2-container--open .select2-search__field');
71 71
 			$xpath = $element->getXpath();
72 72
 			$select2Input = $this->getSession()
73 73
 				->getDriver()
74 74
 				->getWebDriverSession()
75
-				->element('xpath',$xpath)
75
+				->element('xpath', $xpath)
76 76
 				//->element('xpath', "//html/descendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), ' select2-search__field ')]")
77 77
 			;
78 78
 			if (!$select2Input) {
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 	 * @param int             $time
101 101
 	 * @throws \Exception
102 102
 	 */
103
-	private function selectValue(DocumentElement $page, $field, $value, $time=5)
103
+	private function selectValue(DocumentElement $page, $field, $value, $time = 5)
104 104
 	{
105 105
 		$this->waitForLoadingResults($time);
106 106
 		
107 107
 		$chosenResults = $page->findAll('css', '.select2-results li');
108 108
 		foreach ($chosenResults as $result) {
109 109
 			$text = $result->getText();
110
-			if (false!==strpos($text,$value)) {
110
+			if (false !== strpos($text, $value)) {
111 111
 				$result->click();
112 112
 				return;
113 113
 			}
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	
119 119
 	private function openField(DocumentElement $page, $field)
120 120
 	{
121
-		$inputField = $page->find('css',$field);
122
-		if(!$inputField){
121
+		$inputField = $page->find('css', $field);
122
+		if (!$inputField) {
123 123
 			$fieldName = sprintf('select[name="%s"] + .select2-container', $field);
124 124
 			$inputField = $page->find('css', $fieldName);
125 125
 		}
Please login to merge, or discard this patch.
module/Behat/src/UserContext.php 4 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -198,6 +198,9 @@  discard block
 block discarded – undo
198 198
 		$this->startLogin($user,'test');
199 199
 	}
200 200
 	
201
+	/**
202
+	 * @param string $password
203
+	 */
201 204
 	private function startLogin(UserInterface $user, $password)
202 205
 	{
203 206
 		$currentUser = $this->currentUser;
@@ -242,7 +245,7 @@  discard block
 block discarded – undo
242 245
 	 * @param string $fullname
243 246
 	 * @param string $role
244 247
 	 *
245
-	 * @return \Auth\Entity\UserInterface
248
+	 * @return \Core\Entity\EntityInterface
246 249
 	 */
247 250
 	public function createUser($email,$password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter")
248 251
 	{
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 				try{
98 98
 					JobContext::removeJobByUser($user);
99 99
 					$repo->remove($user,true);
100
-				}catch (\Exception $e){
100
+				} catch (\Exception $e){
101 101
 				
102 102
 				}
103 103
 			}
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 			$organization->setOrganizationName($organizationName);
298 298
 			$permissions = $organization->getPermissions();
299 299
 			$permissions->grant($user,Permissions::PERMISSION_ALL);
300
-		}else {
300
+		} else {
301 301
 			$organization->getPermissions()->grant($user,Permissions::PERMISSION_ALL);
302 302
 		}
303 303
 		$organization->setUser($user);
Please login to merge, or discard this patch.
Indentation   +385 added lines, -385 removed lines patch added patch discarded remove patch
@@ -32,398 +32,398 @@
 block discarded – undo
32 32
 
33 33
 class UserContext implements Context
34 34
 {
35
-	/**
36
-	 * @var CoreContext
37
-	 */
38
-	private $coreContext;
39
-	
40
-	/**
41
-	 * @var MinkContext
42
-	 */
43
-	private $minkContext;
44
-	
45
-	/**
46
-	 * @var User
47
-	 */
48
-	private $currentUser;
49
-	
50
-	/**
51
-	 * @var User[]
52
-	 */
53
-	static private $users = [];
54
-	
55
-	/**
56
-	 * @var UserRepository
57
-	 */
58
-	static private $userRepo;
59
-	
60
-	/**
61
-	 * @var string
62
-	 */
63
-	static private $currentSession;
64
-	
65
-	private $socialLoginInfo = [];
66
-	
67
-	/**
68
-	 * @var UserInterface
69
-	 */
70
-	private $loggedInUser;
71
-	
72
-	public function __construct($parameters=[])
73
-	{
74
-		$defaultLoginInfo = [
75
-			'facebook' => [
76
-				'email' => getenv('FACEBOOK_USER_EMAIL'),
77
-				'pass' => getenv('FACEBOOK_USER_PASSWORD')
78
-			],
79
-			'linkedin' => [
80
-				'session_key-login' => getenv('LINKEDIN_USER_EMAIL'),
81
-				'session_password-login' => getenv('LINKEDIN_USER_PASSWORD')
82
-			],
83
-		];
84
-		$socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info']:[];
85
-		$this->socialLoginInfo = array_merge($defaultLoginInfo,$socialLoginConfig);
86
-	}
87
-	
88
-	/**
89
-	 * @AfterSuite
90
-	 * @param AfterSuiteScope $scope
91
-	 */
92
-	static public function afterSuite(AfterSuiteScope $scope)
93
-	{
94
-		$repo = static::$userRepo;
95
-		foreach(static::$users as $user){
96
-			if($repo->findByLogin($user->getLogin())){
97
-				try{
98
-					JobContext::removeJobByUser($user);
99
-					$repo->remove($user,true);
100
-				}catch (\Exception $e){
35
+    /**
36
+     * @var CoreContext
37
+     */
38
+    private $coreContext;
39
+	
40
+    /**
41
+     * @var MinkContext
42
+     */
43
+    private $minkContext;
44
+	
45
+    /**
46
+     * @var User
47
+     */
48
+    private $currentUser;
49
+	
50
+    /**
51
+     * @var User[]
52
+     */
53
+    static private $users = [];
54
+	
55
+    /**
56
+     * @var UserRepository
57
+     */
58
+    static private $userRepo;
59
+	
60
+    /**
61
+     * @var string
62
+     */
63
+    static private $currentSession;
64
+	
65
+    private $socialLoginInfo = [];
66
+	
67
+    /**
68
+     * @var UserInterface
69
+     */
70
+    private $loggedInUser;
71
+	
72
+    public function __construct($parameters=[])
73
+    {
74
+        $defaultLoginInfo = [
75
+            'facebook' => [
76
+                'email' => getenv('FACEBOOK_USER_EMAIL'),
77
+                'pass' => getenv('FACEBOOK_USER_PASSWORD')
78
+            ],
79
+            'linkedin' => [
80
+                'session_key-login' => getenv('LINKEDIN_USER_EMAIL'),
81
+                'session_password-login' => getenv('LINKEDIN_USER_PASSWORD')
82
+            ],
83
+        ];
84
+        $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info']:[];
85
+        $this->socialLoginInfo = array_merge($defaultLoginInfo,$socialLoginConfig);
86
+    }
87
+	
88
+    /**
89
+     * @AfterSuite
90
+     * @param AfterSuiteScope $scope
91
+     */
92
+    static public function afterSuite(AfterSuiteScope $scope)
93
+    {
94
+        $repo = static::$userRepo;
95
+        foreach(static::$users as $user){
96
+            if($repo->findByLogin($user->getLogin())){
97
+                try{
98
+                    JobContext::removeJobByUser($user);
99
+                    $repo->remove($user,true);
100
+                }catch (\Exception $e){
101 101
 				
102
-				}
103
-			}
104
-		}
105
-	}
106
-	
107
-	/**
108
-	 * @BeforeScenario
109
-	 * @param BeforeScenarioScope $scope
110
-	 */
111
-	public function beforeScenario(BeforeScenarioScope $scope)
112
-	{
113
-		$this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class);
114
-		$this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class);
115
-		static::$userRepo = $this->getUserRepository();
116
-	}
117
-	
118
-	/**
119
-	 * @return User
120
-	 */
121
-	public function getCurrentUser()
122
-	{
123
-		return $this->currentUser;
124
-	}
125
-	
126
-	/**
127
-	 * @When I fill in login form with :provider user
128
-	 */
129
-	public function iSignInWithSocialUser($provider)
130
-	{
131
-		$provider = strtolower($provider);
132
-		$mink = $this->minkContext;
133
-		foreach($this->socialLoginInfo[$provider] as $field=>$value){
134
-			$mink->fillField($field,$value);
135
-		}
136
-	}
137
-	
138
-	/**
139
-	 * @Given I am logged in as a recruiter
140
-	 * @Given I am logged in as a recruiter with :organization as organization
141
-	 */
142
-	public function iAmLoggedInAsARecruiter($organization=null)
143
-	{
144
-		$user = $this->thereIsAUserIdentifiedBy(
145
-			'[email protected]',
146
-			'test',User::ROLE_RECRUITER,
147
-			'Test Recruiter',
148
-			$organization
149
-		);
150
-		$this->startLogin($user,'test');
151
-	}
152
-	
153
-	/**
154
-	 * @Given I don't have :login user
155
-	 * @param string $login
156
-	 */
157
-	public function iDonTHaveUser($login)
158
-	{
159
-		$repo = $this->getUserRepository();
160
-		$user=$repo->findByLogin($login);
161
-		if($user instanceof UserInterface){
162
-			$repo->remove($user,true);
163
-		}
164
-	}
165
-	
166
-	/**
167
-	 * @Given I have a :role with the following:
168
-	 * @param $role
169
-	 * @param TableNode $fields
170
-	 */
171
-	public function iHaveUserWithTheFollowing($role,TableNode $fields)
172
-	{
173
-		$normalizedFields = [
174
-			'login' => '[email protected]',
175
-			'fullname' => 'Test Login',
176
-			'role' => User::ROLE_USER,
177
-			'password' => 'test',
178
-			'organization' => 'Cross Solution'
179
-		];
180
-		foreach($fields->getRowsHash() as $field=>$value){
181
-			$field = Inflector::camelize($field);
182
-			$normalizedFields[$field] = $value;
183
-		}
102
+                }
103
+            }
104
+        }
105
+    }
106
+	
107
+    /**
108
+     * @BeforeScenario
109
+     * @param BeforeScenarioScope $scope
110
+     */
111
+    public function beforeScenario(BeforeScenarioScope $scope)
112
+    {
113
+        $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class);
114
+        $this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class);
115
+        static::$userRepo = $this->getUserRepository();
116
+    }
117
+	
118
+    /**
119
+     * @return User
120
+     */
121
+    public function getCurrentUser()
122
+    {
123
+        return $this->currentUser;
124
+    }
125
+	
126
+    /**
127
+     * @When I fill in login form with :provider user
128
+     */
129
+    public function iSignInWithSocialUser($provider)
130
+    {
131
+        $provider = strtolower($provider);
132
+        $mink = $this->minkContext;
133
+        foreach($this->socialLoginInfo[$provider] as $field=>$value){
134
+            $mink->fillField($field,$value);
135
+        }
136
+    }
137
+	
138
+    /**
139
+     * @Given I am logged in as a recruiter
140
+     * @Given I am logged in as a recruiter with :organization as organization
141
+     */
142
+    public function iAmLoggedInAsARecruiter($organization=null)
143
+    {
144
+        $user = $this->thereIsAUserIdentifiedBy(
145
+            '[email protected]',
146
+            'test',User::ROLE_RECRUITER,
147
+            'Test Recruiter',
148
+            $organization
149
+        );
150
+        $this->startLogin($user,'test');
151
+    }
152
+	
153
+    /**
154
+     * @Given I don't have :login user
155
+     * @param string $login
156
+     */
157
+    public function iDonTHaveUser($login)
158
+    {
159
+        $repo = $this->getUserRepository();
160
+        $user=$repo->findByLogin($login);
161
+        if($user instanceof UserInterface){
162
+            $repo->remove($user,true);
163
+        }
164
+    }
165
+	
166
+    /**
167
+     * @Given I have a :role with the following:
168
+     * @param $role
169
+     * @param TableNode $fields
170
+     */
171
+    public function iHaveUserWithTheFollowing($role,TableNode $fields)
172
+    {
173
+        $normalizedFields = [
174
+            'login' => '[email protected]',
175
+            'fullname' => 'Test Login',
176
+            'role' => User::ROLE_USER,
177
+            'password' => 'test',
178
+            'organization' => 'Cross Solution'
179
+        ];
180
+        foreach($fields->getRowsHash() as $field=>$value){
181
+            $field = Inflector::camelize($field);
182
+            $normalizedFields[$field] = $value;
183
+        }
184 184
 		
185
-		$this->thereIsAUserIdentifiedBy(
186
-			$normalizedFields['login'],
187
-			$normalizedFields['password'],
188
-			$role,
189
-			$normalizedFields['fullname'],
190
-			$normalizedFields['organization']
191
-		);
185
+        $this->thereIsAUserIdentifiedBy(
186
+            $normalizedFields['login'],
187
+            $normalizedFields['password'],
188
+            $role,
189
+            $normalizedFields['fullname'],
190
+            $normalizedFields['organization']
191
+        );
192 192
 		
193
-	}
194
-	
195
-	/**
196
-	 * @Given I am logged in as an administrator
197
-	 */
198
-	public function iAmLoggedInAsAnAdmin()
199
-	{
200
-		$user = $this->thereIsAUserIdentifiedBy('[email protected]','test',User::ROLE_ADMIN);
201
-		$this->startLogin($user,'test');
202
-	}
203
-	
204
-	private function startLogin(UserInterface $user, $password)
205
-	{
206
-		$currentUser = $this->currentUser;
207
-		if(!is_object($currentUser) || $user->getId()!=$currentUser->getId()){
208
-			$this->iWantToLogIn();
209
-			$this->iSpecifyTheUsernameAs($user->getLogin());
210
-			$this->iSpecifyThePasswordAs($password);
211
-			$this->iLogIn();
212
-			$this->currentUser = $user;
213
-		}
214
-	}
215
-	
216
-	/**
217
-	 * @return UserRepository
218
-	 */
219
-	public function getUserRepository()
220
-	{
221
-		return $this->coreContext->getRepositories()->get('Auth\Entity\User');
222
-	}
223
-	
224
-	/**
225
-	 * @Given there is a user :email identified by :password
226
-	 */
227
-	public function thereIsAUserIdentifiedBy($email, $password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter",$organization=null)
228
-	{
229
-		$repo = $this->getUserRepository();
230
-		if(!is_object($user=$repo->findByEmail($email))){
231
-			$user = $this->createUser($email,$password,$role,$fullname,$organization);
232
-		}
193
+    }
194
+	
195
+    /**
196
+     * @Given I am logged in as an administrator
197
+     */
198
+    public function iAmLoggedInAsAnAdmin()
199
+    {
200
+        $user = $this->thereIsAUserIdentifiedBy('[email protected]','test',User::ROLE_ADMIN);
201
+        $this->startLogin($user,'test');
202
+    }
203
+	
204
+    private function startLogin(UserInterface $user, $password)
205
+    {
206
+        $currentUser = $this->currentUser;
207
+        if(!is_object($currentUser) || $user->getId()!=$currentUser->getId()){
208
+            $this->iWantToLogIn();
209
+            $this->iSpecifyTheUsernameAs($user->getLogin());
210
+            $this->iSpecifyThePasswordAs($password);
211
+            $this->iLogIn();
212
+            $this->currentUser = $user;
213
+        }
214
+    }
215
+	
216
+    /**
217
+     * @return UserRepository
218
+     */
219
+    public function getUserRepository()
220
+    {
221
+        return $this->coreContext->getRepositories()->get('Auth\Entity\User');
222
+    }
223
+	
224
+    /**
225
+     * @Given there is a user :email identified by :password
226
+     */
227
+    public function thereIsAUserIdentifiedBy($email, $password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter",$organization=null)
228
+    {
229
+        $repo = $this->getUserRepository();
230
+        if(!is_object($user=$repo->findByEmail($email))){
231
+            $user = $this->createUser($email,$password,$role,$fullname,$organization);
232
+        }
233 233
 		
234
-		if(!is_null($organization)){
235
-			$this->iHaveMainOrganization($user,$organization);
236
-		}
237
-		$this->addCreatedUser($user);
238
-		return $user;
239
-	}
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');
234
+        if(!is_null($organization)){
235
+            $this->iHaveMainOrganization($user,$organization);
236
+        }
237
+        $this->addCreatedUser($user);
238
+        return $user;
239
+    }
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');
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
-	}
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
-		$organization=$repoOrganization->findByName($orgName);
294
-		if(!$organization instanceof Organization){
295
-			$organization = new Organization();
296
-			$organizationName = new OrganizationName($orgName);
297
-			$organization->setOrganizationName($organizationName);
298
-			$permissions = $organization->getPermissions();
299
-			$permissions->grant($user,Permissions::PERMISSION_ALL);
300
-		}else {
301
-			$organization->getPermissions()->grant($user,Permissions::PERMISSION_ALL);
302
-		}
303
-		$organization->setUser($user);
304
-		$repoOrganization->store($organization);
305
-		$repoOrganization->getDocumentManager()->refresh($organization);
306
-	}
307
-	
308
-	/**
309
-	 * @When I want to log in
310
-	 */
311
-	public function iWantToLogIn()
312
-	{
313
-		$session = $this->minkContext->getSession();
314
-		$url = $this->minkContext->locatePath('/login');
315
-		$session->visit($url);
316
-	}
317
-	
318
-	/**
319
-	 * @When I specify the username as :username
320
-	 */
321
-	public function iSpecifyTheUsernameAs($username)
322
-	{
323
-		$this->minkContext->fillField('Login name',$username);
324
-	}
325
-	
326
-	/**
327
-	 * @When I specify the password as :password
328
-	 */
329
-	public function iSpecifyThePasswordAs($password)
330
-	{
331
-		$this->minkContext->fillField('Password',$password);
332
-	}
333
-	
334
-	/**
335
-	 * @Given I am logged in as :username identified by :password
336
-	 */
337
-	public function iAmLoggedInAsIdentifiedBy($username, $password)
338
-	{
339
-		$repo = $this->getUserRepository();
340
-		$user = $repo->findByLogin($username);
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
+	
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
+        $organization=$repoOrganization->findByName($orgName);
294
+        if(!$organization instanceof Organization){
295
+            $organization = new Organization();
296
+            $organizationName = new OrganizationName($orgName);
297
+            $organization->setOrganizationName($organizationName);
298
+            $permissions = $organization->getPermissions();
299
+            $permissions->grant($user,Permissions::PERMISSION_ALL);
300
+        }else {
301
+            $organization->getPermissions()->grant($user,Permissions::PERMISSION_ALL);
302
+        }
303
+        $organization->setUser($user);
304
+        $repoOrganization->store($organization);
305
+        $repoOrganization->getDocumentManager()->refresh($organization);
306
+    }
307
+	
308
+    /**
309
+     * @When I want to log in
310
+     */
311
+    public function iWantToLogIn()
312
+    {
313
+        $session = $this->minkContext->getSession();
314
+        $url = $this->minkContext->locatePath('/login');
315
+        $session->visit($url);
316
+    }
317
+	
318
+    /**
319
+     * @When I specify the username as :username
320
+     */
321
+    public function iSpecifyTheUsernameAs($username)
322
+    {
323
+        $this->minkContext->fillField('Login name',$username);
324
+    }
325
+	
326
+    /**
327
+     * @When I specify the password as :password
328
+     */
329
+    public function iSpecifyThePasswordAs($password)
330
+    {
331
+        $this->minkContext->fillField('Password',$password);
332
+    }
333
+	
334
+    /**
335
+     * @Given I am logged in as :username identified by :password
336
+     */
337
+    public function iAmLoggedInAsIdentifiedBy($username, $password)
338
+    {
339
+        $repo = $this->getUserRepository();
340
+        $user = $repo->findByLogin($username);
341 341
 		
342
-		if(!$user instanceof User){
343
-			throw new \Exception(sprintf('There is no user with this login: "%s"',$username));
344
-		}
345
-		$this->currentUser = $user;
346
-		$this->iWantToLogIn();
347
-		$this->iSpecifyTheUsernameAs($username);
348
-		$this->iSpecifyThePasswordAs($password);
349
-		$this->iLogIn();
350
-	}
351
-	
352
-	/**
353
-	 * @When I log in
354
-	 */
355
-	public function iLogIn()
356
-	{
357
-		$this->minkContext->pressButton('login');
358
-	}
359
-	
360
-	/**
361
-	 * @When I press logout link
362
-	 */
363
-	public function iPressLogoutLink()
364
-	{
365
-		$url = $this->coreContext->generateUrl('/logout');
366
-		$url = str_replace('','',$url);
367
-		$this->minkContext->visit($url);
368
-	}
369
-	
370
-	/**
371
-	 * @Given I log in with username :username and password :password
372
-	 */
373
-	public function iLogInWith($username, $password)
374
-	{
375
-		$repo = $this->getUserRepository();
376
-		$user = $repo->findByLogin($username);
377
-		$this->iWantToLogIn();
378
-		$this->iSpecifyTheUsernameAs($username);
379
-		$this->iSpecifyThePasswordAs($password);
380
-		$this->iLogIn();
381
-		$this->loggedInUser = $user;
382
-	}
383
-	
384
-	/**
385
-	 * @When I go to profile page
386
-	 */
387
-	public function iGoToProfilePage()
388
-	{
389
-		$url = $this->coreContext->generateUrl('/my/profile');
390
-		$this->minkContext->visit($url);
391
-	}
392
-	
393
-	/**
394
-	 * @Given there is a user with the following:
395
-	 */
396
-	public function thereIsAUserWithTheFollowing(TableNode $table)
397
-	{
398
-		$repo = $this->getUserRepository();
399
-		$data = $table->getRowsHash();
400
-		$email = isset($data['email']) ? $data['email']:'[email protected]';
401
-		$password = isset($data['password']) ? $data['password']:'test';
402
-		$fullname = isset($data['fullname']) ? $data['fullname']:'Test User';
403
-		$role = isset($data['role']) ? $data['role']:User::ROLE_RECRUITER;
342
+        if(!$user instanceof User){
343
+            throw new \Exception(sprintf('There is no user with this login: "%s"',$username));
344
+        }
345
+        $this->currentUser = $user;
346
+        $this->iWantToLogIn();
347
+        $this->iSpecifyTheUsernameAs($username);
348
+        $this->iSpecifyThePasswordAs($password);
349
+        $this->iLogIn();
350
+    }
351
+	
352
+    /**
353
+     * @When I log in
354
+     */
355
+    public function iLogIn()
356
+    {
357
+        $this->minkContext->pressButton('login');
358
+    }
359
+	
360
+    /**
361
+     * @When I press logout link
362
+     */
363
+    public function iPressLogoutLink()
364
+    {
365
+        $url = $this->coreContext->generateUrl('/logout');
366
+        $url = str_replace('','',$url);
367
+        $this->minkContext->visit($url);
368
+    }
369
+	
370
+    /**
371
+     * @Given I log in with username :username and password :password
372
+     */
373
+    public function iLogInWith($username, $password)
374
+    {
375
+        $repo = $this->getUserRepository();
376
+        $user = $repo->findByLogin($username);
377
+        $this->iWantToLogIn();
378
+        $this->iSpecifyTheUsernameAs($username);
379
+        $this->iSpecifyThePasswordAs($password);
380
+        $this->iLogIn();
381
+        $this->loggedInUser = $user;
382
+    }
383
+	
384
+    /**
385
+     * @When I go to profile page
386
+     */
387
+    public function iGoToProfilePage()
388
+    {
389
+        $url = $this->coreContext->generateUrl('/my/profile');
390
+        $this->minkContext->visit($url);
391
+    }
392
+	
393
+    /**
394
+     * @Given there is a user with the following:
395
+     */
396
+    public function thereIsAUserWithTheFollowing(TableNode $table)
397
+    {
398
+        $repo = $this->getUserRepository();
399
+        $data = $table->getRowsHash();
400
+        $email = isset($data['email']) ? $data['email']:'[email protected]';
401
+        $password = isset($data['password']) ? $data['password']:'test';
402
+        $fullname = isset($data['fullname']) ? $data['fullname']:'Test User';
403
+        $role = isset($data['role']) ? $data['role']:User::ROLE_RECRUITER;
404 404
 		
405
-		if(!is_object($user=$repo->findByLogin($email))){
406
-			$user = $this->createUser($email,$password,$role,$fullname);
407
-		}
408
-		$this->currentUser = $user;
409
-		$this->addCreatedUser($user);
410
-	}
411
-	
412
-	private function addCreatedUser(UserInterface $user)
413
-	{
414
-		if(!in_array($user,static::$users)){
415
-			static::$users[] = $user;
416
-		}
417
-	}
418
-	
419
-	/**
420
-	 * @When I want to change my password
421
-	 */
422
-	public function iWantToChangeMyPassword()
423
-	{
424
-		$mink = $this->minkContext;
425
-		$url = $this->coreContext->generateUrl('/my/password');
426
-		$mink->getSession()->visit($url);
427
-	}
405
+        if(!is_object($user=$repo->findByLogin($email))){
406
+            $user = $this->createUser($email,$password,$role,$fullname);
407
+        }
408
+        $this->currentUser = $user;
409
+        $this->addCreatedUser($user);
410
+    }
411
+	
412
+    private function addCreatedUser(UserInterface $user)
413
+    {
414
+        if(!in_array($user,static::$users)){
415
+            static::$users[] = $user;
416
+        }
417
+    }
418
+	
419
+    /**
420
+     * @When I want to change my password
421
+     */
422
+    public function iWantToChangeMyPassword()
423
+    {
424
+        $mink = $this->minkContext;
425
+        $url = $this->coreContext->generateUrl('/my/password');
426
+        $mink->getSession()->visit($url);
427
+    }
428 428
 	
429 429
 }
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	private $loggedInUser;
71 71
 	
72
-	public function __construct($parameters=[])
72
+	public function __construct($parameters = [])
73 73
 	{
74 74
 		$defaultLoginInfo = [
75 75
 			'facebook' => [
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 				'session_password-login' => getenv('LINKEDIN_USER_PASSWORD')
82 82
 			],
83 83
 		];
84
-		$socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info']:[];
85
-		$this->socialLoginInfo = array_merge($defaultLoginInfo,$socialLoginConfig);
84
+		$socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info'] : [];
85
+		$this->socialLoginInfo = array_merge($defaultLoginInfo, $socialLoginConfig);
86 86
 	}
87 87
 	
88 88
 	/**
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
 	static public function afterSuite(AfterSuiteScope $scope)
93 93
 	{
94 94
 		$repo = static::$userRepo;
95
-		foreach(static::$users as $user){
96
-			if($repo->findByLogin($user->getLogin())){
97
-				try{
95
+		foreach (static::$users as $user) {
96
+			if ($repo->findByLogin($user->getLogin())) {
97
+				try {
98 98
 					JobContext::removeJobByUser($user);
99
-					$repo->remove($user,true);
100
-				}catch (\Exception $e){
99
+					$repo->remove($user, true);
100
+				} catch (\Exception $e) {
101 101
 				
102 102
 				}
103 103
 			}
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 	{
131 131
 		$provider = strtolower($provider);
132 132
 		$mink = $this->minkContext;
133
-		foreach($this->socialLoginInfo[$provider] as $field=>$value){
134
-			$mink->fillField($field,$value);
133
+		foreach ($this->socialLoginInfo[$provider] as $field=>$value) {
134
+			$mink->fillField($field, $value);
135 135
 		}
136 136
 	}
137 137
 	
@@ -139,15 +139,15 @@  discard block
 block discarded – undo
139 139
 	 * @Given I am logged in as a recruiter
140 140
 	 * @Given I am logged in as a recruiter with :organization as organization
141 141
 	 */
142
-	public function iAmLoggedInAsARecruiter($organization=null)
142
+	public function iAmLoggedInAsARecruiter($organization = null)
143 143
 	{
144 144
 		$user = $this->thereIsAUserIdentifiedBy(
145 145
 			'[email protected]',
146
-			'test',User::ROLE_RECRUITER,
146
+			'test', User::ROLE_RECRUITER,
147 147
 			'Test Recruiter',
148 148
 			$organization
149 149
 		);
150
-		$this->startLogin($user,'test');
150
+		$this->startLogin($user, 'test');
151 151
 	}
152 152
 	
153 153
 	/**
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 	public function iDonTHaveUser($login)
158 158
 	{
159 159
 		$repo = $this->getUserRepository();
160
-		$user=$repo->findByLogin($login);
161
-		if($user instanceof UserInterface){
162
-			$repo->remove($user,true);
160
+		$user = $repo->findByLogin($login);
161
+		if ($user instanceof UserInterface) {
162
+			$repo->remove($user, true);
163 163
 		}
164 164
 	}
165 165
 	
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @param $role
169 169
 	 * @param TableNode $fields
170 170
 	 */
171
-	public function iHaveUserWithTheFollowing($role,TableNode $fields)
171
+	public function iHaveUserWithTheFollowing($role, TableNode $fields)
172 172
 	{
173 173
 		$normalizedFields = [
174 174
 			'login' => '[email protected]',
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 			'password' => 'test',
178 178
 			'organization' => 'Cross Solution'
179 179
 		];
180
-		foreach($fields->getRowsHash() as $field=>$value){
180
+		foreach ($fields->getRowsHash() as $field=>$value) {
181 181
 			$field = Inflector::camelize($field);
182 182
 			$normalizedFields[$field] = $value;
183 183
 		}
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	public function iAmLoggedInAsAnAdmin()
199 199
 	{
200
-		$user = $this->thereIsAUserIdentifiedBy('[email protected]','test',User::ROLE_ADMIN);
201
-		$this->startLogin($user,'test');
200
+		$user = $this->thereIsAUserIdentifiedBy('[email protected]', 'test', User::ROLE_ADMIN);
201
+		$this->startLogin($user, 'test');
202 202
 	}
203 203
 	
204 204
 	private function startLogin(UserInterface $user, $password)
205 205
 	{
206 206
 		$currentUser = $this->currentUser;
207
-		if(!is_object($currentUser) || $user->getId()!=$currentUser->getId()){
207
+		if (!is_object($currentUser) || $user->getId() != $currentUser->getId()) {
208 208
 			$this->iWantToLogIn();
209 209
 			$this->iSpecifyTheUsernameAs($user->getLogin());
210 210
 			$this->iSpecifyThePasswordAs($password);
@@ -224,15 +224,15 @@  discard block
 block discarded – undo
224 224
 	/**
225 225
 	 * @Given there is a user :email identified by :password
226 226
 	 */
227
-	public function thereIsAUserIdentifiedBy($email, $password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter",$organization=null)
227
+	public function thereIsAUserIdentifiedBy($email, $password, $role = User::ROLE_RECRUITER, $fullname = "Test Recruiter", $organization = null)
228 228
 	{
229 229
 		$repo = $this->getUserRepository();
230
-		if(!is_object($user=$repo->findByEmail($email))){
231
-			$user = $this->createUser($email,$password,$role,$fullname,$organization);
230
+		if (!is_object($user = $repo->findByEmail($email))) {
231
+			$user = $this->createUser($email, $password, $role, $fullname, $organization);
232 232
 		}
233 233
 		
234
-		if(!is_null($organization)){
235
-			$this->iHaveMainOrganization($user,$organization);
234
+		if (!is_null($organization)) {
235
+			$this->iHaveMainOrganization($user, $organization);
236 236
 		}
237 237
 		$this->addCreatedUser($user);
238 238
 		return $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,19 +286,19 @@  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
-		$organization=$repoOrganization->findByName($orgName);
294
-		if(!$organization instanceof Organization){
293
+		$organization = $repoOrganization->findByName($orgName);
294
+		if (!$organization instanceof Organization) {
295 295
 			$organization = new Organization();
296 296
 			$organizationName = new OrganizationName($orgName);
297 297
 			$organization->setOrganizationName($organizationName);
298 298
 			$permissions = $organization->getPermissions();
299
-			$permissions->grant($user,Permissions::PERMISSION_ALL);
300
-		}else {
301
-			$organization->getPermissions()->grant($user,Permissions::PERMISSION_ALL);
299
+			$permissions->grant($user, Permissions::PERMISSION_ALL);
300
+		} else {
301
+			$organization->getPermissions()->grant($user, Permissions::PERMISSION_ALL);
302 302
 		}
303 303
 		$organization->setUser($user);
304 304
 		$repoOrganization->store($organization);
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	public function iSpecifyTheUsernameAs($username)
322 322
 	{
323
-		$this->minkContext->fillField('Login name',$username);
323
+		$this->minkContext->fillField('Login name', $username);
324 324
 	}
325 325
 	
326 326
 	/**
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 */
329 329
 	public function iSpecifyThePasswordAs($password)
330 330
 	{
331
-		$this->minkContext->fillField('Password',$password);
331
+		$this->minkContext->fillField('Password', $password);
332 332
 	}
333 333
 	
334 334
 	/**
@@ -339,8 +339,8 @@  discard block
 block discarded – undo
339 339
 		$repo = $this->getUserRepository();
340 340
 		$user = $repo->findByLogin($username);
341 341
 		
342
-		if(!$user instanceof User){
343
-			throw new \Exception(sprintf('There is no user with this login: "%s"',$username));
342
+		if (!$user instanceof User) {
343
+			throw new \Exception(sprintf('There is no user with this login: "%s"', $username));
344 344
 		}
345 345
 		$this->currentUser = $user;
346 346
 		$this->iWantToLogIn();
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	public function iPressLogoutLink()
364 364
 	{
365 365
 		$url = $this->coreContext->generateUrl('/logout');
366
-		$url = str_replace('','',$url);
366
+		$url = str_replace('', '', $url);
367 367
 		$this->minkContext->visit($url);
368 368
 	}
369 369
 	
@@ -397,13 +397,13 @@  discard block
 block discarded – undo
397 397
 	{
398 398
 		$repo = $this->getUserRepository();
399 399
 		$data = $table->getRowsHash();
400
-		$email = isset($data['email']) ? $data['email']:'[email protected]';
401
-		$password = isset($data['password']) ? $data['password']:'test';
402
-		$fullname = isset($data['fullname']) ? $data['fullname']:'Test User';
403
-		$role = isset($data['role']) ? $data['role']:User::ROLE_RECRUITER;
400
+		$email = isset($data['email']) ? $data['email'] : '[email protected]';
401
+		$password = isset($data['password']) ? $data['password'] : 'test';
402
+		$fullname = isset($data['fullname']) ? $data['fullname'] : 'Test User';
403
+		$role = isset($data['role']) ? $data['role'] : User::ROLE_RECRUITER;
404 404
 		
405
-		if(!is_object($user=$repo->findByLogin($email))){
406
-			$user = $this->createUser($email,$password,$role,$fullname);
405
+		if (!is_object($user = $repo->findByLogin($email))) {
406
+			$user = $this->createUser($email, $password, $role, $fullname);
407 407
 		}
408 408
 		$this->currentUser = $user;
409 409
 		$this->addCreatedUser($user);
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 	
412 412
 	private function addCreatedUser(UserInterface $user)
413 413
 	{
414
-		if(!in_array($user,static::$users)){
414
+		if (!in_array($user, static::$users)) {
415 415
 			static::$users[] = $user;
416 416
 		}
417 417
 	}
Please login to merge, or discard this patch.
module/Core/src/Core/Controller/Plugin/CreatePaginator.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,6 @@
 block discarded – undo
128 128
     }
129 129
     
130 130
     /**
131
-     * @param ControllerManager $controllerManager
132 131
      * @return CreatePaginator
133 132
      * @codeCoverageIgnore
134 133
      */
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
      */
45 45
     protected $request;
46 46
 	
47
-	/**
48
-	 * CreatePaginator constructor.
49
-	 *
50
-	 * @param ContainerInterface $container
51
-	 * @param HttpRequest $request
52
-	 */
47
+    /**
48
+     * CreatePaginator constructor.
49
+     *
50
+     * @param ContainerInterface $container
51
+     * @param HttpRequest $request
52
+     */
53 53
     public function __construct(ContainerInterface $container, HttpRequest $request)
54 54
     {
55 55
         $this->serviceManager = $container->get('ServiceManager');
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
         /* @var \Core\EventManager\EventManager $events */
106 106
         /* @var \Zend\Paginator\Paginator $paginator */
107 107
         /* @var CreatePaginatorEvent $event */
108
-	    $events = $this->serviceManager->get('Core/CreatePaginator/Events');
108
+        $events = $this->serviceManager->get('Core/CreatePaginator/Events');
109 109
 
110
-	    $event = $events->getEvent(CreatePaginatorEvent::EVENT_CREATE_PAGINATOR,$this,[
110
+        $event = $events->getEvent(CreatePaginatorEvent::EVENT_CREATE_PAGINATOR,$this,[
111 111
             'paginatorParams' => $params,
112 112
             'paginators' => $paginators,
113 113
             'paginatorName' => $paginatorName
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
             $paginator = $paginators->get($paginatorName,$params);
122 122
         }
123 123
         $paginator->setCurrentPageNumber(isset($params['page']) ? $params['page'] : 1)
124
-                  ->setItemCountPerPage(isset($params['count']) ? $params['count'] : 10)
125
-                  ->setPageRange(isset($params['range']) ? $params['range'] : 5);
124
+                    ->setItemCountPerPage(isset($params['count']) ? $params['count'] : 10)
125
+                    ->setPageRange(isset($params['range']) ? $params['range'] : 5);
126 126
 
127 127
         return $paginator;
128 128
     }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         /* @var CreatePaginatorEvent $event */
108 108
 	    $events = $this->serviceManager->get('Core/CreatePaginator/Events');
109 109
 
110
-	    $event = $events->getEvent(CreatePaginatorEvent::EVENT_CREATE_PAGINATOR,$this,[
110
+	    $event = $events->getEvent(CreatePaginatorEvent::EVENT_CREATE_PAGINATOR, $this, [
111 111
             'paginatorParams' => $params,
112 112
             'paginators' => $paginators,
113 113
             'paginatorName' => $paginatorName
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 
117 117
         $paginator = $event->getPaginator();
118 118
 
119
-        if(!$paginator instanceof Paginator){
119
+        if (!$paginator instanceof Paginator) {
120 120
             // no paginator created by listener, so let's create default paginator
121
-            $paginator = $paginators->get($paginatorName,$params);
121
+            $paginator = $paginators->get($paginatorName, $params);
122 122
         }
123 123
         $paginator->setCurrentPageNumber(isset($params['page']) ? $params['page'] : 1)
124 124
                   ->setItemCountPerPage(isset($params['count']) ? $params['count'] : 10)
Please login to merge, or discard this patch.
module/Core/src/Core/EventManager/EventManager.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@
 block discarded – undo
60 60
      *
61 61
      * If no event instance is passed, it creates one prior to triggering.
62 62
      *
63
-     * @param EventInterface|string $eventName
64
-     * @param object|string|null $target
63
+     * @param EventInterface $eventName
64
+     * @param \Core\Controller\AdminController $target
65 65
      * @param array $argv
66 66
      *
67 67
      * @return \Zend\EventManager\ResponseCollection
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
         return $event;
56 56
     }
57 57
 	
58
-	/**
59
-	 * Trigger an event.
58
+    /**
59
+     * Trigger an event.
60 60
      *
61 61
      * If no event instance is passed, it creates one prior to triggering.
62 62
      *
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * @param array $argv
66 66
      *
67 67
      * @return \Zend\EventManager\ResponseCollection
68
-	 */
68
+     */
69 69
     public function trigger($eventName, $target = null, $argv = [])
70 70
     {
71 71
         $event = $eventName instanceOf EventInterface
Please login to merge, or discard this patch.
module/Core/src/Core/Factory/Service/RestClientFactory.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
     }
59 59
 
60 60
     /**
61
-     * @return mixed
61
+     * @return null|string
62 62
      */
63 63
     abstract protected function getUri();
64 64
 
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,15 +38,15 @@
 block discarded – undo
38 38
      */
39 39
     protected $serviceLocator;
40 40
 	
41
-	public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
42
-	{
43
-		$this->serviceLocator = $container;
44
-		$service = new RestClient($this->getUri(), $this->getConfig());
45
-		return $service;
46
-	}
41
+    public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
42
+    {
43
+        $this->serviceLocator = $container;
44
+        $service = new RestClient($this->getUri(), $this->getConfig());
45
+        return $service;
46
+    }
47 47
 	
48 48
 	
49
-	/**
49
+    /**
50 50
      * Create the settings service
51 51
      *
52 52
      * @param  ServiceLocatorInterface $serviceLocator
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     protected $serviceLocator;
40 40
 	
41
-	public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
41
+	public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
42 42
 	{
43 43
 		$this->serviceLocator = $container;
44 44
 		$service = new RestClient($this->getUri(), $this->getConfig());
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function createService(ServiceLocatorInterface $serviceLocator)
56 56
     {
57
-        return $this($serviceLocator,RestClient::class);
57
+        return $this($serviceLocator, RestClient::class);
58 58
     }
59 59
 
60 60
     /**
Please login to merge, or discard this patch.
module/Core/src/Core/I18n/LocaleFactory.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
      * @param  string             $requestedName
32 32
      * @param  null|array         $options
33 33
      *
34
-     * @return object
34
+     * @return Locale
35 35
      * @throws ServiceNotFoundException if unable to resolve the service.
36 36
      * @throws ServiceNotCreatedException if an exception is raised when
37 37
      *     creating a service.
Please login to merge, or discard this patch.
module/Core/src/Core/Paginator/PaginatorFactoryAbstract.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,6 @@
 block discarded – undo
41 41
     }
42 42
 	
43 43
 	/**
44
-     * @param ContainerInterface $serviceLocator
45 44
      * @return mixed|Paginator
46 45
      */
47 46
     public function createService(ContainerInterface $container)
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,19 +28,19 @@
 block discarded – undo
28 28
 
29 29
     public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
30 30
     {
31
-	    /* @var PaginatorService $paginatorService */
32
-	    /* @var RepositoryService $repositories */
33
-	    $repositories   = $container->get('repositories');
34
-	    $repository     = $repositories->get($this->getRepository());
35
-	    $queryBuilder   = $repository->createQueryBuilder();
36
-	    $filter         = $container->get('FilterManager')->get($this->getFilter());
37
-	    $adapter        = new \Core\Paginator\Adapter\DoctrineMongoLateCursor($queryBuilder, $filter, $options);
38
-	    $service        = new Paginator($adapter);
31
+        /* @var PaginatorService $paginatorService */
32
+        /* @var RepositoryService $repositories */
33
+        $repositories   = $container->get('repositories');
34
+        $repository     = $repositories->get($this->getRepository());
35
+        $queryBuilder   = $repository->createQueryBuilder();
36
+        $filter         = $container->get('FilterManager')->get($this->getFilter());
37
+        $adapter        = new \Core\Paginator\Adapter\DoctrineMongoLateCursor($queryBuilder, $filter, $options);
38
+        $service        = new Paginator($adapter);
39 39
 	
40
-	    return $service;
40
+        return $service;
41 41
     }
42 42
 	
43
-	/**
43
+    /**
44 44
      * @param ContainerInterface $serviceLocator
45 45
      * @return mixed|Paginator
46 46
      */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 abstract class PaginatorFactoryAbstract implements FactoryInterface
27 27
 {
28 28
 
29
-    public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
29
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
30 30
     {
31 31
 	    /* @var PaginatorService $paginatorService */
32 32
 	    /* @var RepositoryService $repositories */
Please login to merge, or discard this patch.
module/Core/src/Core/View/Helper/Services.php 1 patch
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,6 @@
 block discarded – undo
86 86
     }
87 87
     
88 88
     /**
89
-     * @param HelperPluginManager $helperPluginManager
90 89
      * @return Services
91 90
      */
92 91
     public static function factory($sm)
Please login to merge, or discard this patch.
config/common.modules.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -11,23 +11,23 @@
 block discarded – undo
11 11
  */
12 12
 
13 13
 return array(
14
-	'Zend\ServiceManager\Di',
15
-	'Zend\Session',
16
-	'Zend\Router',
17
-	'Zend\Navigation',
18
-	'Zend\I18n',
19
-	'Zend\Filter',
20
-	'Zend\InputFilter',
21
-	'Zend\Form',
22
-	'Zend\Validator',
23
-	'Zend\Log',
24
-	'Zend\Mvc\Plugin\Prg',
25
-	'Zend\Mvc\Plugin\Identity',
26
-	'Zend\Mvc\Plugin\FlashMessenger',
27
-	'Zend\Mvc\I18n',
28
-	'Zend\Mvc\Console',
29
-	'Zend\Hydrator',
30
-	'Zend\Serializer',
31
-	'DoctrineModule',
32
-	'DoctrineMongoODMModule',
14
+    'Zend\ServiceManager\Di',
15
+    'Zend\Session',
16
+    'Zend\Router',
17
+    'Zend\Navigation',
18
+    'Zend\I18n',
19
+    'Zend\Filter',
20
+    'Zend\InputFilter',
21
+    'Zend\Form',
22
+    'Zend\Validator',
23
+    'Zend\Log',
24
+    'Zend\Mvc\Plugin\Prg',
25
+    'Zend\Mvc\Plugin\Identity',
26
+    'Zend\Mvc\Plugin\FlashMessenger',
27
+    'Zend\Mvc\I18n',
28
+    'Zend\Mvc\Console',
29
+    'Zend\Hydrator',
30
+    'Zend\Serializer',
31
+    'DoctrineModule',
32
+    'DoctrineMongoODMModule',
33 33
 );
34 34
\ No newline at end of file
Please login to merge, or discard this patch.