Completed
Pull Request — develop (#462)
by ANTHONIUS
09:40
created
module/Behat/src/CvContext.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -22,23 +22,23 @@
 block discarded – undo
22 22
  */
23 23
 class CvContext implements Context
24 24
 {
25
-	use CommonContextTrait;
25
+    use CommonContextTrait;
26 26
 	
27 27
 	
28
-	/**
29
-	 * @Given I go to manage my resume page
30
-	 */
31
-	public function iGoToManageResumePage()
32
-	{
33
-	    $url = $this->buildUrl('lang/my-cv');
34
-		$this->visit($url);
35
-	}
28
+    /**
29
+     * @Given I go to manage my resume page
30
+     */
31
+    public function iGoToManageResumePage()
32
+    {
33
+        $url = $this->buildUrl('lang/my-cv');
34
+        $this->visit($url);
35
+    }
36 36
 	
37
-	/**
38
-	 * @When I click edit on my personal information
39
-	 */
40
-	public function iClickEditOnPersonalInformations()
41
-	{
42
-		$this->summaryFormContext->iClickEditOnForm('resumePersonalInformations');
43
-	}
37
+    /**
38
+     * @When I click edit on my personal information
39
+     */
40
+    public function iClickEditOnPersonalInformations()
41
+    {
42
+        $this->summaryFormContext->iClickEditOnForm('resumePersonalInformations');
43
+    }
44 44
 }
Please login to merge, or discard this patch.
module/Core/src/Core/Factory/Controller/LazyControllerFactory.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -27,48 +27,48 @@  discard block
 block discarded – undo
27 27
  */
28 28
 class LazyControllerFactory implements AbstractFactoryInterface
29 29
 {
30
-	protected $aliases = [
31
-		FormElementManager::class => 'FormElementManager',
32
-		ValidatorPluginManager::class => 'ValidatorManager',
33
-		Translator::class => 'translator',
34
-		ModuleManagerInterface::class => 'ModuleManager',
35
-		EventManager::class => 'Core/EventManager',
30
+    protected $aliases = [
31
+        FormElementManager::class => 'FormElementManager',
32
+        ValidatorPluginManager::class => 'ValidatorManager',
33
+        Translator::class => 'translator',
34
+        ModuleManagerInterface::class => 'ModuleManager',
35
+        EventManager::class => 'Core/EventManager',
36 36
         RepositoryService::class => 'repositories',
37
-	];
37
+    ];
38 38
 	
39
-	public function canCreate( ContainerInterface $container, $requestedName )
40
-	{
41
-		return strstr( $requestedName,'\Controller') !== false;
42
-	}
39
+    public function canCreate( ContainerInterface $container, $requestedName )
40
+    {
41
+        return strstr( $requestedName,'\Controller') !== false;
42
+    }
43 43
 
44
-	public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
45
-	{
44
+    public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
45
+    {
46 46
         $className = $this->getClassName($requestedName);
47
-		$class = new \ReflectionClass($className);
47
+        $class = new \ReflectionClass($className);
48 48
 
49
-		if( $constructor = $class->getConstructor() )
50
-		{
51
-			if( $params = $constructor->getParameters() )
52
-			{
53
-				$constructorArgs = [];
54
-				foreach( $params as $p )
55
-				{
56
-					$serviceName = '';
57
-					if( $p->getClass() ) {
58
-						$serviceName = $p->getClass()->getName();
59
-						if (array_key_exists($serviceName, $this->aliases)) {
60
-							$serviceName = $this->aliases[$serviceName];
61
-						}
62
-					}
63
-					else{
64
-						if( $p->getName() == 'config' ){
49
+        if( $constructor = $class->getConstructor() )
50
+        {
51
+            if( $params = $constructor->getParameters() )
52
+            {
53
+                $constructorArgs = [];
54
+                foreach( $params as $p )
55
+                {
56
+                    $serviceName = '';
57
+                    if( $p->getClass() ) {
58
+                        $serviceName = $p->getClass()->getName();
59
+                        if (array_key_exists($serviceName, $this->aliases)) {
60
+                            $serviceName = $this->aliases[$serviceName];
61
+                        }
62
+                    }
63
+                    else{
64
+                        if( $p->getName() == 'config' ){
65 65
                             $serviceName = 'config';
66 66
                         }
67
-					}
67
+                    }
68 68
 
69
-					if(!$container->has($serviceName)){
70
-					    throw new ServiceNotCreatedException(sprintf(
71
-					        'Can\'t create constructor argument "%s" for service "%s"',
69
+                    if(!$container->has($serviceName)){
70
+                        throw new ServiceNotCreatedException(sprintf(
71
+                            'Can\'t create constructor argument "%s" for service "%s"',
72 72
                             $p->getName(),$requestedName
73 73
                         ));
74 74
                     }
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
                         echo __CLASS__ . " couldn't create an instance of {$p->getName()} to satisfy the constructor for $requestedName.";
80 80
                         exit;
81 81
                     }
82
-				}
83
-				return $class->newInstanceArgs($constructorArgs);
84
-			}
85
-		}
82
+                }
83
+                return $class->newInstanceArgs($constructorArgs);
84
+            }
85
+        }
86 86
 		
87
-		return new $className;
88
-	}
87
+        return new $className;
88
+    }
89 89
 
90 90
     /**
91 91
      * Generate class name
Please login to merge, or discard this patch.
module/Core/src/Core/Controller/IndexController.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,24 +25,24 @@  discard block
 block discarded – undo
25 25
  */
26 26
 class IndexController extends AbstractActionController
27 27
 {
28
-	/** @var  DefaultListener */
29
-	private $defaultListener;
28
+    /** @var  DefaultListener */
29
+    private $defaultListener;
30 30
 	
31
-	private $config;
31
+    private $config;
32 32
 	
33
-	/**
34
-	 * @var ModuleManager
35
-	 */
36
-	private $moduleManager;
33
+    /**
34
+     * @var ModuleManager
35
+     */
36
+    private $moduleManager;
37 37
 	
38
-	public function __construct(
38
+    public function __construct(
39 39
         ModuleManagerInterface $moduleManager,
40 40
         $config
41 41
     )
42
-	{
43
-		$this->config = $config;
44
-		$this->moduleManager = $moduleManager;
45
-	}
42
+    {
43
+        $this->config = $config;
44
+        $this->moduleManager = $moduleManager;
45
+    }
46 46
 
47 47
     /**
48 48
      * Home site
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     {
107 107
         $viewModel = new ViewModel();
108 108
         $viewModel->setTemplate('error/index')
109
-                  ->setVariable('message', 'An unexpected error had occured. Please try again later.');
109
+                    ->setVariable('message', 'An unexpected error had occured. Please try again later.');
110 110
         return $viewModel;
111 111
     }
112 112
 }
Please login to merge, or discard this patch.
module/Core/config/module.config.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -41,24 +41,24 @@  discard block
 block discarded – undo
41 41
     'log' => array(
42 42
         'Core/Log' => array(
43 43
             'writers' => array(
44
-                 array(
45
-                     'name' => 'stream',
44
+                    array(
45
+                        'name' => 'stream',
46 46
                     'priority' => 1000,
47 47
                     'options' => array(
48
-                         'stream' => __DIR__ .'/../../../log/yawik.log',
48
+                            'stream' => __DIR__ .'/../../../log/yawik.log',
49
+                    ),
49 50
                     ),
50
-                 ),
51 51
             ),
52 52
         ),
53 53
         'Log/Core/Mail' => array(
54 54
             'writers' => array(
55
-                 array(
56
-                     'name' => 'stream',
55
+                    array(
56
+                        'name' => 'stream',
57 57
                     'priority' => 1000,
58 58
                     'options' => array(
59
-                         'stream' => __DIR__ .'/../../../log/mails.log',
59
+                            'stream' => __DIR__ .'/../../../log/mails.log',
60
+                    ),
60 61
                     ),
61
-                 ),
62 62
             ),
63 63
         ),
64 64
     ),
@@ -289,12 +289,12 @@  discard block
 block discarded – undo
289 289
     ),
290 290
     // Configuration of the controller service manager (Which loads controllers)
291 291
     'controllers' => array(
292
-	    'factories' => [
293
-		    'Core/Index'   => LazyControllerFactory::class,
292
+        'factories' => [
293
+            'Core/Index'   => LazyControllerFactory::class,
294 294
             'Core/Admin'   => AdminControllerFactory::class,
295
-		    'Core/File'    => LazyControllerFactory::class,
295
+            'Core/File'    => LazyControllerFactory::class,
296 296
             'Core/Content' => LazyControllerFactory::class,
297
-	    ],
297
+        ],
298 298
     ),
299 299
     // Configuration of the controller plugin service manager
300 300
     'controller_plugins' => array(
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
             'paginatorservice' => 'Core/PaginatorService',
325 325
             'paginationParams' => 'Core/PaginationParams',
326 326
             'searchform'       => 'Core/SearchForm',
327
-	        'notification'     => 'Notification',
327
+            'notification'     => 'Notification',
328 328
         )
329 329
     ),
330 330
     // Configure the view service manager
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         ),
423 423
         'aliases' => [
424 424
             'snippet' => \Core\View\Helper\Snippet::class,
425
-	        'ajaxUrl' => \Core\View\Helper\AjaxUrl::class,
425
+            'ajaxUrl' => \Core\View\Helper\AjaxUrl::class,
426 426
             'proxy' => \Core\View\Helper\Proxy::class,
427 427
             'form_element' => 'formElement',
428 428
         ],
@@ -520,17 +520,17 @@  discard block
 block discarded – undo
520 520
         ],
521 521
 
522 522
         'Core/Ajax/Events' => [
523
-	        'service' => 'Core/EventManager',
524
-	        'event'   => \Core\Listener\Events\AjaxEvent::class,
523
+            'service' => 'Core/EventManager',
524
+            'event'   => \Core\Listener\Events\AjaxEvent::class,
525 525
         ],
526 526
 	    
527
-	    'Core/File/Events' => [
528
-		    'service' => 'Core/EventManager',
529
-		    'event' => \Core\Listener\Events\FileEvent::class,
527
+        'Core/File/Events' => [
528
+            'service' => 'Core/EventManager',
529
+            'event' => \Core\Listener\Events\FileEvent::class,
530 530
             'listeners' => [
531 531
                 \Core\Listener\DeleteImageSetListener::class => [\Core\Listener\Events\FileEvent::EVENT_DELETE, -1000],
532 532
             ],
533
-	    ]
533
+        ]
534 534
     ],
535 535
     
536 536
 );
Please login to merge, or discard this patch.
module/Behat/src/JobContext.php 1 patch
Indentation   +230 added lines, -230 removed lines patch added patch discarded remove patch
@@ -34,188 +34,188 @@  discard block
 block discarded – undo
34 34
  */
35 35
 class JobContext implements Context
36 36
 {
37
-	use CommonContextTrait;
37
+    use CommonContextTrait;
38 38
 	
39
-	/**
40
-	 * @var Select2Context
41
-	 */
42
-	private $select2Context;
39
+    /**
40
+     * @var Select2Context
41
+     */
42
+    private $select2Context;
43 43
 	
44
-	/**
45
-	 * @var Job
46
-	 */
47
-	private $currentJob;
44
+    /**
45
+     * @var Job
46
+     */
47
+    private $currentJob;
48 48
 	
49
-	/**
50
-	 * @var JobRepository
51
-	 */
52
-	static private $jobRepo;
49
+    /**
50
+     * @var JobRepository
51
+     */
52
+    static private $jobRepo;
53 53
 	
54
-	/**
55
-	 * @param User $user
56
-	 */
57
-	static public function removeJobByUser(User $user)
58
-	{
59
-		$repo = static::$jobRepo;
60
-		$results = $repo->findBy(['user' => $user]);
61
-		foreach($results as $result){
62
-			$repo->remove($result,true);
63
-		}
64
-	}
54
+    /**
55
+     * @param User $user
56
+     */
57
+    static public function removeJobByUser(User $user)
58
+    {
59
+        $repo = static::$jobRepo;
60
+        $results = $repo->findBy(['user' => $user]);
61
+        foreach($results as $result){
62
+            $repo->remove($result,true);
63
+        }
64
+    }
65 65
 	
66
-	/**
67
-	 * @BeforeScenario
68
-	 *
69
-	 * @param BeforeScenarioScope $scope
70
-	 */
71
-	public function beforeScenario(BeforeScenarioScope $scope)
72
-	{
73
-		$this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class);
74
-		if(is_null(static::$jobRepo)){
75
-			$this->gatherContexts($scope);
76
-			static::$jobRepo = $this->getJobRepository();
77
-		}
78
-	}
66
+    /**
67
+     * @BeforeScenario
68
+     *
69
+     * @param BeforeScenarioScope $scope
70
+     */
71
+    public function beforeScenario(BeforeScenarioScope $scope)
72
+    {
73
+        $this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class);
74
+        if(is_null(static::$jobRepo)){
75
+            $this->gatherContexts($scope);
76
+            static::$jobRepo = $this->getJobRepository();
77
+        }
78
+    }
79 79
 	
80
-	/**
81
-	 * @Given I go to job board page
82
-	 */
83
-	public function iGoToJobBoardPage()
84
-	{
85
-		$this->visit('/jobboard');
86
-	}
80
+    /**
81
+     * @Given I go to job board page
82
+     */
83
+    public function iGoToJobBoardPage()
84
+    {
85
+        $this->visit('/jobboard');
86
+    }
87 87
 	
88
-	/**
89
-	 * @Given I go to create job page
90
-	 */
91
-	public function iGoToCreateJob()
92
-	{
93
-	    $url = $this->buildUrl('lang/jobs/manage',['action' => 'edit']);
94
-		$this->visit($url);
95
-	}
88
+    /**
89
+     * @Given I go to create job page
90
+     */
91
+    public function iGoToCreateJob()
92
+    {
93
+        $url = $this->buildUrl('lang/jobs/manage',['action' => 'edit']);
94
+        $this->visit($url);
95
+    }
96 96
 	
97
-	/**
98
-	 * @Given I go to job overview page
99
-	 */
100
-	public function iGoToJobOverviewPage()
101
-	{
102
-		$this->visit('/jobs');
103
-	}
97
+    /**
98
+     * @Given I go to job overview page
99
+     */
100
+    public function iGoToJobOverviewPage()
101
+    {
102
+        $this->visit('/jobs');
103
+    }
104 104
 	
105
-	/**
106
-	 * @Given I go to edit job draft with title :jobTitle
107
-	 * @param $jobTitle
108
-	 * @throws \Exception when job is not found
109
-	 */
110
-	public function iGoToEditJobWithTitle($jobTitle)
111
-	{
112
-		$job = $this->getJobRepository()->findOneBy(['title' => $jobTitle]);
113
-		if(!$job instanceof Job){
114
-			throw new \Exception(sprintf('Job with title "%s" is not found',$jobTitle));
115
-		}
116
-		$this->currentJob = $job;
117
-		$url = $this->buildUrl('lang/jobs/manage',[
118
-		    'id' => $job->getId()
105
+    /**
106
+     * @Given I go to edit job draft with title :jobTitle
107
+     * @param $jobTitle
108
+     * @throws \Exception when job is not found
109
+     */
110
+    public function iGoToEditJobWithTitle($jobTitle)
111
+    {
112
+        $job = $this->getJobRepository()->findOneBy(['title' => $jobTitle]);
113
+        if(!$job instanceof Job){
114
+            throw new \Exception(sprintf('Job with title "%s" is not found',$jobTitle));
115
+        }
116
+        $this->currentJob = $job;
117
+        $url = $this->buildUrl('lang/jobs/manage',[
118
+            'id' => $job->getId()
119 119
         ]);
120
-		$this->visit($url);
121
-	}
120
+        $this->visit($url);
121
+    }
122 122
 	
123
-	/**
124
-	 * @Given I don't have any classification data
125
-	 */
126
-	public function iDonTHaveAnyClassificationData()
127
-	{
128
-		$this->currentJob->setClassifications(new Classifications());
129
-		$this->getJobRepository()->store($this->currentJob);
130
-	}
123
+    /**
124
+     * @Given I don't have any classification data
125
+     */
126
+    public function iDonTHaveAnyClassificationData()
127
+    {
128
+        $this->currentJob->setClassifications(new Classifications());
129
+        $this->getJobRepository()->store($this->currentJob);
130
+    }
131 131
 	
132
-	/**
133
-	 * @When I don't have any posted job
134
-	 */
135
-	public function iDonTHaveAnyPostedJob()
136
-	{
137
-		/* @var $jobRepository JobRepository */
138
-		/* @var $job Job */
139
-		$user = $this->getUserContext()->getCurrentUser();
132
+    /**
133
+     * @When I don't have any posted job
134
+     */
135
+    public function iDonTHaveAnyPostedJob()
136
+    {
137
+        /* @var $jobRepository JobRepository */
138
+        /* @var $job Job */
139
+        $user = $this->getUserContext()->getCurrentUser();
140 140
 
141
-		$jobRepository = $this->getJobRepository();
142
-		$results = $jobRepository->getUserJobs($user->getId());
143
-		foreach($results as $job){
144
-			$jobRepository->remove($job,true);
145
-		}
146
-		$this->currentJob = null;
147
-	}
141
+        $jobRepository = $this->getJobRepository();
142
+        $results = $jobRepository->getUserJobs($user->getId());
143
+        foreach($results as $job){
144
+            $jobRepository->remove($job,true);
145
+        }
146
+        $this->currentJob = null;
147
+    }
148 148
 	
149
-	/**
150
-	 * @When I fill job location search with :search and choose :choice
151
-	 *
152
-	 */
153
-	public function iFillJobLocationAndChoose($search,$choice)
154
-	{
155
-		$select2 = $this->select2Context;
156
-		$select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice);
157
-	}
149
+    /**
150
+     * @When I fill job location search with :search and choose :choice
151
+     *
152
+     */
153
+    public function iFillJobLocationAndChoose($search,$choice)
154
+    {
155
+        $select2 = $this->select2Context;
156
+        $select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice);
157
+    }
158 158
 	
159
-	/**
160
-	 * @When I choose :value from :field
161
-	 */
162
-	public function iJobClassificationSelect($value,$field)
163
-	{
164
-		$field = Inflector::camelize($field);
159
+    /**
160
+     * @When I choose :value from :field
161
+     */
162
+    public function iJobClassificationSelect($value,$field)
163
+    {
164
+        $field = Inflector::camelize($field);
165 165
 		
166
-		$mapSelect2 = [
167
-			'professions' => '#classifications-professions-span .select2-container',
168
-			'industries'  => '#classifications-industries-span .select2-container',
169
-			'employmentTypes' => '#classifications-employmentTypes-span .select2-container',
170
-		];
166
+        $mapSelect2 = [
167
+            'professions' => '#classifications-professions-span .select2-container',
168
+            'industries'  => '#classifications-industries-span .select2-container',
169
+            'employmentTypes' => '#classifications-employmentTypes-span .select2-container',
170
+        ];
171 171
 		
172
-		$mapMultiple = [
173
-			'professions'       => "select#classifications-professions",
174
-			'industries'        => "select#classifications-industries",
175
-			'employmentTypes'    => "select#classifications-employmentTypes",
176
-		];
172
+        $mapMultiple = [
173
+            'professions'       => "select#classifications-professions",
174
+            'industries'        => "select#classifications-industries",
175
+            'employmentTypes'    => "select#classifications-employmentTypes",
176
+        ];
177 177
 		
178
-		if(!isset($mapSelect2[$field])){
179
-			throw new \Exception('Undefined field selection value "'.$field.'"');
180
-		}
178
+        if(!isset($mapSelect2[$field])){
179
+            throw new \Exception('Undefined field selection value "'.$field.'"');
180
+        }
181 181
 		
182
-		$multipleField = $mapMultiple[$field];
183
-		$page = $this->minkContext->getSession()->getPage();
184
-		$element = $page->find('css',$mapMultiple[$field]);
185
-		if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){
186
-			$this->minkContext->selectOption($value,$multipleField);
187
-		}else{
188
-			$locator = $mapSelect2[$field];
189
-			$this->select2Context->iFillInSelect2Field($locator,$value);
190
-		}
191
-	}
182
+        $multipleField = $mapMultiple[$field];
183
+        $page = $this->minkContext->getSession()->getPage();
184
+        $element = $page->find('css',$mapMultiple[$field]);
185
+        if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){
186
+            $this->minkContext->selectOption($value,$multipleField);
187
+        }else{
188
+            $locator = $mapSelect2[$field];
189
+            $this->select2Context->iFillInSelect2Field($locator,$value);
190
+        }
191
+    }
192 192
 	
193
-	/**
194
-	 * @return JobRepository
195
-	 */
196
-	public function getJobRepository()
197
-	{
198
-		return $this->getRepository('Jobs/Job');
199
-	}
193
+    /**
194
+     * @return JobRepository
195
+     */
196
+    public function getJobRepository()
197
+    {
198
+        return $this->getRepository('Jobs/Job');
199
+    }
200 200
 	
201
-	/**
202
-	 * @return CategoriesRepo
203
-	 */
204
-	public function getCategoriesRepository()
205
-	{
206
-		return $this->getRepository('Jobs/Category');
207
-	}
201
+    /**
202
+     * @return CategoriesRepo
203
+     */
204
+    public function getCategoriesRepository()
205
+    {
206
+        return $this->getRepository('Jobs/Category');
207
+    }
208 208
 	
209
-	/**
210
-	 * @When I have a :status job with the following:
211
-	 * @param TableNode $fields
212
-	 */
213
-	public function iHaveAJobWithTheFollowing($status,TableNode $fields)
214
-	{
215
-		$this->buildJob($status,$fields->getRowsHash());
216
-	}
209
+    /**
210
+     * @When I have a :status job with the following:
211
+     * @param TableNode $fields
212
+     */
213
+    public function iHaveAJobWithTheFollowing($status,TableNode $fields)
214
+    {
215
+        $this->buildJob($status,$fields->getRowsHash());
216
+    }
217 217
 
218
-	public function buildJob($status, $definitions,$organization = null)
218
+    public function buildJob($status, $definitions,$organization = null)
219 219
     {
220 220
         $normalizedField = [
221 221
             'template' => 'modern',
@@ -284,84 +284,84 @@  discard block
 block discarded – undo
284 284
     }
285 285
 
286 286
 	
287
-	private function setLocation(Job $job, $term)
288
-	{
289
-		/* @var $client Photon */
290
-		$client = $this->coreContext->getServiceManager()->get('Geo/Client');
291
-		$result = $client->queryOne($term);
292
-		$location = new Location();
293
-		$serialized = Json::encode($result);
294
-		$location->fromString($serialized);
287
+    private function setLocation(Job $job, $term)
288
+    {
289
+        /* @var $client Photon */
290
+        $client = $this->coreContext->getServiceManager()->get('Geo/Client');
291
+        $result = $client->queryOne($term);
292
+        $location = new Location();
293
+        $serialized = Json::encode($result);
294
+        $location->fromString($serialized);
295 295
 		
296
-		$locations = $job->getLocations();
297
-		if(count($locations)){
298
-			$locations->clear();
299
-		}
300
-		$job->getLocations()->add($location);
301
-	}
296
+        $locations = $job->getLocations();
297
+        if(count($locations)){
298
+            $locations->clear();
299
+        }
300
+        $job->getLocations()->add($location);
301
+    }
302 302
 	
303
-	private function addProfessions(Job &$job,$terms)
304
-	{
305
-		$professions = $this->getCategories($terms);
306
-		foreach($professions as $profession){
307
-			$values = $job->getClassifications()->getProfessions()->getValues();
308
-			if(!is_array($values) || !in_array($profession,$values)){
309
-				$job->getClassifications()->getProfessions()->getItems()->add($profession);
310
-			}
311
-		}
312
-	}
303
+    private function addProfessions(Job &$job,$terms)
304
+    {
305
+        $professions = $this->getCategories($terms);
306
+        foreach($professions as $profession){
307
+            $values = $job->getClassifications()->getProfessions()->getValues();
308
+            if(!is_array($values) || !in_array($profession,$values)){
309
+                $job->getClassifications()->getProfessions()->getItems()->add($profession);
310
+            }
311
+        }
312
+    }
313 313
 	
314
-	private function addIndustries(Job &$job, $terms)
315
-	{
316
-		$industries = $this->getCategories($terms);
317
-		foreach($industries as $industry){
318
-			$values = $job->getClassifications()->getIndustries()->getValues();
319
-			if(!is_array($values) || !in_array($industry,$values)){
320
-				$job->getClassifications()->getIndustries()->getItems()->add($industry);
321
-			}
322
-		}
323
-	}
314
+    private function addIndustries(Job &$job, $terms)
315
+    {
316
+        $industries = $this->getCategories($terms);
317
+        foreach($industries as $industry){
318
+            $values = $job->getClassifications()->getIndustries()->getValues();
319
+            if(!is_array($values) || !in_array($industry,$values)){
320
+                $job->getClassifications()->getIndustries()->getItems()->add($industry);
321
+            }
322
+        }
323
+    }
324 324
 	
325
-	/**
326
-	 * @param array $categories
327
-	 *
328
-	 * @return mixed
329
-	 */
330
-	private function getCategories(array $categories)
331
-	{
332
-		$catRepo = $this->getCategoriesRepository();
325
+    /**
326
+     * @param array $categories
327
+     *
328
+     * @return mixed
329
+     */
330
+    private function getCategories(array $categories)
331
+    {
332
+        $catRepo = $this->getCategoriesRepository();
333 333
 		
334
-		// get a professions
335
-		$qb = $catRepo->createQueryBuilder()
336
-		              ->field('name')->in($categories)
337
-		              ->getQuery()
338
-		;
339
-		$results = $qb->execute();
340
-		return $results->toArray();
341
-	}
334
+        // get a professions
335
+        $qb = $catRepo->createQueryBuilder()
336
+                        ->field('name')->in($categories)
337
+                        ->getQuery()
338
+        ;
339
+        $results = $qb->execute();
340
+        return $results->toArray();
341
+    }
342 342
 	
343 343
 	
344
-	/**
345
-	 * @return Job
346
-	 */
347
-	private function getCurrentUserJobDraft($jobTitle)
348
-	{
349
-		$repo = $this->getJobRepository();
350
-		$user = $this->getCurrentUser();
344
+    /**
345
+     * @return Job
346
+     */
347
+    private function getCurrentUserJobDraft($jobTitle)
348
+    {
349
+        $repo = $this->getJobRepository();
350
+        $user = $this->getCurrentUser();
351 351
 		
352
-		$job = $repo->findDraft($user);
352
+        $job = $repo->findDraft($user);
353 353
 		
354
-		if(is_null($job)){
355
-			$job = new Job();
356
-			$job
357
-				->setUser($user)
358
-				->setOrganization($user->getOrganization()->getOrganization())
359
-				->setStatus(StatusInterface::CREATED)
360
-			;
361
-			$job->setIsDraft(true);
362
-		}
363
-		$job->setTitle($jobTitle);
364
-		$repo->store($job);
365
-		return $job;
366
-	}
354
+        if(is_null($job)){
355
+            $job = new Job();
356
+            $job
357
+                ->setUser($user)
358
+                ->setOrganization($user->getOrganization()->getOrganization())
359
+                ->setStatus(StatusInterface::CREATED)
360
+            ;
361
+            $job->setIsDraft(true);
362
+        }
363
+        $job->setTitle($jobTitle);
364
+        $repo->store($job);
365
+        return $job;
366
+    }
367 367
 }
Please login to merge, or discard this patch.
module/Behat/src/UserContext.php 1 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 1 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->buildUrl('lang/organizations/profile');
94
-       $this->visit($url);
93
+        $url = $this->buildUrl('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.