@@ -53,17 +53,17 @@ |
||
53 | 53 | $auth = $this->getMockBuilder('\Auth\AuthenticationService')->disableOriginalConstructor()->getMock(); |
54 | 54 | |
55 | 55 | $services = $this->getMockBuilder('\Zend\ServiceManager\ServiceManager') |
56 | - ->disableOriginalConstructor() |
|
57 | - ->getMock() |
|
56 | + ->disableOriginalConstructor() |
|
57 | + ->getMock() |
|
58 | 58 | ; |
59 | 59 | $services->expects($this->exactly(2)) |
60 | - ->method('get') |
|
61 | - ->will($this->returnValueMap( |
|
62 | - array( |
|
63 | - array('repositories',$repositories), |
|
64 | - array('AuthenticationService', $auth) |
|
65 | - ) |
|
66 | - )) |
|
60 | + ->method('get') |
|
61 | + ->will($this->returnValueMap( |
|
62 | + array( |
|
63 | + array('repositories',$repositories), |
|
64 | + array('AuthenticationService', $auth) |
|
65 | + ) |
|
66 | + )) |
|
67 | 67 | ; |
68 | 68 | |
69 | 69 | $target = new AcceptInvitationHandlerFactory(); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $target = new InvitationHandlerFactory(); |
45 | 45 | |
46 | 46 | $tokenGenerator = $this->getMockBuilder('\Auth\Service\UserUniqueTokenGenerator') |
47 | - ->disableOriginalConstructor()->getMock(); |
|
47 | + ->disableOriginalConstructor()->getMock(); |
|
48 | 48 | |
49 | 49 | $userRepository = $this->getMockBuilder('\Auth\Repository\User')->disableOriginalConstructor()->getMock(); |
50 | 50 | |
@@ -53,21 +53,21 @@ discard block |
||
53 | 53 | |
54 | 54 | $translator = new \Zend\I18n\Translator\Translator(); |
55 | 55 | |
56 | - $mailer = $this->getMockBuilder('\Core\Controller\Plugin\Mailer') |
|
57 | - ->disableOriginalConstructor() |
|
58 | - ->getMock() |
|
59 | - ; |
|
56 | + $mailer = $this->getMockBuilder('\Core\Controller\Plugin\Mailer') |
|
57 | + ->disableOriginalConstructor() |
|
58 | + ->getMock() |
|
59 | + ; |
|
60 | 60 | |
61 | 61 | $pluginManager = $this->getMockBuilder(PluginManager::class) |
62 | - ->disableOriginalConstructor() |
|
63 | - ->getMock() |
|
62 | + ->disableOriginalConstructor() |
|
63 | + ->getMock() |
|
64 | 64 | ; |
65 | 65 | |
66 | 66 | $pluginManager->expects($this->once()) |
67 | - ->method('get') |
|
68 | - ->with('Core/Mailer') |
|
69 | - ->willReturn($mailer) |
|
70 | - ; |
|
67 | + ->method('get') |
|
68 | + ->with('Core/Mailer') |
|
69 | + ->willReturn($mailer) |
|
70 | + ; |
|
71 | 71 | |
72 | 72 | $emailValidator = new \Zend\Validator\EmailAddress(); |
73 | 73 | |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | |
77 | 77 | $services = $this->getMockBuilder('\Zend\ServiceManager\ServiceManager')->disableOriginalConstructor()->getMock(); |
78 | 78 | $services->expects($this->exactly(5)) |
79 | - ->method('get') |
|
80 | - ->will($this->returnValueMap(array( |
|
81 | - array('ValidatorManager', $validators), // get ha signature ($name, $usePeeringManagers = true) |
|
82 | - array('translator', $translator), |
|
83 | - array('repositories', $repositories), |
|
84 | - array('Auth/UserTokenGenerator', $tokenGenerator), |
|
85 | - array('ControllerPluginManager',$pluginManager), |
|
86 | - ))); |
|
79 | + ->method('get') |
|
80 | + ->will($this->returnValueMap(array( |
|
81 | + array('ValidatorManager', $validators), // get ha signature ($name, $usePeeringManagers = true) |
|
82 | + array('translator', $translator), |
|
83 | + array('repositories', $repositories), |
|
84 | + array('Auth/UserTokenGenerator', $tokenGenerator), |
|
85 | + array('ControllerPluginManager',$pluginManager), |
|
86 | + ))); |
|
87 | 87 | |
88 | 88 | /* |
89 | 89 | * test start here |
@@ -44,15 +44,15 @@ discard block |
||
44 | 44 | |
45 | 45 | $headscript = $this->getMockBuilder('\Zend\View\Helper\HeadScript')->disableOriginalConstructor()->getMock(); |
46 | 46 | $headscript->expects($this->once()) |
47 | - ->method('__call') |
|
48 | - ->with('appendFile', array('modules/Organizations/js/organizations.employees.js')) |
|
49 | - ->willReturn(null); |
|
47 | + ->method('__call') |
|
48 | + ->with('appendFile', array('modules/Organizations/js/organizations.employees.js')) |
|
49 | + ->willReturn(null); |
|
50 | 50 | |
51 | 51 | $basepath = $this->getMockBuilder('\Zend\View\Helper\BasePath')->disableOriginalConstructor()->getMock(); |
52 | 52 | $basepath->expects($this->once()) |
53 | - ->method('__invoke') |
|
54 | - ->with('modules/Organizations/js/organizations.employees.js') |
|
55 | - ->will($this->returnArgument(0)); |
|
53 | + ->method('__invoke') |
|
54 | + ->with('modules/Organizations/js/organizations.employees.js') |
|
55 | + ->will($this->returnArgument(0)); |
|
56 | 56 | |
57 | 57 | $helpers = $this->getMockBuilder('\Zend\View\HelperPluginManager')->disableOriginalConstructor()->getMock(); |
58 | 58 | $helpers->expects($this->exactly(2)) |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | ->will($this->onConsecutiveCalls($headscript, $basepath)); |
65 | 65 | |
66 | 66 | $services = $this->getMockBuilder('\Zend\ServiceManager\ServiceManager')->disableOriginalConstructor() |
67 | - ->getMock(); |
|
67 | + ->getMock(); |
|
68 | 68 | |
69 | 69 | $services->expects($this->once()) |
70 | - ->method('get') |
|
71 | - ->with('ViewHelperManager') |
|
72 | - ->willReturn($helpers); |
|
70 | + ->method('get') |
|
71 | + ->with('ViewHelperManager') |
|
72 | + ->willReturn($helpers); |
|
73 | 73 | |
74 | 74 | $fieldset = $target->__invoke($services, 'irrelevant'); |
75 | 75 |
@@ -47,11 +47,11 @@ |
||
47 | 47 | |
48 | 48 | $repos = $this->getMockBuilder('\Core\Repository\RepositoryService')->disableOriginalConstructor()->getMock(); |
49 | 49 | $repos->expects($this->once()) |
50 | - ->method('get')->with('Auth/User')->willReturn($users); |
|
50 | + ->method('get')->with('Auth/User')->willReturn($users); |
|
51 | 51 | |
52 | 52 | $services = $this->getMockBuilder('\Zend\ServiceManager\ServiceManager')->disableOriginalConstructor()->getMock(); |
53 | 53 | $services->expects($this->once()) |
54 | - ->method('get')->with('repositories')->willReturn($repos); |
|
54 | + ->method('get')->with('repositories')->willReturn($repos); |
|
55 | 55 | |
56 | 56 | $fieldset = $target->__invoke($services,'irrelevant'); |
57 | 57 |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | } |
62 | 62 | if (in_array('userTokenGenerator', $mocks)) { |
63 | 63 | $this->userTokenGeneratorMock = $this->getMockBuilder('\Auth\Service\UserUniqueTokenGenerator') |
64 | - ->disableOriginalConstructor()->getMock(); |
|
64 | + ->disableOriginalConstructor()->getMock(); |
|
65 | 65 | } |
66 | 66 | if (in_array('mailerPlugin', $mocks)) { |
67 | 67 | $this->mailerPluginMock = $this->getMockBuilder('\Core\Controller\Plugin\Mailer') |
68 | - ->disableOriginalConstructor()->getMock(); |
|
68 | + ->disableOriginalConstructor()->getMock(); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if ($inject) { |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | $email = 'invalidEmailAddress'; |
134 | 134 | $message = 'Email address is invalid.'; |
135 | 135 | $this->translatorMock->expects($this->exactly(5)) |
136 | - ->method('translate') |
|
137 | - ->with($message) |
|
138 | - ->will($this->returnArgument(0)); |
|
136 | + ->method('translate') |
|
137 | + ->with($message) |
|
138 | + ->will($this->returnArgument(0)); |
|
139 | 139 | |
140 | 140 | $expected = array( |
141 | 141 | 'ok' => false, |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $user->getInfo()->setEmail($email); |
161 | 161 | |
162 | 162 | $this->userRepositoryMock->expects($this->once())->method('findByEmail')->with($email, null) |
163 | - ->willReturn($user); |
|
163 | + ->willReturn($user); |
|
164 | 164 | $this->userRepositoryMock->expects($this->never())->method('create'); |
165 | 165 | $this->userTokenGeneratorMock->expects($this->once())->method('generate')->with($user, 7)->willReturn('testToken'); |
166 | 166 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $user->getInfo()->setEmail($email); |
193 | 193 | |
194 | 194 | $this->userRepositoryMock->expects($this->once())->method('findByEmail')->with($email, null) |
195 | - ->willReturn(null); |
|
195 | + ->willReturn(null); |
|
196 | 196 | $this->userRepositoryMock->expects($this->once())->method('create')->willReturn($user); |
197 | 197 | $this->userTokenGeneratorMock->expects($this->once())->method('generate')->with($user, 7)->willReturn('testToken'); |
198 | 198 | |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | |
228 | 228 | $message = 'Sending invitation mail failed.'; |
229 | 229 | $this->translatorMock->expects($this->once()) |
230 | - ->method('translate') |
|
231 | - ->with($message) |
|
232 | - ->will($this->returnArgument(0)); |
|
230 | + ->method('translate') |
|
231 | + ->with($message) |
|
232 | + ->will($this->returnArgument(0)); |
|
233 | 233 | |
234 | 234 | $this->userRepositoryMock->expects($this->once())->method('findByEmail')->with($email, null) |
235 | - ->willReturn($user); |
|
235 | + ->willReturn($user); |
|
236 | 236 | $this->userRepositoryMock->expects($this->never())->method('create'); |
237 | 237 | $this->userTokenGeneratorMock->expects($this->once())->method('generate')->with($user, 7)->willReturn('testToken'); |
238 | 238 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | $this->authMock = $this->getMockBuilder('\Auth\AuthenticationService')->disableOriginalConstructor()->getMock(); |
49 | 49 | $this->organizationRepositoryMock = $this->getMockBuilder('Organizations\Repository\Organization') |
50 | - ->disableOriginalConstructor()->getMock(); |
|
50 | + ->disableOriginalConstructor()->getMock(); |
|
51 | 51 | $this->userRepositoryMock = $this->getMockBuilder('\Auth\Repository\User')->disableOriginalConstructor()->getMock(); |
52 | 52 | |
53 | 53 | if (false !== strpos($this->getName(false), 'Setter')) { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $employee->expects($this->once())->method('setStatus')->with(Employee::STATUS_ASSIGNED); |
77 | 77 | |
78 | 78 | $this->organizationMock->expects($this->once())->method('getEmployee')->with($this->userMock->getId()) |
79 | - ->willReturn($employee); |
|
79 | + ->willReturn($employee); |
|
80 | 80 | |
81 | 81 | $this->organizationMock->expects($this->any())->method('getId')->willReturn('testOrgId'); |
82 | 82 | $this->userRepositoryMock->expects($this->once())->method('findByToken')->with('testToken')->willReturn($this->userMock); |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | ->willReturn($unassignedEmp); |
104 | 104 | |
105 | 105 | $this->organizationRepositoryMock->expects($this->once()) |
106 | - ->method('findPendingOrganizationsByEmployee') |
|
107 | - ->with($this->userMock->getId()) |
|
108 | - ->willReturn(array($sameOrganization, $assignedEmpOrganization, $unassignedEmpOrganization)); |
|
106 | + ->method('findPendingOrganizationsByEmployee') |
|
107 | + ->with($this->userMock->getId()) |
|
108 | + ->willReturn(array($sameOrganization, $assignedEmpOrganization, $unassignedEmpOrganization)); |
|
109 | 109 | |
110 | 110 | $storageMock = $this->getMockForAbstractClass('\Zend\Authentication\Storage\StorageInterface'); |
111 | 111 | $storageMock->expects($this->once())->method('write')->with($this->userMock->getId()); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $orgRef = $this->getMockBuilder('\Organizations\Entity\OrganizationReference')->disableOriginalConstructor()->getMock(); |
178 | 178 | $orgRef->expects($this->once())->method('hasAssociation')->willReturn(true); |
179 | 179 | $orgRef->expects($this->once())->method('getEmployee')->with($this->userMock->getId()) |
180 | - ->willReturn($empMock); |
|
180 | + ->willReturn($empMock); |
|
181 | 181 | |
182 | 182 | $this->userMock->setOrganization($orgRef); |
183 | 183 |
@@ -59,31 +59,31 @@ |
||
59 | 59 | |
60 | 60 | |
61 | 61 | $plugins = $this |
62 | - ->getMockBuilder('\Zend\Mvc\Controller\PluginManager') |
|
63 | - ->disableOriginalConstructor() |
|
64 | - ->getMock() |
|
62 | + ->getMockBuilder('\Zend\Mvc\Controller\PluginManager') |
|
63 | + ->disableOriginalConstructor() |
|
64 | + ->getMock() |
|
65 | 65 | ; |
66 | 66 | $plugins |
67 | - ->expects($this->any()) |
|
68 | - ->method('get') |
|
69 | - ->will($this->returnCallback(array($this, 'retrievePluginMock'))) |
|
67 | + ->expects($this->any()) |
|
68 | + ->method('get') |
|
69 | + ->will($this->returnCallback(array($this, 'retrievePluginMock'))) |
|
70 | 70 | ; |
71 | 71 | |
72 | 72 | $this->target->setPluginManager($plugins); |
73 | 73 | |
74 | 74 | $params = $this->getMockBuilder('\Zend\Mvc\Controller\Plugin\Params') |
75 | - ->disableOriginalConstructor() |
|
76 | - ->getMock() |
|
75 | + ->disableOriginalConstructor() |
|
76 | + ->getMock() |
|
77 | 77 | ; |
78 | 78 | $params |
79 | - ->expects($this->any()) |
|
80 | - ->method('__invoke') |
|
81 | - ->will($this->returnSelf()) |
|
79 | + ->expects($this->any()) |
|
80 | + ->method('__invoke') |
|
81 | + ->will($this->returnSelf()) |
|
82 | 82 | ; |
83 | 83 | $params |
84 | - ->expects($this->any()) |
|
85 | - ->method('fromQuery') |
|
86 | - ->will($this->returnCallback(array($this, 'retrieveQueryParam'))) |
|
84 | + ->expects($this->any()) |
|
85 | + ->method('fromQuery') |
|
86 | + ->will($this->returnCallback(array($this, 'retrieveQueryParam'))) |
|
87 | 87 | ; |
88 | 88 | |
89 | 89 | $this->pluginsMockMap['params'] = $params; |
@@ -79,7 +79,7 @@ |
||
79 | 79 | $rep = $this->getMockBuilder('\Organizations\Repository\Organization')->disableOriginalConstructor()->getMock(); |
80 | 80 | |
81 | 81 | $dm->expects($this->once())->method('getRepository')->with('Organizations\Entity\Organization') |
82 | - ->willReturn($rep); |
|
82 | + ->willReturn($rep); |
|
83 | 83 | |
84 | 84 | $doc->setId('test1234'); |
85 | 85 |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | |
117 | 117 | $orgRep = $this->getMockBuilder('\Organizations\Repository\Organization')->disableOriginalConstructor()->getMock(); |
118 | 118 | $orgRep->expects($this->exactly(2)) |
119 | - ->method('findByUser') |
|
120 | - ->withConsecutive(array('testOwner'), array('testUser')) |
|
121 | - ->will($this->onConsecutiveCalls($ownerOrg, $userOrg)); |
|
119 | + ->method('findByUser') |
|
120 | + ->withConsecutive(array('testOwner'), array('testUser')) |
|
121 | + ->will($this->onConsecutiveCalls($ownerOrg, $userOrg)); |
|
122 | 122 | |
123 | 123 | |
124 | 124 | $ownerOrgRef = new OrganizationReference('testOwner', $orgRep); |
@@ -135,37 +135,37 @@ discard block |
||
135 | 135 | |
136 | 136 | $router = $this->getMockForAbstractClass(RouteStackInterface::class); |
137 | 137 | $router->expects($this->once()) |
138 | - ->method('assemble') |
|
139 | - ->with(array('action' => 'accept'), |
|
140 | - array('name' => 'lang/organizations/invite', |
|
138 | + ->method('assemble') |
|
139 | + ->with(array('action' => 'accept'), |
|
140 | + array('name' => 'lang/organizations/invite', |
|
141 | 141 | 'query' => array('token' => $options['token'], 'organization' => $ownerOrg->getId())) |
142 | - ) |
|
143 | - ->willReturn('testUrl'); |
|
142 | + ) |
|
143 | + ->willReturn('testUrl'); |
|
144 | 144 | |
145 | 145 | $mailService = $this->getMockBuilder('\Core\Mail\MailService')->disableOriginalConstructor()->getMock(); |
146 | 146 | |
147 | 147 | $services = $this->getMockBuilder('\Zend\ServiceManager\ServiceManager')->disableOriginalConstructor()->getMock(); |
148 | 148 | |
149 | 149 | $services->expects($this->exactly(3)) |
150 | - ->method('get') |
|
151 | - ->withConsecutive( |
|
150 | + ->method('get') |
|
151 | + ->withConsecutive( |
|
152 | 152 | array('AuthenticationService'), |
153 | 153 | array('Router'), |
154 | 154 | ['Core/MailService'] |
155 | - )->will($this->onConsecutiveCalls($authService, $router, $mailService)); |
|
155 | + )->will($this->onConsecutiveCalls($authService, $router, $mailService)); |
|
156 | 156 | |
157 | 157 | $mailMock = new HTMLTemplateMessage(new \Zend\ServiceManager\ServiceManager()); |
158 | 158 | $translator = $this->getMockBuilder('\Zend\I18n\Translator\Translator')->disableOriginalConstructor()->getMock(); |
159 | 159 | $translator |
160 | - ->expects($this->any()) |
|
161 | - ->method('translate') |
|
162 | - ->will($this->returnArgument(0)); |
|
160 | + ->expects($this->any()) |
|
161 | + ->method('translate') |
|
162 | + ->will($this->returnArgument(0)); |
|
163 | 163 | $mailMock->setTranslator($translator); |
164 | 164 | $mailService |
165 | - ->expects($this->once()) |
|
166 | - ->method('get') |
|
167 | - ->with('htmltemplate') |
|
168 | - ->willReturn($mailMock); |
|
165 | + ->expects($this->once()) |
|
166 | + ->method('get') |
|
167 | + ->with('htmltemplate') |
|
168 | + ->willReturn($mailMock); |
|
169 | 169 | |
170 | 170 | |
171 | 171 | $target = new EmployeeInvitationFactory(); |