@@ -87,11 +87,11 @@ |
||
87 | 87 | return $sendMail ? $this->send($mail) : $mail; |
88 | 88 | } |
89 | 89 | |
90 | - /** |
|
91 | - * @param ContainerInterface $container |
|
92 | - * |
|
93 | - * @return Mailer |
|
94 | - */ |
|
90 | + /** |
|
91 | + * @param ContainerInterface $container |
|
92 | + * |
|
93 | + * @return Mailer |
|
94 | + */ |
|
95 | 95 | public static function factory(ContainerInterface $container) |
96 | 96 | { |
97 | 97 | return new static($container->get('Core/MailService')); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * |
18 | 18 | * @author Anthonius Munthi <[email protected]> |
19 | 19 | * @ODM\MappedSuperclass |
20 | - */ |
|
20 | + */ |
|
21 | 21 | abstract class AbstractIdentifiableEntity extends AbstractEntity implements IdentifiableEntityInterface |
22 | 22 | { |
23 | 23 | use IdentifiableEntityTrait; |
@@ -26,41 +26,41 @@ |
||
26 | 26 | */ |
27 | 27 | class MailServiceFactory implements FactoryInterface |
28 | 28 | { |
29 | - public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
30 | - { |
|
31 | - $config = $container->get('Config'); |
|
32 | - $mails = isset($config['mails']) ? $config['mails'] : []; |
|
29 | + public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
30 | + { |
|
31 | + $config = $container->get('Config'); |
|
32 | + $mails = isset($config['mails']) ? $config['mails'] : []; |
|
33 | 33 | |
34 | - /* @var \Auth\Options\ModuleOptions $authOptions */ |
|
35 | - $authOptions = $container->get('Auth/Options'); |
|
34 | + /* @var \Auth\Options\ModuleOptions $authOptions */ |
|
35 | + $authOptions = $container->get('Auth/Options'); |
|
36 | 36 | |
37 | - /* @var \Core\Options\MailServiceOptions $mailServiceOptions */ |
|
38 | - $mailServiceOptions = $container->get('Core/MailServiceOptions'); |
|
37 | + /* @var \Core\Options\MailServiceOptions $mailServiceOptions */ |
|
38 | + $mailServiceOptions = $container->get('Core/MailServiceOptions'); |
|
39 | 39 | |
40 | - $configArray = [ |
|
41 | - 'from' => [ |
|
42 | - 'name' => $authOptions->getFromName(), |
|
43 | - 'email' => $authOptions->getFromEmail() |
|
44 | - ], |
|
45 | - ]; |
|
40 | + $configArray = [ |
|
41 | + 'from' => [ |
|
42 | + 'name' => $authOptions->getFromName(), |
|
43 | + 'email' => $authOptions->getFromEmail() |
|
44 | + ], |
|
45 | + ]; |
|
46 | 46 | |
47 | - $configArray['transport'] = $this->getTransport($mailServiceOptions); |
|
48 | - $configArray = array_merge($configArray, $mails); |
|
47 | + $configArray['transport'] = $this->getTransport($mailServiceOptions); |
|
48 | + $configArray = array_merge($configArray, $mails); |
|
49 | 49 | |
50 | - $config = new MailServiceConfig($configArray); |
|
51 | - $service = new MailService($container,$config->toArray()); |
|
52 | - $config->configureServiceManager($service); |
|
53 | - foreach($config->toArray() as $name=>$value){ |
|
54 | - $method = 'set'.$name; |
|
55 | - if(method_exists($service,$method)){ |
|
56 | - call_user_func([$service,$method],$value); |
|
57 | - } |
|
58 | - } |
|
50 | + $config = new MailServiceConfig($configArray); |
|
51 | + $service = new MailService($container,$config->toArray()); |
|
52 | + $config->configureServiceManager($service); |
|
53 | + foreach($config->toArray() as $name=>$value){ |
|
54 | + $method = 'set'.$name; |
|
55 | + if(method_exists($service,$method)){ |
|
56 | + call_user_func([$service,$method],$value); |
|
57 | + } |
|
58 | + } |
|
59 | 59 | |
60 | - return $service; |
|
61 | - } |
|
60 | + return $service; |
|
61 | + } |
|
62 | 62 | |
63 | - public function getTransport(MailServiceOptions $mailServiceOptions) |
|
63 | + public function getTransport(MailServiceOptions $mailServiceOptions) |
|
64 | 64 | { |
65 | 65 | $type = $mailServiceOptions->getTransportClass(); |
66 | 66 | if (MailService::TRANSPORT_SMTP == $type) { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | 'controllers' => [ |
51 | 51 | 'factories' => [ |
52 | - 'Organizations/InviteEmployee' => \Organizations\Factory\Controller\InviteEmployeeControllerFactory::class, |
|
52 | + 'Organizations/InviteEmployee' => \Organizations\Factory\Controller\InviteEmployeeControllerFactory::class, |
|
53 | 53 | 'Organizations/Index' => 'Organizations\Factory\Controller\IndexControllerFactory', |
54 | 54 | 'Organizations/Profile' => 'Organizations\Factory\Controller\ProfileControllerFactory' |
55 | 55 | ] |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | 'view_manager' => [ |
67 | 67 | // Map template to files. Speeds up the lookup through the template stack. |
68 | 68 | 'template_map' => [ |
69 | - 'organizations/index/edit' => __DIR__ . '/../view/organizations/index/form.phtml', |
|
70 | - 'organizations/form/employees-fieldset' => __DIR__ . '/../view/form/employees-fieldset.phtml', |
|
71 | - 'organizations/form/employee-fieldset' => __DIR__ .'/../view/form/employee-fieldset.phtml', |
|
72 | - 'organizations/form/invite-employee-bar' => __DIR__ . '/../view/form/invite-employee-bar.phtml', |
|
73 | - 'organizations/error/no-parent' => __DIR__ . '/../view/error/no-parent.phtml', |
|
74 | - 'organizations/error/invite' => __DIR__ . '/../view/error/invite.phtml', |
|
75 | - 'organizations/mail/invite-employee' => __DIR__ . '/../view/mail/invite-employee.phtml', |
|
76 | - 'organizations/form/workflow-fieldset' => __DIR__ . '/../view/form/workflow-fieldset.phtml', |
|
69 | + 'organizations/index/edit' => __DIR__ . '/../view/organizations/index/form.phtml', |
|
70 | + 'organizations/form/employees-fieldset' => __DIR__ . '/../view/form/employees-fieldset.phtml', |
|
71 | + 'organizations/form/employee-fieldset' => __DIR__ .'/../view/form/employee-fieldset.phtml', |
|
72 | + 'organizations/form/invite-employee-bar' => __DIR__ . '/../view/form/invite-employee-bar.phtml', |
|
73 | + 'organizations/error/no-parent' => __DIR__ . '/../view/error/no-parent.phtml', |
|
74 | + 'organizations/error/invite' => __DIR__ . '/../view/error/invite.phtml', |
|
75 | + 'organizations/mail/invite-employee' => __DIR__ . '/../view/mail/invite-employee.phtml', |
|
76 | + 'organizations/form/workflow-fieldset' => __DIR__ . '/../view/form/workflow-fieldset.phtml', |
|
77 | 77 | ], |
78 | 78 | // Where to look for view templates not mapped above |
79 | 79 | 'template_path_stack' => [ |
@@ -82,24 +82,24 @@ discard block |
||
82 | 82 | ], |
83 | 83 | 'form_elements' => [ |
84 | 84 | 'invokables' => [ |
85 | - 'Organizations/Form' => 'Organizations\Form\Organizations', |
|
86 | - 'Organizations/OrganizationsContactForm' => 'Organizations\Form\OrganizationsContactForm', |
|
87 | - 'Organizations/OrganizationsNameForm' => 'Organizations\Form\OrganizationsNameForm', |
|
88 | - 'Organizations/OrganizationsDescriptionForm' => 'Organizations\Form\OrganizationsDescriptionForm', |
|
89 | - 'Organizations/OrganizationsContactFieldset' => 'Organizations\Form\OrganizationsContactFieldset', |
|
90 | - 'Organizations/OrganizationsDescriptionFieldset' => 'Organizations\Form\OrganizationsDescriptionFieldset', |
|
91 | - //'Organizations/OrganizationFieldset' => 'Organizations\Form\OrganizationFieldset', |
|
92 | - 'Organizations/EmployeesContainer' => 'Organizations\Form\EmployeesContainer', |
|
93 | - 'Organizations/Employees' => 'Organizations\Form\Employees', |
|
94 | - 'Organizations/InviteEmployeeBar' => 'Organizations\Form\Element\InviteEmployeeBar', |
|
95 | - 'Organizations/Employee' => 'Organizations\Form\Element\Employee', |
|
96 | - 'Organizations/WorkflowSettings' => 'Organizations\Form\WorkflowSettings', |
|
97 | - 'Organizations/WorkflowSettingsFieldset' => 'Organizations\Form\WorkflowSettingsFieldset', |
|
98 | - 'Organizations/Profile' => \Organizations\Form\OrganizationsProfileForm::class, |
|
99 | - 'Organizations/ProfileFieldset' => \Organizations\Form\OrganizationsProfileFieldset::class |
|
85 | + 'Organizations/Form' => 'Organizations\Form\Organizations', |
|
86 | + 'Organizations/OrganizationsContactForm' => 'Organizations\Form\OrganizationsContactForm', |
|
87 | + 'Organizations/OrganizationsNameForm' => 'Organizations\Form\OrganizationsNameForm', |
|
88 | + 'Organizations/OrganizationsDescriptionForm' => 'Organizations\Form\OrganizationsDescriptionForm', |
|
89 | + 'Organizations/OrganizationsContactFieldset' => 'Organizations\Form\OrganizationsContactFieldset', |
|
90 | + 'Organizations/OrganizationsDescriptionFieldset' => 'Organizations\Form\OrganizationsDescriptionFieldset', |
|
91 | + //'Organizations/OrganizationFieldset' => 'Organizations\Form\OrganizationFieldset', |
|
92 | + 'Organizations/EmployeesContainer' => 'Organizations\Form\EmployeesContainer', |
|
93 | + 'Organizations/Employees' => 'Organizations\Form\Employees', |
|
94 | + 'Organizations/InviteEmployeeBar' => 'Organizations\Form\Element\InviteEmployeeBar', |
|
95 | + 'Organizations/Employee' => 'Organizations\Form\Element\Employee', |
|
96 | + 'Organizations/WorkflowSettings' => 'Organizations\Form\WorkflowSettings', |
|
97 | + 'Organizations/WorkflowSettingsFieldset' => 'Organizations\Form\WorkflowSettingsFieldset', |
|
98 | + 'Organizations/Profile' => \Organizations\Form\OrganizationsProfileForm::class, |
|
99 | + 'Organizations/ProfileFieldset' => \Organizations\Form\OrganizationsProfileFieldset::class |
|
100 | 100 | ], |
101 | 101 | 'factories' => [ |
102 | - 'Organizations/OrganizationsNameFieldset' => \Organizations\Factory\Form\OrganizationsNameFieldsetFactory::class, |
|
102 | + 'Organizations/OrganizationsNameFieldset' => \Organizations\Factory\Form\OrganizationsNameFieldsetFactory::class, |
|
103 | 103 | 'Organizations/Image' => \Organizations\Form\LogoImageFactory::class, |
104 | 104 | 'Organizations/EmployeesFieldset' => 'Organizations\Factory\Form\EmployeesFieldsetFactory', |
105 | 105 | 'Organizations/EmployeeFieldset' => 'Organizations\Factory\Form\EmployeeFieldsetFactory', |
@@ -207,13 +207,13 @@ discard block |
||
207 | 207 | |
208 | 208 | 'service_manager' => [ |
209 | 209 | 'invokables' => [ |
210 | - 'Organizations\Auth\Dependency\EmployeeListListener' => 'Organizations\Auth\Dependency\EmployeeListListener' |
|
210 | + 'Organizations\Auth\Dependency\EmployeeListListener' => 'Organizations\Auth\Dependency\EmployeeListListener' |
|
211 | 211 | ], |
212 | 212 | 'factories' => [ |
213 | - 'Organizations\Auth\Dependency\ListListener' => 'Organizations\Factory\Auth\Dependency\ListListenerFactory', |
|
214 | - 'Organizations\ImageFileCache\Manager' => 'Organizations\Factory\ImageFileCache\ManagerFactory', |
|
215 | - 'Organizations\ImageFileCache\ODMListener' => 'Organizations\Factory\ImageFileCache\ODMListenerFactory', |
|
216 | - 'Organizations\ImageFileCache\ApplicationListener' => 'Organizations\Factory\ImageFileCache\ApplicationListenerFactory', |
|
213 | + 'Organizations\Auth\Dependency\ListListener' => 'Organizations\Factory\Auth\Dependency\ListListenerFactory', |
|
214 | + 'Organizations\ImageFileCache\Manager' => 'Organizations\Factory\ImageFileCache\ManagerFactory', |
|
215 | + 'Organizations\ImageFileCache\ODMListener' => 'Organizations\Factory\ImageFileCache\ODMListenerFactory', |
|
216 | + 'Organizations\ImageFileCache\ApplicationListener' => 'Organizations\Factory\ImageFileCache\ApplicationListenerFactory', |
|
217 | 217 | ], |
218 | 218 | ], |
219 | 219 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | private $orgRepo; |
37 | 37 | |
38 | - public function __construct( |
|
38 | + public function __construct( |
|
39 | 39 | OrganizationRepository $orgRepo |
40 | 40 | ) |
41 | 41 | { |
@@ -18,43 +18,43 @@ discard block |
||
18 | 18 | |
19 | 19 | trait CommonContextTrait |
20 | 20 | { |
21 | - /** |
|
22 | - * @var MinkContext |
|
23 | - */ |
|
24 | - protected $minkContext; |
|
21 | + /** |
|
22 | + * @var MinkContext |
|
23 | + */ |
|
24 | + protected $minkContext; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var CoreContext |
|
28 | - */ |
|
29 | - protected $coreContext; |
|
26 | + /** |
|
27 | + * @var CoreContext |
|
28 | + */ |
|
29 | + protected $coreContext; |
|
30 | 30 | |
31 | - /** |
|
32 | - * @var UserContext |
|
33 | - */ |
|
34 | - protected $userContext; |
|
31 | + /** |
|
32 | + * @var UserContext |
|
33 | + */ |
|
34 | + protected $userContext; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @var SummaryFormContext |
|
38 | - */ |
|
39 | - protected $summaryFormContext; |
|
36 | + /** |
|
37 | + * @var SummaryFormContext |
|
38 | + */ |
|
39 | + protected $summaryFormContext; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @BeforeScenario |
|
43 | - * |
|
44 | - * @param BeforeScenarioScope $scope |
|
45 | - */ |
|
46 | - final public function gatherContexts(BeforeScenarioScope $scope) |
|
47 | - { |
|
48 | - $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
49 | - $this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class); |
|
50 | - $this->userContext = $scope->getEnvironment()->getContext(UserContext::class); |
|
51 | - $this->summaryFormContext = $scope->getEnvironment()->getContext(SummaryFormContext::class); |
|
52 | - } |
|
41 | + /** |
|
42 | + * @BeforeScenario |
|
43 | + * |
|
44 | + * @param BeforeScenarioScope $scope |
|
45 | + */ |
|
46 | + final public function gatherContexts(BeforeScenarioScope $scope) |
|
47 | + { |
|
48 | + $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
49 | + $this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class); |
|
50 | + $this->userContext = $scope->getEnvironment()->getContext(UserContext::class); |
|
51 | + $this->summaryFormContext = $scope->getEnvironment()->getContext(SummaryFormContext::class); |
|
52 | + } |
|
53 | 53 | |
54 | - public function buildUrl($name, array $params=array(), array $options=array()) |
|
55 | - { |
|
56 | - $defaults = ['lang'=>'en']; |
|
57 | - $params = array_merge($defaults,$params); |
|
54 | + public function buildUrl($name, array $params=array(), array $options=array()) |
|
55 | + { |
|
56 | + $defaults = ['lang'=>'en']; |
|
57 | + $params = array_merge($defaults,$params); |
|
58 | 58 | /* @var Url $urlHelper */ |
59 | 59 | $urlHelper = $this |
60 | 60 | ->getService('ViewHelperManager') |
@@ -63,36 +63,36 @@ discard block |
||
63 | 63 | $url = $urlHelper($name,$params,$options); |
64 | 64 | |
65 | 65 | return $this->coreContext->generateUrl($url); |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | - public function visit($url) |
|
69 | - { |
|
70 | - $this->coreContext->iVisit($url); |
|
71 | - } |
|
68 | + public function visit($url) |
|
69 | + { |
|
70 | + $this->coreContext->iVisit($url); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * @param $id |
|
75 | - * @return mixed|object |
|
76 | - */ |
|
77 | - public function getService($id) |
|
78 | - { |
|
79 | - return $this->coreContext->getServiceManager()->get($id); |
|
80 | - } |
|
73 | + /** |
|
74 | + * @param $id |
|
75 | + * @return mixed|object |
|
76 | + */ |
|
77 | + public function getService($id) |
|
78 | + { |
|
79 | + return $this->coreContext->getServiceManager()->get($id); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @param $id |
|
84 | - * |
|
85 | - * @return RepositoryInterface |
|
86 | - */ |
|
87 | - public function getRepository($id) |
|
88 | - { |
|
89 | - return $this->coreContext->getRepositories()->get($id); |
|
90 | - } |
|
82 | + /** |
|
83 | + * @param $id |
|
84 | + * |
|
85 | + * @return RepositoryInterface |
|
86 | + */ |
|
87 | + public function getRepository($id) |
|
88 | + { |
|
89 | + return $this->coreContext->getRepositories()->get($id); |
|
90 | + } |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * @return UserContext |
94 | 94 | */ |
95 | - public function getUserContext() |
|
95 | + public function getUserContext() |
|
96 | 96 | { |
97 | 97 | return $this->userContext; |
98 | 98 | } |
@@ -25,283 +25,283 @@ |
||
25 | 25 | { |
26 | 26 | use CommonContextTrait; |
27 | 27 | |
28 | - static protected $application; |
|
28 | + static protected $application; |
|
29 | 29 | |
30 | - static private $jobCategoryChecked = false; |
|
30 | + static private $jobCategoryChecked = false; |
|
31 | 31 | |
32 | - /** |
|
33 | - * @BeforeScenario |
|
34 | - * @param BeforeScenarioScope $scope |
|
35 | - */ |
|
36 | - public function setupContexts(BeforeScenarioScope $scope) |
|
37 | - { |
|
38 | - if(false === static::$jobCategoryChecked){ |
|
39 | - /* @var Categories $catRepo */ |
|
40 | - $catRepo = $this->getRepositories()->get('Jobs/Category'); |
|
41 | - $all = $catRepo->findAll(); |
|
42 | - if(count($all) <= 1){ |
|
43 | - $catRepo->createDefaultCategory('professions'); |
|
44 | - $catRepo->createDefaultCategory('industries'); |
|
45 | - $catRepo->createDefaultCategory('employmentTypes'); |
|
46 | - } |
|
47 | - static::$jobCategoryChecked = true; |
|
48 | - } |
|
49 | - } |
|
32 | + /** |
|
33 | + * @BeforeScenario |
|
34 | + * @param BeforeScenarioScope $scope |
|
35 | + */ |
|
36 | + public function setupContexts(BeforeScenarioScope $scope) |
|
37 | + { |
|
38 | + if(false === static::$jobCategoryChecked){ |
|
39 | + /* @var Categories $catRepo */ |
|
40 | + $catRepo = $this->getRepositories()->get('Jobs/Category'); |
|
41 | + $all = $catRepo->findAll(); |
|
42 | + if(count($all) <= 1){ |
|
43 | + $catRepo->createDefaultCategory('professions'); |
|
44 | + $catRepo->createDefaultCategory('industries'); |
|
45 | + $catRepo->createDefaultCategory('employmentTypes'); |
|
46 | + } |
|
47 | + static::$jobCategoryChecked = true; |
|
48 | + } |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * @return Application |
|
53 | - */ |
|
54 | - public function getApplication() |
|
55 | - { |
|
56 | - if(!is_object(static::$application)){ |
|
57 | - $configFile = realpath(__DIR__.'/../../../config/config.php'); |
|
58 | - $config = include($configFile); |
|
59 | - static::$application = Application::init($config); |
|
60 | - } |
|
61 | - return static::$application; |
|
62 | - } |
|
51 | + /** |
|
52 | + * @return Application |
|
53 | + */ |
|
54 | + public function getApplication() |
|
55 | + { |
|
56 | + if(!is_object(static::$application)){ |
|
57 | + $configFile = realpath(__DIR__.'/../../../config/config.php'); |
|
58 | + $config = include($configFile); |
|
59 | + static::$application = Application::init($config); |
|
60 | + } |
|
61 | + return static::$application; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * @return \Zend\ServiceManager\ServiceManager |
|
66 | - */ |
|
67 | - public function getServiceManager() |
|
68 | - { |
|
69 | - return $this->getApplication()->getServiceManager(); |
|
70 | - } |
|
64 | + /** |
|
65 | + * @return \Zend\ServiceManager\ServiceManager |
|
66 | + */ |
|
67 | + public function getServiceManager() |
|
68 | + { |
|
69 | + return $this->getApplication()->getServiceManager(); |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * @return \Zend\EventManager\EventManagerInterface |
|
74 | - */ |
|
75 | - public function getEventManager() |
|
76 | - { |
|
77 | - return $this->getApplication()->getEventManager(); |
|
78 | - } |
|
72 | + /** |
|
73 | + * @return \Zend\EventManager\EventManagerInterface |
|
74 | + */ |
|
75 | + public function getEventManager() |
|
76 | + { |
|
77 | + return $this->getApplication()->getEventManager(); |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * @return RepositoryService |
|
82 | - */ |
|
83 | - public function getRepositories() |
|
84 | - { |
|
85 | - return $this->getServiceManager()->get('repositories'); |
|
86 | - } |
|
80 | + /** |
|
81 | + * @return RepositoryService |
|
82 | + */ |
|
83 | + public function getRepositories() |
|
84 | + { |
|
85 | + return $this->getServiceManager()->get('repositories'); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * @param $name |
|
90 | - * @param array $params |
|
91 | - * |
|
92 | - * @return string |
|
93 | - */ |
|
94 | - public function generateUrl($name) |
|
95 | - { |
|
96 | - return $this->minkContext->locatePath($name); |
|
97 | - } |
|
88 | + /** |
|
89 | + * @param $name |
|
90 | + * @param array $params |
|
91 | + * |
|
92 | + * @return string |
|
93 | + */ |
|
94 | + public function generateUrl($name) |
|
95 | + { |
|
96 | + return $this->minkContext->locatePath($name); |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * @When /^I hover over the element "([^"]*)"$/ |
|
101 | - */ |
|
102 | - public function iHoverOverTheElement($locator) |
|
103 | - { |
|
104 | - $session = $this->minkContext->getSession(); // get the mink session |
|
105 | - $element = $session->getPage()->find('css', $locator); // runs the actual query and returns the element |
|
99 | + /** |
|
100 | + * @When /^I hover over the element "([^"]*)"$/ |
|
101 | + */ |
|
102 | + public function iHoverOverTheElement($locator) |
|
103 | + { |
|
104 | + $session = $this->minkContext->getSession(); // get the mink session |
|
105 | + $element = $session->getPage()->find('css', $locator); // runs the actual query and returns the element |
|
106 | 106 | |
107 | - // errors must not pass silently |
|
108 | - if (null === $element) { |
|
109 | - throw new \InvalidArgumentException(sprintf('Could not evaluate CSS selector: "%s"', $locator)); |
|
110 | - } |
|
107 | + // errors must not pass silently |
|
108 | + if (null === $element) { |
|
109 | + throw new \InvalidArgumentException(sprintf('Could not evaluate CSS selector: "%s"', $locator)); |
|
110 | + } |
|
111 | 111 | |
112 | - // ok, let's hover it |
|
113 | - $element->mouseOver(); |
|
114 | - } |
|
112 | + // ok, let's hover it |
|
113 | + $element->mouseOver(); |
|
114 | + } |
|
115 | 115 | |
116 | - /** |
|
117 | - * @Given /^I wait for (\d+) seconds$/ |
|
118 | - */ |
|
119 | - public function iWaitForSecond($second) |
|
120 | - { |
|
121 | - sleep($second); |
|
122 | - } |
|
116 | + /** |
|
117 | + * @Given /^I wait for (\d+) seconds$/ |
|
118 | + */ |
|
119 | + public function iWaitForSecond($second) |
|
120 | + { |
|
121 | + sleep($second); |
|
122 | + } |
|
123 | 123 | |
124 | - /** |
|
125 | - * @Then /^I wait for the ajax response$/ |
|
126 | - */ |
|
127 | - public function iWaitForTheAjaxResponse() |
|
128 | - { |
|
129 | - $this->getSession()->wait(5000, '(0 === jQuery.active)'); |
|
130 | - } |
|
124 | + /** |
|
125 | + * @Then /^I wait for the ajax response$/ |
|
126 | + */ |
|
127 | + public function iWaitForTheAjaxResponse() |
|
128 | + { |
|
129 | + $this->getSession()->wait(5000, '(0 === jQuery.active)'); |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * Some forms do not have a Submit button just pass the ID |
|
134 | - * |
|
135 | - * @Given /^I submit the form with id "([^"]*)"$/ |
|
136 | - */ |
|
137 | - public function iSubmitTheFormWithId($arg) |
|
138 | - { |
|
139 | - $node = $this->minkContext->getSession()->getPage()->find('css', $arg); |
|
140 | - if($node) { |
|
141 | - $this->minkContext->getSession()->executeScript("jQuery('$arg').submit();"); |
|
142 | - } else { |
|
143 | - throw new \Exception('Element not found'); |
|
144 | - } |
|
145 | - } |
|
132 | + /** |
|
133 | + * Some forms do not have a Submit button just pass the ID |
|
134 | + * |
|
135 | + * @Given /^I submit the form with id "([^"]*)"$/ |
|
136 | + */ |
|
137 | + public function iSubmitTheFormWithId($arg) |
|
138 | + { |
|
139 | + $node = $this->minkContext->getSession()->getPage()->find('css', $arg); |
|
140 | + if($node) { |
|
141 | + $this->minkContext->getSession()->executeScript("jQuery('$arg').submit();"); |
|
142 | + } else { |
|
143 | + throw new \Exception('Element not found'); |
|
144 | + } |
|
145 | + } |
|
146 | 146 | |
147 | - /** |
|
148 | - * @Then I switch to popup :name |
|
149 | - * |
|
150 | - * @param $name |
|
151 | - */ |
|
152 | - public function iSwitchToPopup($name) |
|
153 | - { |
|
154 | - $this->iSetMainWindowName(); |
|
155 | - $this->getSession()->switchToWindow($name); |
|
156 | - } |
|
147 | + /** |
|
148 | + * @Then I switch to popup :name |
|
149 | + * |
|
150 | + * @param $name |
|
151 | + */ |
|
152 | + public function iSwitchToPopup($name) |
|
153 | + { |
|
154 | + $this->iSetMainWindowName(); |
|
155 | + $this->getSession()->switchToWindow($name); |
|
156 | + } |
|
157 | 157 | |
158 | - /** |
|
159 | - * @Then I set main window name |
|
160 | - */ |
|
161 | - public function iSetMainWindowName() |
|
162 | - { |
|
163 | - $window_name = 'main_window'; |
|
164 | - $script = 'window.name = "' . $window_name . '"'; |
|
165 | - $this->getSession()->executeScript($script); |
|
166 | - } |
|
158 | + /** |
|
159 | + * @Then I set main window name |
|
160 | + */ |
|
161 | + public function iSetMainWindowName() |
|
162 | + { |
|
163 | + $window_name = 'main_window'; |
|
164 | + $script = 'window.name = "' . $window_name . '"'; |
|
165 | + $this->getSession()->executeScript($script); |
|
166 | + } |
|
167 | 167 | |
168 | - /** |
|
169 | - * @Then I switch back to main window |
|
170 | - */ |
|
171 | - public function iSwitchBackToMainWindow() |
|
172 | - { |
|
173 | - $this->getSession()->switchToWindow('main_window'); |
|
174 | - } |
|
168 | + /** |
|
169 | + * @Then I switch back to main window |
|
170 | + */ |
|
171 | + public function iSwitchBackToMainWindow() |
|
172 | + { |
|
173 | + $this->getSession()->switchToWindow('main_window'); |
|
174 | + } |
|
175 | 175 | |
176 | - public function iVisit($url) |
|
177 | - { |
|
178 | - $this->minkContext->getSession()->visit($url); |
|
179 | - } |
|
176 | + public function iVisit($url) |
|
177 | + { |
|
178 | + $this->minkContext->getSession()->visit($url); |
|
179 | + } |
|
180 | 180 | |
181 | - /** |
|
182 | - * @When I scroll :selector into view |
|
183 | - * |
|
184 | - * @param string $selector Allowed selectors: #id, .className, //xpath |
|
185 | - * |
|
186 | - * @throws \Exception |
|
187 | - */ |
|
188 | - public function scrollIntoView($selector) |
|
189 | - { |
|
190 | - $locator = substr($selector, 0, 1); |
|
181 | + /** |
|
182 | + * @When I scroll :selector into view |
|
183 | + * |
|
184 | + * @param string $selector Allowed selectors: #id, .className, //xpath |
|
185 | + * |
|
186 | + * @throws \Exception |
|
187 | + */ |
|
188 | + public function scrollIntoView($selector) |
|
189 | + { |
|
190 | + $locator = substr($selector, 0, 1); |
|
191 | 191 | |
192 | - switch ($locator) { |
|
193 | - case '/' : // XPath selector |
|
194 | - $function = <<<JS |
|
192 | + switch ($locator) { |
|
193 | + case '/' : // XPath selector |
|
194 | + $function = <<<JS |
|
195 | 195 | (function(){ |
196 | 196 | var elem = document.evaluate($selector, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; |
197 | 197 | elem.scrollIntoView(false); |
198 | 198 | })() |
199 | 199 | JS; |
200 | - break; |
|
200 | + break; |
|
201 | 201 | |
202 | - case '#' : // ID selector |
|
203 | - $selector = substr($selector, 1); |
|
204 | - $function = <<<JS |
|
202 | + case '#' : // ID selector |
|
203 | + $selector = substr($selector, 1); |
|
204 | + $function = <<<JS |
|
205 | 205 | (function(){ |
206 | 206 | var elem = document.getElementById("$selector"); |
207 | 207 | elem.scrollIntoView(false); |
208 | 208 | })() |
209 | 209 | JS; |
210 | - break; |
|
210 | + break; |
|
211 | 211 | |
212 | - case '.' : // Class selector |
|
213 | - $selector = substr($selector, 1); |
|
214 | - $function = <<<JS |
|
212 | + case '.' : // Class selector |
|
213 | + $selector = substr($selector, 1); |
|
214 | + $function = <<<JS |
|
215 | 215 | (function(){ |
216 | 216 | var elem = document.getElementsByClassName("$selector"); |
217 | 217 | elem[0].scrollIntoView(false); |
218 | 218 | })() |
219 | 219 | JS; |
220 | - break; |
|
220 | + break; |
|
221 | 221 | |
222 | - default: |
|
223 | - throw new \Exception(__METHOD__ . ' Couldn\'t find selector: ' . $selector . ' - Allowed selectors: #id, .className, //xpath'); |
|
224 | - break; |
|
225 | - } |
|
222 | + default: |
|
223 | + throw new \Exception(__METHOD__ . ' Couldn\'t find selector: ' . $selector . ' - Allowed selectors: #id, .className, //xpath'); |
|
224 | + break; |
|
225 | + } |
|
226 | 226 | |
227 | - try { |
|
228 | - $this->getSession()->executeScript($function); |
|
229 | - } catch (\Exception $e) { |
|
230 | - throw new \Exception(__METHOD__ . ' failed'. ' Message: for this locator:"'.$selector.'"'); |
|
231 | - } |
|
232 | - } |
|
227 | + try { |
|
228 | + $this->getSession()->executeScript($function); |
|
229 | + } catch (\Exception $e) { |
|
230 | + throw new \Exception(__METHOD__ . ' failed'. ' Message: for this locator:"'.$selector.'"'); |
|
231 | + } |
|
232 | + } |
|
233 | 233 | |
234 | - /** |
|
235 | - * @When I click location selector |
|
236 | - */ |
|
237 | - public function iClickLocationSelector() |
|
238 | - { |
|
239 | - $locator = '#jobBase-geoLocation-span .select2'; |
|
240 | - $element = $this->getElement($locator); |
|
241 | - $element->click(); |
|
242 | - } |
|
234 | + /** |
|
235 | + * @When I click location selector |
|
236 | + */ |
|
237 | + public function iClickLocationSelector() |
|
238 | + { |
|
239 | + $locator = '#jobBase-geoLocation-span .select2'; |
|
240 | + $element = $this->getElement($locator); |
|
241 | + $element->click(); |
|
242 | + } |
|
243 | 243 | |
244 | - /** |
|
245 | - * @param $locator |
|
246 | - * @param string $selector |
|
247 | - * |
|
248 | - * @return \Behat\Mink\Element\NodeElement|mixed|null |
|
249 | - */ |
|
250 | - public function getElement($locator,$selector='css') |
|
251 | - { |
|
252 | - $page = $this->minkContext->getSession()->getPage(); |
|
253 | - $element = $page->find('css',$locator); |
|
254 | - return $element; |
|
255 | - } |
|
244 | + /** |
|
245 | + * @param $locator |
|
246 | + * @param string $selector |
|
247 | + * |
|
248 | + * @return \Behat\Mink\Element\NodeElement|mixed|null |
|
249 | + */ |
|
250 | + public function getElement($locator,$selector='css') |
|
251 | + { |
|
252 | + $page = $this->minkContext->getSession()->getPage(); |
|
253 | + $element = $page->find('css',$locator); |
|
254 | + return $element; |
|
255 | + } |
|
256 | 256 | |
257 | - /** |
|
258 | - * @When I fill in location search with :term |
|
259 | - * @param $term |
|
260 | - */ |
|
261 | - public function iFillInLocationSearch($term) |
|
262 | - { |
|
263 | - $locator = '.select2-container--open .select2-search__field'; |
|
264 | - $element = $this->getElement($locator); |
|
265 | - $element->focus(); |
|
266 | - $element->setValue($term); |
|
267 | - $this->iWaitForTheAjaxResponse(); |
|
268 | - } |
|
257 | + /** |
|
258 | + * @When I fill in location search with :term |
|
259 | + * @param $term |
|
260 | + */ |
|
261 | + public function iFillInLocationSearch($term) |
|
262 | + { |
|
263 | + $locator = '.select2-container--open .select2-search__field'; |
|
264 | + $element = $this->getElement($locator); |
|
265 | + $element->focus(); |
|
266 | + $element->setValue($term); |
|
267 | + $this->iWaitForTheAjaxResponse(); |
|
268 | + } |
|
269 | 269 | |
270 | - public function iClickOn() |
|
271 | - { |
|
270 | + public function iClickOn() |
|
271 | + { |
|
272 | 272 | |
273 | - } |
|
273 | + } |
|
274 | 274 | |
275 | - /** |
|
276 | - * Click some text |
|
277 | - * |
|
278 | - * @When /^I click on the text "([^"]*)"$/ |
|
279 | - */ |
|
280 | - public function iClickOnTheText($text) |
|
281 | - { |
|
282 | - $session = $this->getSession(); |
|
283 | - $element = $session->getPage()->find( |
|
284 | - 'xpath', |
|
285 | - $session->getSelectorsHandler()->selectorToXpath('xpath', '*//*[text()="'. $text .'"]') |
|
286 | - ); |
|
287 | - if(null === $element){ |
|
288 | - $element = $session->getPage()->find( |
|
289 | - 'named', |
|
290 | - array('id',$text) |
|
291 | - ); |
|
292 | - } |
|
293 | - if (null === $element) { |
|
294 | - throw new \InvalidArgumentException(sprintf('Cannot find text: "%s"', $text)); |
|
295 | - } |
|
275 | + /** |
|
276 | + * Click some text |
|
277 | + * |
|
278 | + * @When /^I click on the text "([^"]*)"$/ |
|
279 | + */ |
|
280 | + public function iClickOnTheText($text) |
|
281 | + { |
|
282 | + $session = $this->getSession(); |
|
283 | + $element = $session->getPage()->find( |
|
284 | + 'xpath', |
|
285 | + $session->getSelectorsHandler()->selectorToXpath('xpath', '*//*[text()="'. $text .'"]') |
|
286 | + ); |
|
287 | + if(null === $element){ |
|
288 | + $element = $session->getPage()->find( |
|
289 | + 'named', |
|
290 | + array('id',$text) |
|
291 | + ); |
|
292 | + } |
|
293 | + if (null === $element) { |
|
294 | + throw new \InvalidArgumentException(sprintf('Cannot find text: "%s"', $text)); |
|
295 | + } |
|
296 | 296 | |
297 | - $element->click(); |
|
297 | + $element->click(); |
|
298 | 298 | |
299 | - } |
|
299 | + } |
|
300 | 300 | |
301 | 301 | /** |
302 | 302 | * @Then /^(?:|I )should see translated text "(?P<text>(?:[^"]|\\")*)"$/ |
303 | 303 | */ |
304 | - public function iShouldSeeText($text) |
|
304 | + public function iShouldSeeText($text) |
|
305 | 305 | { |
306 | 306 | $translator = $this->getServiceManager()->get('translator'); |
307 | 307 | $translated = $translator->translate($text); |
@@ -14,26 +14,26 @@ |
||
14 | 14 | |
15 | 15 | class SettingsContext implements Context |
16 | 16 | { |
17 | - use CommonContextTrait; |
|
17 | + use CommonContextTrait; |
|
18 | 18 | |
19 | - /** |
|
20 | - * @Given I go to settings page |
|
21 | - */ |
|
22 | - public function iGoToSettingsPage() |
|
23 | - { |
|
24 | - //$this->visit('/settings'); |
|
19 | + /** |
|
20 | + * @Given I go to settings page |
|
21 | + */ |
|
22 | + public function iGoToSettingsPage() |
|
23 | + { |
|
24 | + //$this->visit('/settings'); |
|
25 | 25 | $url = $this->buildUrl('lang/settings'); |
26 | 26 | $this->visit($url); |
27 | - } |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * @Given I go to email template settings page |
|
31 | - */ |
|
32 | - public function iGoToEmailTemplatePage() |
|
33 | - { |
|
34 | - $url = $this->buildUrl('lang/settings',[ |
|
35 | - 'module' => 'Applications' |
|
29 | + /** |
|
30 | + * @Given I go to email template settings page |
|
31 | + */ |
|
32 | + public function iGoToEmailTemplatePage() |
|
33 | + { |
|
34 | + $url = $this->buildUrl('lang/settings',[ |
|
35 | + 'module' => 'Applications' |
|
36 | 36 | ]); |
37 | - $this->visit($url); |
|
38 | - } |
|
37 | + $this->visit($url); |
|
38 | + } |
|
39 | 39 | } |
@@ -22,37 +22,37 @@ |
||
22 | 22 | */ |
23 | 23 | class ApplicationContext implements Context |
24 | 24 | { |
25 | - use CommonContextTrait; |
|
25 | + use CommonContextTrait; |
|
26 | 26 | |
27 | - /** |
|
28 | - * @Given I apply for :title job |
|
29 | - * |
|
30 | - * @param string $title |
|
31 | - * @throws \Exception when the titled job not exists |
|
32 | - */ |
|
33 | - public function iApplyAJob($title) |
|
34 | - { |
|
35 | - /* @var $repo JobRepository */ |
|
36 | - $repo = $this->getRepository('Jobs/Job'); |
|
37 | - $job = $repo->findOneBy(['title' => $title]); |
|
38 | - if(!$job instanceof Job){ |
|
39 | - throw new \Exception('There is no job titled: "'.$title.'"'); |
|
40 | - } |
|
41 | - $job->setApplyId($job->getId()); |
|
42 | - $repo->store($job); |
|
27 | + /** |
|
28 | + * @Given I apply for :title job |
|
29 | + * |
|
30 | + * @param string $title |
|
31 | + * @throws \Exception when the titled job not exists |
|
32 | + */ |
|
33 | + public function iApplyAJob($title) |
|
34 | + { |
|
35 | + /* @var $repo JobRepository */ |
|
36 | + $repo = $this->getRepository('Jobs/Job'); |
|
37 | + $job = $repo->findOneBy(['title' => $title]); |
|
38 | + if(!$job instanceof Job){ |
|
39 | + throw new \Exception('There is no job titled: "'.$title.'"'); |
|
40 | + } |
|
41 | + $job->setApplyId($job->getId()); |
|
42 | + $repo->store($job); |
|
43 | 43 | |
44 | - $url = $this->buildUrl('lang/apply',[ |
|
45 | - 'applyId' => $job->getApplyId() |
|
44 | + $url = $this->buildUrl('lang/apply',[ |
|
45 | + 'applyId' => $job->getApplyId() |
|
46 | 46 | ]); |
47 | - $this->visit($url); |
|
48 | - } |
|
47 | + $this->visit($url); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @Given I visit job categories |
|
52 | - */ |
|
53 | - public function visitJobsCategories() |
|
54 | - { |
|
55 | - $url = '/admin/jobs/categories'; |
|
56 | - $this->visit($url); |
|
57 | - } |
|
50 | + /** |
|
51 | + * @Given I visit job categories |
|
52 | + */ |
|
53 | + public function visitJobsCategories() |
|
54 | + { |
|
55 | + $url = '/admin/jobs/categories'; |
|
56 | + $this->visit($url); |
|
57 | + } |
|
58 | 58 | } |