@@ -104,15 +104,15 @@ |
||
| 104 | 104 | ->getMock(); |
| 105 | 105 | |
| 106 | 106 | $target->expects($this->exactly(4)) |
| 107 | - ->method('add') |
|
| 108 | - ->withConsecutive( |
|
| 109 | - array($expectAdd1), |
|
| 110 | - array($expectAdd2), |
|
| 111 | - array($expectAdd3), |
|
| 112 | - array($expectAdd4) |
|
| 107 | + ->method('add') |
|
| 108 | + ->withConsecutive( |
|
| 109 | + array($expectAdd1), |
|
| 110 | + array($expectAdd2), |
|
| 111 | + array($expectAdd3), |
|
| 112 | + array($expectAdd4) |
|
| 113 | 113 | |
| 114 | 114 | |
| 115 | - ); |
|
| 115 | + ); |
|
| 116 | 116 | |
| 117 | 117 | $target->init(); |
| 118 | 118 | } |
@@ -88,11 +88,11 @@ |
||
| 88 | 88 | ->getMock(); |
| 89 | 89 | |
| 90 | 90 | $target->expects($this->exactly(2)) |
| 91 | - ->method('add') |
|
| 92 | - ->withConsecutive( |
|
| 93 | - array($expectAdd1), |
|
| 94 | - array($expectAdd2) |
|
| 95 | - ); |
|
| 91 | + ->method('add') |
|
| 92 | + ->withConsecutive( |
|
| 93 | + array($expectAdd1), |
|
| 94 | + array($expectAdd2) |
|
| 95 | + ); |
|
| 96 | 96 | |
| 97 | 97 | $target->init(); |
| 98 | 98 | $this->assertEquals('employees', $target->getName()); |
@@ -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']); |
@@ -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 |
@@ -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 | } |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | ->getMock() |
| 99 | 99 | ; |
| 100 | 100 | $container = $this->getMockBuilder(ContainerInterface::class) |
| 101 | - ->getMock(); |
|
| 101 | + ->getMock(); |
|
| 102 | 102 | $container->expects($this->once()) |
| 103 | 103 | ->method('get') |
| 104 | 104 | ->with('ServiceManager') |
@@ -126,14 +126,14 @@ |
||
| 126 | 126 | |
| 127 | 127 | $formData = ['data' => 'value']; |
| 128 | 128 | $hydrator = $this->getMockBuilder(HydratorInterface::class) |
| 129 | - ->setMethods(['hydrate', 'extract']) |
|
| 130 | - ->getMockForAbstractClass(); |
|
| 129 | + ->setMethods(['hydrate', 'extract']) |
|
| 130 | + ->getMockForAbstractClass(); |
|
| 131 | 131 | $hydrator->expects($this->once())->method('extract')->with($this->isInstanceOf(Parameters::class))->willReturn($formData); |
| 132 | 132 | $hydrator->expects($this->once())->method('hydrate')->with($formData, $this->isInstanceOf(Parameters::class)); |
| 133 | 133 | |
| 134 | 134 | $form = $this->getMockBuilder(Form::class) |
| 135 | - ->setMethods(['getHydrator', 'setData']) |
|
| 136 | - ->getMock(); |
|
| 135 | + ->setMethods(['getHydrator', 'setData']) |
|
| 136 | + ->getMock(); |
|
| 137 | 137 | $form->expects($this->once())->method('gethydrator')->willReturn($hydrator); |
| 138 | 138 | $form->expects($this->once())->method('setData')->with($formData); |
| 139 | 139 | $this->formElementManagerMock |
@@ -47,16 +47,16 @@ discard block |
||
| 47 | 47 | $services = new ServiceManager(); |
| 48 | 48 | $this->assertTrue( |
| 49 | 49 | $this->target->canCreate( |
| 50 | - $services, |
|
| 51 | - 'Any.string/Value/Events' |
|
| 52 | - ), |
|
| 50 | + $services, |
|
| 51 | + 'Any.string/Value/Events' |
|
| 52 | + ), |
|
| 53 | 53 | 'Checking correct name failed.' |
| 54 | 54 | ); |
| 55 | 55 | $this->assertFalse( |
| 56 | 56 | $this->target->canCreate( |
| 57 | - $services, |
|
| 58 | - 'Any.string.not.ending/in/Events.but has it in the middle!' |
|
| 59 | - ), |
|
| 57 | + $services, |
|
| 58 | + 'Any.string.not.ending/in/Events.but has it in the middle!' |
|
| 59 | + ), |
|
| 60 | 60 | 'Checking invalid name failed.' |
| 61 | 61 | ); |
| 62 | 62 | } |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | /* @var EventManagerAbstractFactory|\PHPUnit_Framework_MockObject_MockObject $target */ |
| 100 | 100 | $target = $this->getMockBuilder('\Core\Factory\EventManager\EventManagerAbstractFactory') |
| 101 | - ->setMethods([ 'createEventManager', 'attachListeners' ]) |
|
| 102 | - ->getMock(); |
|
| 101 | + ->setMethods([ 'createEventManager', 'attachListeners' ]) |
|
| 102 | + ->getMock(); |
|
| 103 | 103 | |
| 104 | 104 | $services = new ServiceManager(); |
| 105 | 105 | $services->setService('Config', $config); |
@@ -153,11 +153,11 @@ discard block |
||
| 153 | 153 | 'delay' => 100, |
| 154 | 154 | ]; |
| 155 | 155 | $resultMock = $this->getMockBuilder(\MongoDB\InsertOneResult::class)->disableOriginalConstructor() |
| 156 | - ->setMethods(['getInsertedId'])->getMock(); |
|
| 156 | + ->setMethods(['getInsertedId'])->getMock(); |
|
| 157 | 157 | $resultMock->expects($this->once())->method('getInsertedId')->willReturn('ID'); |
| 158 | 158 | $this->mongoCollectionMock->expects($this->once())->method('insertOne') |
| 159 | - ->with($this->callback(function ($value) use ($options) { |
|
| 160 | - return isset($value['queue']) && $value['queue'] == $this->queueName |
|
| 159 | + ->with($this->callback(function ($value) use ($options) { |
|
| 160 | + return isset($value['queue']) && $value['queue'] == $this->queueName |
|
| 161 | 161 | && isset($value['status']) && $value['status'] == MongoQueue::STATUS_PENDING |
| 162 | 162 | && !isset($value['tried']) |
| 163 | 163 | && !isset($value['message']) && !isset($value['trace']) |
@@ -166,9 +166,9 @@ discard block |
||
| 166 | 166 | && $value['created'] instanceof \MongoDB\BSON\UTCDateTime |
| 167 | 167 | && (int) ((string) $value['scheduled']) - (int) ((string)$value['created']) == $options['delay'] * 1000 |
| 168 | 168 | && isset($value['priority']) && $value['priority'] == $options['priority'] |
| 169 | - ; |
|
| 170 | - })) |
|
| 171 | - ->willReturn($resultMock); |
|
| 169 | + ; |
|
| 170 | + })) |
|
| 171 | + ->willReturn($resultMock); |
|
| 172 | 172 | |
| 173 | 173 | $this->target->push($job, $options); |
| 174 | 174 | |
@@ -184,21 +184,21 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | |
| 186 | 186 | $this->mongoCollectionMock->expects($this->once())->method('findOneAndUpdate') |
| 187 | - ->with( |
|
| 188 | - $this->equalTo(['_id' => new \MongoDB\BSON\ObjectID($job->getId())]), |
|
| 189 | - $this->callback( |
|
| 190 | - function ($value) { |
|
| 191 | - if (!array_key_exists('$set', $value)) { |
|
| 192 | - return false; |
|
| 193 | - } |
|
| 194 | - $value = $value['$set']; |
|
| 195 | - return isset($value['tried']) && $value['tried'] == 10 |
|
| 187 | + ->with( |
|
| 188 | + $this->equalTo(['_id' => new \MongoDB\BSON\ObjectID($job->getId())]), |
|
| 189 | + $this->callback( |
|
| 190 | + function ($value) { |
|
| 191 | + if (!array_key_exists('$set', $value)) { |
|
| 192 | + return false; |
|
| 193 | + } |
|
| 194 | + $value = $value['$set']; |
|
| 195 | + return isset($value['tried']) && $value['tried'] == 10 |
|
| 196 | 196 | && !array_key_exists('created', $value) |
| 197 | 197 | ; |
| 198 | - } |
|
| 199 | - ) |
|
| 200 | - ) |
|
| 201 | - ->willReturn(null); |
|
| 198 | + } |
|
| 199 | + ) |
|
| 200 | + ) |
|
| 201 | + ->willReturn(null); |
|
| 202 | 202 | |
| 203 | 203 | $this->target->retry($job); |
| 204 | 204 | } |
@@ -215,33 +215,33 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | $this->jobManagerMock->expects($this->once())->method('get')->with(get_class($job))->willReturn(new $this->testJobClass()); |
| 217 | 217 | $this->mongoCollectionMock->expects($this->once())->method('findOneAndUpdate') |
| 218 | - ->with( |
|
| 219 | - $this->callback(function ($value) { |
|
| 220 | - return |
|
| 218 | + ->with( |
|
| 219 | + $this->callback(function ($value) { |
|
| 220 | + return |
|
| 221 | 221 | isset($value['queue']) && $value['queue'] == $this->queueName |
| 222 | 222 | && isset($value['status']) && $value['status'] == MongoQueue::STATUS_PENDING |
| 223 | 223 | && isset($value['scheduled']['$lte']) && $value['scheduled']['$lte'] instanceof \MongoDB\BSON\UTCDateTime |
| 224 | - ; |
|
| 225 | - }), |
|
| 226 | - $this->callback( |
|
| 227 | - function ($value) { |
|
| 228 | - if (!array_key_exists('$set', $value)) { |
|
| 229 | - return false; |
|
| 230 | - } |
|
| 231 | - $value = $value['$set']; |
|
| 232 | - return isset($value['status']) && $value['status'] == MongoQueue::STATUS_RUNNING |
|
| 224 | + ; |
|
| 225 | + }), |
|
| 226 | + $this->callback( |
|
| 227 | + function ($value) { |
|
| 228 | + if (!array_key_exists('$set', $value)) { |
|
| 229 | + return false; |
|
| 230 | + } |
|
| 231 | + $value = $value['$set']; |
|
| 232 | + return isset($value['status']) && $value['status'] == MongoQueue::STATUS_RUNNING |
|
| 233 | 233 | && array_key_exists('executed', $value) |
| 234 | - ; |
|
| 235 | - } |
|
| 236 | - ), |
|
| 237 | - $this->callback(function ($value) { |
|
| 238 | - return |
|
| 234 | + ; |
|
| 235 | + } |
|
| 236 | + ), |
|
| 237 | + $this->callback(function ($value) { |
|
| 238 | + return |
|
| 239 | 239 | isset($value['sort']) && $value['sort'] == ['priority' => 1, 'scheduled' => 1] |
| 240 | 240 | && isset($value['returnDocument'])&&$value['returnDocument'] = \MongoDB\Operation\FindOneAndUpdate::RETURN_DOCUMENT_AFTER |
| 241 | - ; |
|
| 242 | - }) |
|
| 243 | - ) |
|
| 244 | - ->willReturn($envelope); |
|
| 241 | + ; |
|
| 242 | + }) |
|
| 243 | + ) |
|
| 244 | + ->willReturn($envelope); |
|
| 245 | 245 | |
| 246 | 246 | $actualJob = $this->target->pop(); |
| 247 | 247 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | public function testPopEmptyQueue() |
| 252 | 252 | { |
| 253 | 253 | $this->mongoCollectionMock->expects($this->once())->method('findOneAndUpdate') |
| 254 | - ->willReturn(null); |
|
| 254 | + ->willReturn(null); |
|
| 255 | 255 | |
| 256 | 256 | $actualJob = $this->target->pop(); |
| 257 | 257 | |
@@ -335,8 +335,8 @@ discard block |
||
| 335 | 335 | }; |
| 336 | 336 | |
| 337 | 337 | $this->mongoCollectionMock->expects($this->once())->method('find') |
| 338 | - ->with($filter, $opt) |
|
| 339 | - ->willReturn($cursor); |
|
| 338 | + ->with($filter, $opt) |
|
| 339 | + ->willReturn($cursor); |
|
| 340 | 340 | |
| 341 | 341 | $this->target->listing($options); |
| 342 | 342 | } |
@@ -348,23 +348,23 @@ discard block |
||
| 348 | 348 | $job->setId(new \MongoDB\BSON\ObjectID()); |
| 349 | 349 | $options = ['message' => 'test failure message']; |
| 350 | 350 | $this->mongoCollectionMock->expects($this->once())->method('findOneAndUpdate') |
| 351 | - ->with( |
|
| 352 | - $this->equalTo(['_id' => new \MongoDB\BSON\ObjectID($job->getId())]), |
|
| 353 | - $this->callback( |
|
| 354 | - function ($value) use ($options) { |
|
| 355 | - if (!array_key_exists('$set', $value)) { |
|
| 356 | - return false; |
|
| 357 | - } |
|
| 358 | - $value = $value['$set']; |
|
| 359 | - return isset($value['status']) && $value['status'] == MongoQueue::STATUS_FAILED |
|
| 351 | + ->with( |
|
| 352 | + $this->equalTo(['_id' => new \MongoDB\BSON\ObjectID($job->getId())]), |
|
| 353 | + $this->callback( |
|
| 354 | + function ($value) use ($options) { |
|
| 355 | + if (!array_key_exists('$set', $value)) { |
|
| 356 | + return false; |
|
| 357 | + } |
|
| 358 | + $value = $value['$set']; |
|
| 359 | + return isset($value['status']) && $value['status'] == MongoQueue::STATUS_FAILED |
|
| 360 | 360 | && !array_key_exists('created', $value) |
| 361 | 361 | && !array_key_exists('scheduled', $value) |
| 362 | 362 | && isset($value['message']) && $value['message'] == $options['message'] |
| 363 | - ; |
|
| 364 | - } |
|
| 365 | - ) |
|
| 366 | - ) |
|
| 367 | - ->willReturn(null); |
|
| 363 | + ; |
|
| 364 | + } |
|
| 365 | + ) |
|
| 366 | + ) |
|
| 367 | + ->willReturn(null); |
|
| 368 | 368 | |
| 369 | 369 | $this->target->fail($job, $options); |
| 370 | 370 | } |