@@ -156,7 +156,7 @@ |
||
156 | 156 | $self = $this; |
157 | 157 | |
158 | 158 | $events->expects($this->once())->method('triggerUntil') |
159 | - ->will($this->returnCallback(function ($callback, $eventName, $event) use ($acl, $role, $resource, $privilege, $self) { |
|
159 | + ->will($this->returnCallback(function($callback, $eventName, $event) use ($acl, $role, $resource, $privilege, $self) { |
|
160 | 160 | $self->assertTrue(is_callable($callback)); |
161 | 161 | $self->assertEquals('assert', $eventName); |
162 | 162 | $self->assertSame($acl, $event->getAcl()); |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | $acl = new Acl(); |
87 | 87 | |
88 | 88 | $events = $this->getMockBuilder('\Laminas\EventManager\EventManager') |
89 | - ->disableOriginalConstructor() |
|
90 | - ->getMock(); |
|
89 | + ->disableOriginalConstructor() |
|
90 | + ->getMock(); |
|
91 | 91 | |
92 | 92 | $events->expects($this->once()) |
93 | - ->method('triggerUntil') |
|
94 | - ->willReturn(new ResponseCollection()); |
|
93 | + ->method('triggerUntil') |
|
94 | + ->willReturn(new ResponseCollection()); |
|
95 | 95 | |
96 | 96 | $target->setEventManager($events); |
97 | 97 | |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | $responseFalse = $this->createResponseMock(false); |
114 | 114 | |
115 | 115 | $events = $this->getMockBuilder('\Laminas\EventManager\EventManager') |
116 | - ->disableOriginalConstructor() |
|
117 | - ->getMock(); |
|
116 | + ->disableOriginalConstructor() |
|
117 | + ->getMock(); |
|
118 | 118 | |
119 | 119 | $events->expects($this->exactly(5)) |
120 | - ->method('triggerUntil') |
|
121 | - ->will($this->onConsecutiveCalls($responseNull, $responseEmpty, $responseZero, $responseTrue, $responseFalse)); |
|
120 | + ->method('triggerUntil') |
|
121 | + ->will($this->onConsecutiveCalls($responseNull, $responseEmpty, $responseZero, $responseTrue, $responseFalse)); |
|
122 | 122 | |
123 | 123 | $target->setEventManager($events); |
124 | 124 | |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | protected function createResponseMock($returnValue) |
135 | 135 | { |
136 | 136 | $response = $this->getMockBuilder('\Laminas\EventManager\ResponseCollection') |
137 | - ->disableOriginalConstructor() |
|
138 | - ->getMock(); |
|
137 | + ->disableOriginalConstructor() |
|
138 | + ->getMock(); |
|
139 | 139 | $response->method('last')->willReturn($returnValue); |
140 | 140 | |
141 | 141 | return $response; |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | $target = new TargetMock(); |
147 | 147 | |
148 | 148 | $events = $this->getMockBuilder('\Laminas\EventManager\EventManager') |
149 | - ->disableOriginalConstructor() |
|
150 | - ->getMock(); |
|
149 | + ->disableOriginalConstructor() |
|
150 | + ->getMock(); |
|
151 | 151 | |
152 | 152 | $acl = new Acl(); |
153 | 153 | $role = new GenericRole('testRole'); |
@@ -156,16 +156,16 @@ discard block |
||
156 | 156 | $self = $this; |
157 | 157 | |
158 | 158 | $events->expects($this->once())->method('triggerUntil') |
159 | - ->will($this->returnCallback(function ($callback, $eventName, $event) use ($acl, $role, $resource, $privilege, $self) { |
|
160 | - $self->assertTrue(is_callable($callback)); |
|
161 | - $self->assertEquals('assert', $eventName); |
|
162 | - $self->assertSame($acl, $event->getAcl()); |
|
163 | - $self->assertSame($role, $event->getRole()); |
|
164 | - $self->assertSame($resource, $event->getResource()); |
|
165 | - $self->assertSame($privilege, $event->getPrivilege()); |
|
166 | - |
|
167 | - return new ResponseCollection(); |
|
168 | - })); |
|
159 | + ->will($this->returnCallback(function ($callback, $eventName, $event) use ($acl, $role, $resource, $privilege, $self) { |
|
160 | + $self->assertTrue(is_callable($callback)); |
|
161 | + $self->assertEquals('assert', $eventName); |
|
162 | + $self->assertSame($acl, $event->getAcl()); |
|
163 | + $self->assertSame($role, $event->getRole()); |
|
164 | + $self->assertSame($resource, $event->getResource()); |
|
165 | + $self->assertSame($privilege, $event->getPrivilege()); |
|
166 | + |
|
167 | + return new ResponseCollection(); |
|
168 | + })); |
|
169 | 169 | |
170 | 170 | $target->setEventManager($events); |
171 | 171 | $target->assert($acl, $role, $resource, $privilege); |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | $this->assertTrue($this->target->switchUser('switchedUser')); |
212 | 212 | $this->assertEquals( |
213 | 213 | [ |
214 | - 'isSwitchedUser' => true, |
|
215 | - 'originalUser' => 'originalUser', |
|
216 | - 'params' => [], 'ref' => '/some/ref', |
|
217 | - 'session' => serialize($oldSession) |
|
218 | - ], |
|
214 | + 'isSwitchedUser' => true, |
|
215 | + 'originalUser' => 'originalUser', |
|
216 | + 'params' => [], 'ref' => '/some/ref', |
|
217 | + 'session' => serialize($oldSession) |
|
218 | + ], |
|
219 | 219 | $_SESSION[UserSwitcher::SESSION_NAMESPACE]->getArrayCopy() |
220 | 220 | ); |
221 | 221 | $_SESSION = []; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $acl->expects($this->once())->method('setUser')->with($this->isInstanceOf(User::class)); |
241 | 241 | |
242 | 242 | $user = $this->getMockBuilder(User::class)->disableOriginalConstructor() |
243 | - ->setMethods(['getId'])->getMock(); |
|
243 | + ->setMethods(['getId'])->getMock(); |
|
244 | 244 | $user->expects($this->any())->method('getId')->willReturn('switchedUser'); |
245 | 245 | |
246 | 246 | $this->target->switchUser($user, ['ref' => 'ref']); |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | private $target = [ |
46 | 46 | UserSwitcher::class, |
47 | 47 | 'getSimpleAuthMock', |
48 | - '@testInheritance' => [ 'as_reflection' => true ], |
|
48 | + '@testInheritance' => ['as_reflection' => true], |
|
49 | 49 | '@testInvokationProxiesToCorrectMethods' => [ |
50 | 50 | 'args' => false, |
51 | - 'mock' => [ 'clear' => 1, 'switchUser' => ['with' => 'testUserId', 'count' => 1]], |
|
51 | + 'mock' => ['clear' => 1, 'switchUser' => ['with' => 'testUserId', 'count' => 1]], |
|
52 | 52 | ], |
53 | 53 | '@testClearRestoresOriginalUserAndClearsSession' => [ |
54 | 54 | 'args' => 'getComplexAuthMock', |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | ], |
65 | 65 | ]; |
66 | 66 | |
67 | - private $inheritance = [ AbstractPlugin::class ]; |
|
67 | + private $inheritance = [AbstractPlugin::class]; |
|
68 | 68 | |
69 | 69 | public function propertiesProvider() |
70 | 70 | { |
71 | - $createSession = function () { |
|
71 | + $createSession = function() { |
|
72 | 72 | $_SESSION[UserSwitcher::SESSION_NAMESPACE]['params'] = ['param' => 'value']; |
73 | 73 | }; |
74 | - $clearSession = function () { |
|
74 | + $clearSession = function() { |
|
75 | 75 | $_SESSION = []; |
76 | 76 | }; |
77 | 77 | return [ |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | ->disableOriginalConstructor() |
114 | 114 | ->getMock(); |
115 | 115 | |
116 | - return [ $auth ]; |
|
116 | + return [$auth]; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | private function getComplexAuthMock() |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | $auth->expects($this->any())->method('getUser')->willReturn(new User()); |
140 | 140 | |
141 | - return [ $auth ]; |
|
141 | + return [$auth]; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | public function testInvokationProxiesToCorrectMethods() |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | public function returnReferenceProvider() |
156 | 156 | { |
157 | 157 | return [ |
158 | - [ null ], [ 'some/ref/uri' ], |
|
158 | + [null], ['some/ref/uri'], |
|
159 | 159 | ]; |
160 | 160 | } |
161 | 161 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $session = new Container(UserSwitcher::SESSION_NAMESPACE); |
170 | 170 | $session->isSwitchedUser = true; |
171 | 171 | $session->originalUser = 'switchedUser'; |
172 | - $oldSession = [ |
|
172 | + $oldSession = [ |
|
173 | 173 | 'oldSession' => true, |
174 | 174 | 'must' => 'be same' |
175 | 175 | ]; |
@@ -19,7 +19,6 @@ |
||
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Class ManageControllerTest |
22 | - |
|
23 | 22 | * @package AuthTest\Controller |
24 | 23 | */ |
25 | 24 | class ManageControllerTest extends AbstractFunctionalControllerTestCase |
@@ -41,11 +41,11 @@ |
||
41 | 41 | private $target = [ |
42 | 42 | UserSwitcherFactory::class, |
43 | 43 | '@testCreateServiceInvokesItself' => [ |
44 | - 'mock' => [ '__invoke' ], |
|
44 | + 'mock' => ['__invoke'], |
|
45 | 45 | ], |
46 | 46 | ]; |
47 | 47 | |
48 | - private $inheritance = [ FactoryInterface::class ]; |
|
48 | + private $inheritance = [FactoryInterface::class]; |
|
49 | 49 | |
50 | 50 | public function testCreateServiceInvokesItself() |
51 | 51 | { |
@@ -129,7 +129,7 @@ |
||
129 | 129 | [$this->equalTo(MvcEvent::EVENT_DISPATCH_ERROR), $this->identicalTo([$this->listener, 'prepareExceptionViewModel'], $this->identicalTo(null))], |
130 | 130 | [$this->equalTo(MvcEvent::EVENT_RENDER_ERROR), $this->identicalTo([$this->listener, 'prepareExceptionViewModel'], $this->identicalTo(null))], |
131 | 131 | [$this->equalTo(MvcEvent::EVENT_ROUTE), $this->identicalTo([$this->listener, 'checkDeactivatedUser'], $this->identicalTo(null))] |
132 | - ); |
|
132 | + ); |
|
133 | 133 | |
134 | 134 | $this->listener->attach($eventManager); |
135 | 135 | } |
@@ -83,7 +83,7 @@ |
||
83 | 83 | ->getMock(); |
84 | 84 | $this->serviceManager->expects($this->any()) |
85 | 85 | ->method('get') |
86 | - ->will($this->returnCallback(function ($name) { |
|
86 | + ->will($this->returnCallback(function($name) { |
|
87 | 87 | switch ($name) { |
88 | 88 | case 'AuthenticationService': |
89 | 89 | return $this->auth; |
@@ -6,7 +6,7 @@ |
||
6 | 6 | // This should be an array of module namespaces used in the application. |
7 | 7 | |
8 | 8 | use PHPUnit\Framework\TestCase; |
9 | - 'modules' => array_merge($commonModules,array( |
|
9 | + 'modules' => array_merge($commonModules, array( |
|
10 | 10 | 'Core', |
11 | 11 | 'Auth', |
12 | 12 | 'Jobs', |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | use PHPUnit\Framework\TestCase; |
9 | 9 | 'modules' => array_merge($commonModules,array( |
10 | 10 | 'Core', |
11 | - 'Auth', |
|
12 | - 'Jobs', |
|
13 | - 'Organizations', |
|
11 | + 'Auth', |
|
12 | + 'Jobs', |
|
13 | + 'Organizations', |
|
14 | 14 | )), |
15 | 15 | |
16 | 16 | // These are various options for the listeners attached to the ModuleManager |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | // ), |
69 | 69 | // ) |
70 | 70 | |
71 | - // Initial configuration with which to seed the ServiceManager. |
|
72 | - // Should be compatible with Laminas\ServiceManager\Config. |
|
73 | - // 'service_manager' => array(), |
|
71 | + // Initial configuration with which to seed the ServiceManager. |
|
72 | + // Should be compatible with Laminas\ServiceManager\Config. |
|
73 | + // 'service_manager' => array(), |
|
74 | 74 | ); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | ]; |
55 | 55 | |
56 | 56 | /** @noinspection PhpUnusedPrivateFieldInspection */ |
57 | - private $inheritance = [ EventSubscriber::class ]; |
|
57 | + private $inheritance = [EventSubscriber::class]; |
|
58 | 58 | |
59 | 59 | |
60 | 60 | private function getTarget() |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | public function testSubscribesToOnFlushEvent() |
68 | 68 | { |
69 | - $this->assertEquals([ Events::onFlush ], $this->target->getSubscribedEvents()); |
|
69 | + $this->assertEquals([Events::onFlush], $this->target->getSubscribedEvents()); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | public function testUpdatesFilesPermissionsOnFlush() |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | $document->singleFile = $file; |
100 | 100 | $document->fileCollection = $collection; |
101 | 101 | |
102 | - $inserts = [ $document ]; |
|
103 | - $updates = [ $document ]; |
|
102 | + $inserts = [$document]; |
|
103 | + $updates = [$document]; |
|
104 | 104 | |
105 | 105 | $filePermissions->expects($this->exactly(4))->method('clear')->will($this->returnSelf()); |
106 | 106 | $filePermissions->expects($this->exactly(4))->method('inherit')->with($permissions)->will($this->returnSelf()); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | class ConcreteUpdateFilesPermissionsSubScriber extends AbstractUpdateFilesPermissionsSubscriber |
159 | 159 | { |
160 | - protected $filesProperties = [ 'singleFile', 'fileCollection' ]; |
|
160 | + protected $filesProperties = ['singleFile', 'fileCollection']; |
|
161 | 161 | protected $targetDocument = Ufps_TargetDocument::class; |
162 | 162 | } |
163 | 163 |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $translator->expects($this->once()) |
102 | 102 | ->method('translate') |
103 | 103 | ->willReturnMap([ |
104 | - ['some message','default','translated some message'], |
|
104 | + ['some message', 'default', 'translated some message'], |
|
105 | 105 | ]) |
106 | 106 | ; |
107 | 107 | $listener->expects($this->exactly(2)) |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | ->willReturn($mock) |
138 | 138 | ; |
139 | 139 | |
140 | - $callback = array($mock,$method); |
|
140 | + $callback = array($mock, $method); |
|
141 | 141 | $this->assertSame( |
142 | 142 | $mock, |
143 | 143 | call_user_func($callback, $message) |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | public function getTestCreateNamespacedMessages() |
148 | 148 | { |
149 | 149 | return [ |
150 | - ['info','info message'], |
|
151 | - ['warning','warning message'], |
|
152 | - ['success','success message'], |
|
153 | - ['danger','danger message'], |
|
154 | - ['error','error message'] |
|
150 | + ['info', 'info message'], |
|
151 | + ['warning', 'warning message'], |
|
152 | + ['success', 'success message'], |
|
153 | + ['danger', 'danger message'], |
|
154 | + ['error', 'error message'] |
|
155 | 155 | ]; |
156 | 156 | } |
157 | 157 | |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | $events->expects($this->exactly(2)) |
175 | 175 | ->method('getNotifications') |
176 | 176 | ->willReturnOnConsecutiveCalls( |
177 | - [],// setup for empty array test |
|
178 | - [$entity1,$entity2] // setup for non empty array tests |
|
177 | + [], // setup for empty array test |
|
178 | + [$entity1, $entity2] // setup for non empty array tests |
|
179 | 179 | ) |
180 | 180 | ; |
181 | 181 | |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | $mock->expects($this->exactly(2)) |
193 | 193 | ->method('renderMessage') |
194 | 194 | ->withConsecutive( |
195 | - ['some notification',Notification::NAMESPACE_INFO], |
|
196 | - ['some notification',Notification::NAMESPACE_DANGER] |
|
195 | + ['some notification', Notification::NAMESPACE_INFO], |
|
196 | + ['some notification', Notification::NAMESPACE_DANGER] |
|
197 | 197 | ) |
198 | 198 | ; |
199 | 199 | $mock->createOutput($events); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $mock = $this->getMockBuilder(PaginationParams::class) |
64 | 64 | ->disableOriginalConstructor() |
65 | - ->setMethods(['getParams','getList']) |
|
65 | + ->setMethods(['getParams', 'getList']) |
|
66 | 66 | ->getMock() |
67 | 67 | ; |
68 | 68 | $repository = $this->createMock(RepositoryInterface::class); |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | $mock->expects($this->exactly(2)) |
79 | 79 | ->method('getList') |
80 | 80 | ->withConsecutive( |
81 | - ['some/namespace',[$this,'methodToTest']], |
|
82 | - ['some/namespace',$repository] |
|
81 | + ['some/namespace', [$this, 'methodToTest']], |
|
82 | + ['some/namespace', $repository] |
|
83 | 83 | ) |
84 | 84 | ->willReturn('getList called') |
85 | 85 | ; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | ); |
98 | 98 | $this->assertEquals( |
99 | 99 | 'getList called', |
100 | - $mock('some/namespace', [$this,'methodToTest']), |
|
100 | + $mock('some/namespace', [$this, 'methodToTest']), |
|
101 | 101 | '__invoke() should call ::getList when defaults is callable' |
102 | 102 | ); |
103 | 103 | $this->assertEquals( |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $session->list = null; |
180 | 180 | $mock = $this->target; |
181 | 181 | |
182 | - $callback = [$this,'methodToTest']; |
|
182 | + $callback = [$this, 'methodToTest']; |
|
183 | 183 | $output = $mock->getList('namespace', $callback); |
184 | 184 | $this->assertEquals( |
185 | 185 | 'methodToTest called', |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | ->willReturn('next') |
223 | 223 | ; |
224 | 224 | $this->assertEquals( |
225 | - ['previous','next'], |
|
225 | + ['previous', 'next'], |
|
226 | 226 | $mock->getNeighbours('namespace', 'callback', 'id') |
227 | 227 | ); |
228 | 228 | } |