@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | public function testCreateServiceReturnsAssertionManager() |
32 | 32 | { |
33 | 33 | $services = $this->getMockBuilder('\Zend\ServiceManager\ServiceManager') |
34 | - ->disableOriginalConstructor() |
|
35 | - ->getMock(); |
|
34 | + ->disableOriginalConstructor() |
|
35 | + ->getMock(); |
|
36 | 36 | |
37 | 37 | $services->expects($this->once())->method('get')->with('Config') |
38 | - ->willReturn(array()); |
|
38 | + ->willReturn(array()); |
|
39 | 39 | |
40 | 40 | $target = new AssertionManagerFactory(); |
41 | 41 | $manager = $target->__invoke($services,AssertionManager::class); |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | public function testCorrectConfigIsUsedToConfigureTheManager($config, $testName, $testResult) |
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->once())->method('get')->with('Config') |
60 | - ->willReturn($config); |
|
60 | + ->willReturn($config); |
|
61 | 61 | |
62 | 62 | $target = new AssertionManagerFactory(); |
63 | 63 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | ->willReturn(array()); |
39 | 39 | |
40 | 40 | $target = new AssertionManagerFactory(); |
41 | - $manager = $target->__invoke($services,AssertionManager::class); |
|
41 | + $manager = $target->__invoke($services, AssertionManager::class); |
|
42 | 42 | |
43 | 43 | $this->assertInstanceOf('\Acl\Assertion\AssertionManager', $manager); |
44 | 44 | //$this->assertFalse($manager->shareByDefault(), 'The managers\' shareByDefault value must be set to FALSE by the factory.'); |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | |
62 | 62 | $target = new AssertionManagerFactory(); |
63 | 63 | |
64 | - $manager = $target->__invoke($services,AssertionManager::class); |
|
64 | + $manager = $target->__invoke($services, AssertionManager::class); |
|
65 | 65 | |
66 | - $this->assertTrue($testResult === $manager->has($testName), 'Expected managers\' has method to return ' . ($testResult ? 'TRUE' : 'FALSE') . ' on ' .$testName); |
|
66 | + $this->assertTrue($testResult === $manager->has($testName), 'Expected managers\' has method to return '.($testResult ? 'TRUE' : 'FALSE').' on '.$testName); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | public function provideConfigArrays() |
@@ -68,35 +68,35 @@ discard block |
||
68 | 68 | public function testInjectEventManagerInitializerCallbackGetsEventManagerFromServicesIfNotSetInAssertion() |
69 | 69 | { |
70 | 70 | $assertion = $this |
71 | - ->getMockForAbstractClass('\AclTest\Assertion\EventManagerAwareAssertionMock') |
|
71 | + ->getMockForAbstractClass('\AclTest\Assertion\EventManagerAwareAssertionMock') |
|
72 | 72 | ; |
73 | 73 | $services = $this->getMockBuilder('\Zend\ServiceManager\AbstractPluginManager') |
74 | - ->disableOriginalConstructor() |
|
75 | - ->getMock() |
|
74 | + ->disableOriginalConstructor() |
|
75 | + ->getMock() |
|
76 | 76 | ; |
77 | 77 | $parentServices = $this |
78 | - ->getMockBuilder('\Zend\ServiceManager\ServiceManager') |
|
79 | - ->disableOriginalConstructor() |
|
80 | - ->getMock() |
|
78 | + ->getMockBuilder('\Zend\ServiceManager\ServiceManager') |
|
79 | + ->disableOriginalConstructor() |
|
80 | + ->getMock() |
|
81 | 81 | ; |
82 | 82 | $events = new EventManager(); |
83 | - $target = new AssertionManager($parentServices); |
|
83 | + $target = new AssertionManager($parentServices); |
|
84 | 84 | $assertion |
85 | - ->expects($this->once()) |
|
86 | - ->method('getEventManager') |
|
87 | - ->willReturn(null) |
|
85 | + ->expects($this->once()) |
|
86 | + ->method('getEventManager') |
|
87 | + ->willReturn(null) |
|
88 | 88 | ; |
89 | 89 | $assertion |
90 | - ->expects($this->once()) |
|
91 | - ->method('setEventManager') |
|
92 | - ->with($events) |
|
90 | + ->expects($this->once()) |
|
91 | + ->method('setEventManager') |
|
92 | + ->with($events) |
|
93 | 93 | ; |
94 | 94 | |
95 | 95 | $parentServices |
96 | - ->expects($this->once()) |
|
97 | - ->method('get') |
|
98 | - ->with('EventManager') |
|
99 | - ->willReturn($events) |
|
96 | + ->expects($this->once()) |
|
97 | + ->method('get') |
|
98 | + ->with('EventManager') |
|
99 | + ->willReturn($events) |
|
100 | 100 | ; |
101 | 101 | /* |
102 | 102 | * Wanted to use: |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | $target = new AssertionManager($this->serviceManager); |
116 | 116 | $assertion = $this->getMockForAbstractClass('\AclTest\Assertion\EventManagerAwareAssertionMock'); |
117 | 117 | $services = $this->getMockBuilder('\Zend\ServiceManager\AbstractPluginManager') |
118 | - ->disableOriginalConstructor() |
|
119 | - ->getMock() |
|
118 | + ->disableOriginalConstructor() |
|
119 | + ->getMock() |
|
120 | 120 | ; |
121 | 121 | |
122 | 122 | $parentServices = $this->getMockBuilder('\Zend\ServiceManager\ServiceManager')->disableOriginalConstructor()->getMock(); |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | //$services->setServiceLocator($parentServices); |
127 | 127 | |
128 | 128 | $parentServices |
129 | - ->expects($this->never()) |
|
130 | - ->method('get') |
|
131 | - //->with('SharedEventManager') |
|
132 | - //->willReturn($sharedEvents) |
|
129 | + ->expects($this->never()) |
|
130 | + ->method('get') |
|
131 | + //->with('SharedEventManager') |
|
132 | + //->willReturn($sharedEvents) |
|
133 | 133 | ; |
134 | 134 | $assertion |
135 | - ->expects($this->once()) |
|
136 | - ->method('getEventManager') |
|
137 | - ->willReturn($events) |
|
135 | + ->expects($this->once()) |
|
136 | + ->method('getEventManager') |
|
137 | + ->willReturn($events) |
|
138 | 138 | ; |
139 | 139 | |
140 | 140 | $this->assertNull($target->injectEventManager($assertion, $services)); |
@@ -49,6 +49,6 @@ |
||
49 | 49 | ])); |
50 | 50 | |
51 | 51 | $controllerFactory = new RemoveControllerFactory(); |
52 | - $this->assertInstanceOf(RemoveController::class, $controllerFactory($serviceLocator,'irrelevant')); |
|
52 | + $this->assertInstanceOf(RemoveController::class, $controllerFactory($serviceLocator, 'irrelevant')); |
|
53 | 53 | } |
54 | 54 | } |
@@ -50,9 +50,9 @@ |
||
50 | 50 | $container = $this->getServiceManagerMock(); |
51 | 51 | $plugins = $this->getPluginManagerMock($container); |
52 | 52 | $this->target |
53 | - ->expects($this->once()) |
|
54 | - ->method('__invoke') |
|
55 | - ->with($container, 'Auth/User/Switcher') |
|
53 | + ->expects($this->once()) |
|
54 | + ->method('__invoke') |
|
55 | + ->with($container, 'Auth/User/Switcher') |
|
56 | 56 | ; |
57 | 57 | |
58 | 58 | $this->target->createService($container); |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | private $target = [ |
40 | 40 | UserSwitcherFactory::class, |
41 | 41 | '@testCreateServiceInvokesItself' => [ |
42 | - 'mock' => [ '__invoke' ], |
|
42 | + 'mock' => ['__invoke'], |
|
43 | 43 | ], |
44 | 44 | ]; |
45 | 45 | |
46 | - private $inheritance = [ FactoryInterface::class ]; |
|
46 | + private $inheritance = [FactoryInterface::class]; |
|
47 | 47 | |
48 | 48 | public function testCreateServiceInvokesItself() |
49 | 49 | { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $auth = $this->getMockBuilder(AuthenticationService::class)->disableOriginalConstructor()->getMock(); |
64 | 64 | $acl = $this->getMockBuilder(Acl::class)->disableOriginalConstructor()->getMock(); |
65 | 65 | $sm = $this->createServiceManagerMock(); |
66 | - $controllerPlugins = $this->getPluginManagerMock(['Acl' => ['service' => $acl, 'count_get' => 1]],$sm); |
|
66 | + $controllerPlugins = $this->getPluginManagerMock(['Acl' => ['service' => $acl, 'count_get' => 1]], $sm); |
|
67 | 67 | $container = $this->getServiceManagerMock([ |
68 | 68 | 'AuthenticationService' => ['service' => $auth, 'count_get' => 1], |
69 | 69 | 'ControllerPluginManager' => ['service' => $controllerPlugins, 'count_get' => 1] |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | $hm = new HelperPluginManager($sm); |
28 | 28 | |
29 | - $helper = $f->__invoke($sm,Auth::class); |
|
29 | + $helper = $f->__invoke($sm, Auth::class); |
|
30 | 30 | |
31 | 31 | $this->assertInstanceOf('\Auth\View\Helper\Auth', $helper); |
32 | 32 | $this->assertSame($auth, $helper->getService()); |
@@ -18,44 +18,43 @@ |
||
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Class ManageControllerTest |
21 | - |
|
22 | 21 | * @package AuthTest\Controller |
23 | 22 | */ |
24 | 23 | class ManageControllerTest extends AbstractFunctionalControllerTestCase |
25 | 24 | { |
26 | - const URL_MY_PROFILE = '/en/my/profile'; |
|
25 | + const URL_MY_PROFILE = '/en/my/profile'; |
|
27 | 26 | |
28 | - private $hybridAuthAdapter; |
|
27 | + private $hybridAuthAdapter; |
|
29 | 28 | |
30 | - public function setUp() |
|
31 | - { |
|
32 | - parent::setUp(); |
|
29 | + public function setUp() |
|
30 | + { |
|
31 | + parent::setUp(); |
|
33 | 32 | |
34 | - $this->hybridAuthAdapter = $this->getMockBuilder(HybridAuth::class) |
|
35 | - ->disableOriginalConstructor() |
|
36 | - ->getMock() |
|
37 | - ; |
|
38 | - $this->setMockToServiceLocator('HybridAuthAdapter',$this->hybridAuthAdapter); |
|
39 | - } |
|
33 | + $this->hybridAuthAdapter = $this->getMockBuilder(HybridAuth::class) |
|
34 | + ->disableOriginalConstructor() |
|
35 | + ->getMock() |
|
36 | + ; |
|
37 | + $this->setMockToServiceLocator('HybridAuthAdapter',$this->hybridAuthAdapter); |
|
38 | + } |
|
40 | 39 | |
41 | - public function testAccessWhenNotLoggedIn() |
|
42 | - { |
|
43 | - $this->dispatch(self::URL_MY_PROFILE, Request::METHOD_GET); |
|
40 | + public function testAccessWhenNotLoggedIn() |
|
41 | + { |
|
42 | + $this->dispatch(self::URL_MY_PROFILE, Request::METHOD_GET); |
|
44 | 43 | |
45 | - $result = $this->getResponse()->getContent(); |
|
44 | + $result = $this->getResponse()->getContent(); |
|
46 | 45 | |
47 | - $this->assertNotRedirect(); |
|
48 | - $this->assertResponseStatusCode(Response::STATUS_CODE_401); |
|
49 | - $this->assertContains('Please authenticate yourself to proceed', $result); |
|
50 | - } |
|
46 | + $this->assertNotRedirect(); |
|
47 | + $this->assertResponseStatusCode(Response::STATUS_CODE_401); |
|
48 | + $this->assertContains('Please authenticate yourself to proceed', $result); |
|
49 | + } |
|
51 | 50 | |
52 | - public function testAccessWhenLoggedIn() |
|
53 | - { |
|
54 | - $this->authenticateUser(); |
|
55 | - $this->dispatch(self::URL_MY_PROFILE,Request::METHOD_GET); |
|
56 | - $result = $this->getResponse()->getContent(); |
|
57 | - $this->assertNotRedirect(); |
|
58 | - $this->assertResponseStatusCode(Response::STATUS_CODE_200); |
|
59 | - $this->assertContains('My profile - YAWIK', $result); |
|
60 | - } |
|
51 | + public function testAccessWhenLoggedIn() |
|
52 | + { |
|
53 | + $this->authenticateUser(); |
|
54 | + $this->dispatch(self::URL_MY_PROFILE,Request::METHOD_GET); |
|
55 | + $result = $this->getResponse()->getContent(); |
|
56 | + $this->assertNotRedirect(); |
|
57 | + $this->assertResponseStatusCode(Response::STATUS_CODE_200); |
|
58 | + $this->assertContains('My profile - YAWIK', $result); |
|
59 | + } |
|
61 | 60 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | ->disableOriginalConstructor() |
36 | 36 | ->getMock() |
37 | 37 | ; |
38 | - $this->setMockToServiceLocator('HybridAuthAdapter',$this->hybridAuthAdapter); |
|
38 | + $this->setMockToServiceLocator('HybridAuthAdapter', $this->hybridAuthAdapter); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function testAccessWhenNotLoggedIn() |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public function testAccessWhenLoggedIn() |
53 | 53 | { |
54 | 54 | $this->authenticateUser(); |
55 | - $this->dispatch(self::URL_MY_PROFILE,Request::METHOD_GET); |
|
55 | + $this->dispatch(self::URL_MY_PROFILE, Request::METHOD_GET); |
|
56 | 56 | $result = $this->getResponse()->getContent(); |
57 | 57 | $this->assertNotRedirect(); |
58 | 58 | $this->assertResponseStatusCode(Response::STATUS_CODE_200); |
@@ -125,7 +125,7 @@ |
||
125 | 125 | |
126 | 126 | $pluginManager = $this->controller->getPluginManager(); |
127 | 127 | $pluginManager->setService('redirect', $redirect); |
128 | - $pluginManager->setService('params', $params); |
|
128 | + $pluginManager->setService('params', $params); |
|
129 | 129 | |
130 | 130 | $user = $this->getMockBuilder(User::class) |
131 | 131 | ->getMock(); |
@@ -52,8 +52,8 @@ |
||
52 | 52 | |
53 | 53 | |
54 | 54 | $this->serviceMock = $this->getMockBuilder('Auth\Service\Register') |
55 | - ->disableOriginalConstructor() |
|
56 | - ->getMock(); |
|
55 | + ->disableOriginalConstructor() |
|
56 | + ->getMock(); |
|
57 | 57 | |
58 | 58 | |
59 | 59 | $this->paramsMock = $this->getMockBuilder('Zend\Mvc\Controller\Plugin\Params') |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | { |
135 | 135 | $postData = array( |
136 | 136 | 'name' => uniqid('name'), |
137 | - 'email' => uniqid('email') . '@' . uniqid('host') . '.com.pl' |
|
137 | + 'email' => uniqid('email').'@'.uniqid('host').'.com.pl' |
|
138 | 138 | ); |
139 | 139 | |
140 | 140 | $request = new Request(); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | { |
182 | 182 | $postData = array( |
183 | 183 | 'name' => uniqid('name'), |
184 | - 'email' => uniqid('email') . '@' . uniqid('host') . '.com.pl' |
|
184 | + 'email' => uniqid('email').'@'.uniqid('host').'.com.pl' |
|
185 | 185 | ); |
186 | 186 | |
187 | 187 | $request = new Request(); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | { |
229 | 229 | $postData = array( |
230 | 230 | 'name' => uniqid('name'), |
231 | - 'email' => uniqid('email') . '@' . uniqid('host') . '.com.pl' |
|
231 | + 'email' => uniqid('email').'@'.uniqid('host').'.com.pl' |
|
232 | 232 | ); |
233 | 233 | |
234 | 234 | $request = new Request(); |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | $_SESSION = $oldSession; |
206 | 206 | $this->assertTrue($this->target->switchUser('switchedUser')); |
207 | 207 | $this->assertEquals( |
208 | - [ |
|
209 | - 'isSwitchedUser' => true, |
|
210 | - 'originalUser' => 'originalUser', |
|
211 | - 'params' => [], 'ref' => '/some/ref', |
|
212 | - 'session' => serialize($oldSession) |
|
213 | - ], |
|
214 | - $_SESSION[UserSwitcher::SESSION_NAMESPACE]->getArrayCopy() |
|
208 | + [ |
|
209 | + 'isSwitchedUser' => true, |
|
210 | + 'originalUser' => 'originalUser', |
|
211 | + 'params' => [], 'ref' => '/some/ref', |
|
212 | + 'session' => serialize($oldSession) |
|
213 | + ], |
|
214 | + $_SESSION[UserSwitcher::SESSION_NAMESPACE]->getArrayCopy() |
|
215 | 215 | ); |
216 | 216 | $_SESSION = []; |
217 | 217 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $acl->expects($this->once())->method('setUser')->with($this->isInstanceOf(User::class)); |
236 | 236 | |
237 | 237 | $user = $this->getMockBuilder(User::class)->disableOriginalConstructor() |
238 | - ->setMethods(['getId'])->getMock(); |
|
238 | + ->setMethods(['getId'])->getMock(); |
|
239 | 239 | $user->expects($this->any())->method('getId')->willReturn('switchedUser'); |
240 | 240 | |
241 | 241 | $this->target->switchUser($user, ['ref' => 'ref']); |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | private $target = [ |
44 | 44 | UserSwitcher::class, |
45 | 45 | 'getSimpleAuthMock', |
46 | - '@testInheritance' => [ 'as_reflection' => true ], |
|
46 | + '@testInheritance' => ['as_reflection' => true], |
|
47 | 47 | '@testInvokationProxiesToCorrectMethods' => [ |
48 | 48 | 'args' => false, |
49 | - 'mock' => [ 'clear' => 1, 'switchUser' => ['with' => 'testUserId', 'count' => 1]], |
|
49 | + 'mock' => ['clear' => 1, 'switchUser' => ['with' => 'testUserId', 'count' => 1]], |
|
50 | 50 | ], |
51 | 51 | '@testClearRestoresOriginalUserAndClearsSession' => [ |
52 | 52 | 'args' => 'getComplexAuthMock', |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | ], |
63 | 63 | ]; |
64 | 64 | |
65 | - private $inheritance = [ AbstractPlugin::class ]; |
|
65 | + private $inheritance = [AbstractPlugin::class]; |
|
66 | 66 | |
67 | 67 | public function propertiesProvider() |
68 | 68 | { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ->disableOriginalConstructor() |
108 | 108 | ->getMock(); |
109 | 109 | |
110 | - return [ $auth ]; |
|
110 | + return [$auth]; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | private function getComplexAuthMock() |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | $auth->expects($this->any())->method('getUser')->willReturn(new User()); |
134 | 134 | |
135 | - return [ $auth ]; |
|
135 | + return [$auth]; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | public function testInvokationProxiesToCorrectMethods() |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | public function returnReferenceProvider() |
150 | 150 | { |
151 | 151 | return [ |
152 | - [ null ], [ 'some/ref/uri' ], |
|
152 | + [null], ['some/ref/uri'], |
|
153 | 153 | ]; |
154 | 154 | } |
155 | 155 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $session = new Container(UserSwitcher::SESSION_NAMESPACE); |
164 | 164 | $session->isSwitchedUser = true; |
165 | 165 | $session->originalUser = 'switchedUser'; |
166 | - $oldSession = [ |
|
166 | + $oldSession = [ |
|
167 | 167 | 'oldSession' => true, |
168 | 168 | 'must' => 'be same' |
169 | 169 | ]; |