@@ -35,7 +35,7 @@ |
||
35 | 35 | $options = $this->createMock(FileOptions::class); |
36 | 36 | $options->expects($this->once()) |
37 | 37 | ->method('getCallback') |
38 | - ->willReturn([$this,'getFileName']) |
|
38 | + ->willReturn([$this, 'getFileName']) |
|
39 | 39 | ; |
40 | 40 | $options->expects($this->exactly(2)) |
41 | 41 | ->method('getPath') |
@@ -48,9 +48,9 @@ |
||
48 | 48 | ->method('get') |
49 | 49 | ->willReturnMap( |
50 | 50 | [ |
51 | - ['Config',[]], |
|
52 | - ['Auth/Options',$authOptions], |
|
53 | - ['Core/MailServiceOptions',$mailOptions] |
|
51 | + ['Config', []], |
|
52 | + ['Auth/Options', $authOptions], |
|
53 | + ['Core/MailServiceOptions', $mailOptions] |
|
54 | 54 | ] |
55 | 55 | ); |
56 | 56 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | private $target; |
39 | 39 | |
40 | - private $inheritance = [ ListenerAggregateInterface::class ]; |
|
40 | + private $inheritance = [ListenerAggregateInterface::class]; |
|
41 | 41 | |
42 | 42 | protected function setUp() |
43 | 43 | { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function testDetach() |
75 | 75 | { |
76 | - $callableListener = [new CallableListenerMock(),'doSomething']; |
|
76 | + $callableListener = [new CallableListenerMock(), 'doSomething']; |
|
77 | 77 | |
78 | 78 | $events = $this |
79 | 79 | ->getMockBuilder(EventManager::class) |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | public function testHandleConsoleRequests() |
52 | 52 | { |
53 | 53 | $event = $this |
54 | - ->getMockBuilder(MvcEvent::class) |
|
55 | - ->disableOriginalConstructor() |
|
56 | - ->setMethods(['getRequest', 'getError']) |
|
57 | - ->getMock() |
|
58 | - ; |
|
54 | + ->getMockBuilder(MvcEvent::class) |
|
55 | + ->disableOriginalConstructor() |
|
56 | + ->setMethods(['getRequest', 'getError']) |
|
57 | + ->getMock() |
|
58 | + ; |
|
59 | 59 | |
60 | 60 | $request = new \Zend\Console\Request(); |
61 | 61 | |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | $event = $this->getEventMock('/base/uri', '/see/no/lang'); |
137 | 137 | |
138 | 138 | $event->expects($this->once()) |
139 | - ->method('stopPropagation') |
|
140 | - ->with(true) |
|
139 | + ->method('stopPropagation') |
|
140 | + ->with(true) |
|
141 | 141 | ; |
142 | 142 | $response = new Response(); |
143 | 143 | $event->setResponse($response); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | Assert::assertEquals('/base/uri/xx/see/no/lang', (string) $v->getUri()); |
151 | 151 | return true; |
152 | 152 | } |
153 | - )) |
|
153 | + )) |
|
154 | 154 | ->willReturn($routeMatch) |
155 | 155 | ; |
156 | 156 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | private $target = [ |
41 | 41 | LanguageRouteListener::class, |
42 | - 'mock' => [ 'detectLanguage' => ['return' => 'xx'], 'setLocale', 'isSupportedLanguage', 'redirect'], |
|
42 | + 'mock' => ['detectLanguage' => ['return' => 'xx'], 'setLocale', 'isSupportedLanguage', 'redirect'], |
|
43 | 43 | 'args' => 'getConstructorArgs' |
44 | 44 | ]; |
45 | 45 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | ->expects($this->once()) |
147 | 147 | ->method('match') |
148 | 148 | ->with($this->callback( |
149 | - function ($v) { |
|
149 | + function($v) { |
|
150 | 150 | Assert::assertEquals('/base/uri/xx/see/no/lang', (string) $v->getUri()); |
151 | 151 | return true; |
152 | 152 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | ->expects($this->once()) |
179 | 179 | ->method('match') |
180 | 180 | ->with($this->callback( |
181 | - function ($v) { |
|
181 | + function($v) { |
|
182 | 182 | Assert::assertEquals('/base/uri/xx/non/mappable/route', (string) $v->getUri()); |
183 | 183 | return true; |
184 | 184 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | ->expects($this->once()) |
208 | 208 | ->method('match') |
209 | 209 | ->with($this->callback( |
210 | - function ($v) { |
|
210 | + function($v) { |
|
211 | 211 | Assert::assertEquals('/base/uri/default/see/no/lang', (string) $v->getUri()); |
212 | 212 | return true; |
213 | 213 | } |
@@ -231,6 +231,6 @@ discard block |
||
231 | 231 | public function getConstructorArgs() |
232 | 232 | { |
233 | 233 | $this->moduleOptions = new ModuleOptions(); |
234 | - return [new LocaleService([]),$this->moduleOptions]; |
|
234 | + return [new LocaleService([]), $this->moduleOptions]; |
|
235 | 235 | } |
236 | 236 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | private $target = AjaxEvent::class; |
34 | 34 | |
35 | - private $inheritance = [ Event::class ]; |
|
35 | + private $inheritance = [Event::class]; |
|
36 | 36 | |
37 | 37 | public function propertiesProvider() |
38 | 38 | { |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | ['contentType', [ |
43 | 43 | 'value' => 'test/type', |
44 | 44 | 'default' => AjaxEvent::TYPE_JSON, |
45 | - 'post' => function () { |
|
45 | + 'post' => function() { |
|
46 | 46 | $this->assertEquals('test/type', $this->target->getParam('contentType')); |
47 | 47 | }, |
48 | 48 | ]], |
49 | 49 | ['contentType', [ |
50 | - 'pre' => function () { |
|
50 | + 'pre' => function() { |
|
51 | 51 | $this->target->setParam('contentType', 'type/test'); |
52 | 52 | }, |
53 | 53 | 'value' => 'type/test', |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | ['request', [ |
58 | 58 | 'value' => $request, |
59 | 59 | 'default' => null, |
60 | - 'post' => function () use ($request) { |
|
60 | + 'post' => function() use ($request) { |
|
61 | 61 | $this->assertSame($request, $this->target->getParam('request')); |
62 | 62 | }, |
63 | 63 | ]], |
64 | 64 | ['request', [ |
65 | - 'pre' => function () use ($request) { |
|
65 | + 'pre' => function() use ($request) { |
|
66 | 66 | $this->target->setParam('request', $request); |
67 | 67 | }, |
68 | 68 | 'value' => $request, |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | ['response', [ |
73 | 73 | 'value' => $response, |
74 | 74 | 'default' => null, |
75 | - 'post' => function () use ($response) { |
|
75 | + 'post' => function() use ($response) { |
|
76 | 76 | $this->assertSame($response, $this->target->getParam('response')); |
77 | 77 | }, |
78 | 78 | ]], |
79 | 79 | ['response', [ |
80 | - 'pre' => function () use ($response) { |
|
80 | + 'pre' => function() use ($response) { |
|
81 | 81 | $this->target->setParam('response', $response); |
82 | 82 | }, |
83 | 83 | 'value' => $response, |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | ['result', [ |
89 | 89 | 'value' => 'testResult', |
90 | 90 | 'default' => null, |
91 | - 'post' => function () { |
|
91 | + 'post' => function() { |
|
92 | 92 | $this->assertEquals('testResult', $this->target->getParam('result')); |
93 | 93 | }, |
94 | 94 | ]], |
95 | 95 | ['result', [ |
96 | - 'pre' => function () { |
|
96 | + 'pre' => function() { |
|
97 | 97 | $this->target->setParam('result', 'testResult'); |
98 | 98 | }, |
99 | 99 | 'value' => 'testResult', |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | class CreatePaginatorEventTest extends TestCase |
28 | 28 | { |
29 | - use TestSetterGetterTrait,SetupTargetTrait; |
|
29 | + use TestSetterGetterTrait, SetupTargetTrait; |
|
30 | 30 | |
31 | 31 | protected $target = [ |
32 | 32 | 'class' => CreatePaginatorEvent::class |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | ->getMock() |
44 | 44 | ; |
45 | 45 | return [ |
46 | - ['paginatorParams',[ |
|
46 | + ['paginatorParams', [ |
|
47 | 47 | 'value' =>['name'=>'value'], |
48 | 48 | 'default' => array(), |
49 | 49 | ]], |
50 | - ['paginatorName',[ |
|
50 | + ['paginatorName', [ |
|
51 | 51 | 'value' => 'Some/Paginator', |
52 | 52 | 'default' => null, |
53 | 53 | ]], |
54 | - ['paginators',$paginators], |
|
55 | - ['paginator',$paginator] |
|
54 | + ['paginators', $paginators], |
|
55 | + ['paginator', $paginator] |
|
56 | 56 | ]; |
57 | 57 | } |
58 | 58 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | private $target = FileEvent::class; |
33 | 33 | |
34 | - private $inheritance = [ Event::class ]; |
|
34 | + private $inheritance = [Event::class]; |
|
35 | 35 | |
36 | 36 | public function propertiesProvider() |
37 | 37 | { |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | ['params', [ |
42 | 42 | 'value' => ['file' => $file, 'one' => 'two'], |
43 | 43 | 'expect' => ['one' => 'two'], |
44 | - 'post' => function () use ($file) { |
|
44 | + 'post' => function() use ($file) { |
|
45 | 45 | $this->assertSame($file, $this->target->getFile()); |
46 | 46 | }, |
47 | 47 | ]], |
48 | 48 | ['file', $file], |
49 | 49 | ['file', [ |
50 | - 'pre' => function () use ($file) { |
|
50 | + 'pre' => function() use ($file) { |
|
51 | 51 | $this->target->setParam('file', $file); |
52 | 52 | }, |
53 | 53 | 'ignore_setter' => true, |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | '@testFactoryMethodReturnsInstance' => false |
42 | 42 | ]; |
43 | 43 | |
44 | - protected $inheritance = [ '\Zend\EventManager\ListenerAggregateInterface' ]; |
|
44 | + protected $inheritance = ['\Zend\EventManager\ListenerAggregateInterface']; |
|
45 | 45 | |
46 | 46 | protected $services; |
47 | 47 | |
@@ -56,39 +56,39 @@ discard block |
||
56 | 56 | public function propertiesProvider() |
57 | 57 | { |
58 | 58 | return [ |
59 | - [ 'listeners', [ |
|
60 | - 'value' => [ [] ], |
|
61 | - 'setter_exception' => [ '\DomainException', 'Listener specification must be an array' ] |
|
59 | + ['listeners', [ |
|
60 | + 'value' => [[]], |
|
61 | + 'setter_exception' => ['\DomainException', 'Listener specification must be an array'] |
|
62 | 62 | ]], |
63 | - [ 'listeners', [ |
|
64 | - 'value' => [ [ 'event' => 'test' ] ], |
|
65 | - 'setter_exception' => [ '\DomainException', 'Listener specification must be an array' ] |
|
63 | + ['listeners', [ |
|
64 | + 'value' => [['event' => 'test']], |
|
65 | + 'setter_exception' => ['\DomainException', 'Listener specification must be an array'] |
|
66 | 66 | ]], |
67 | - [ 'listeners', [ |
|
68 | - 'value' => [ [ 'service' => 'test' ] ], |
|
69 | - 'setter_exception' => [ '\DomainException', 'Listener specification must be an array' ] |
|
67 | + ['listeners', [ |
|
68 | + 'value' => [['service' => 'test']], |
|
69 | + 'setter_exception' => ['\DomainException', 'Listener specification must be an array'] |
|
70 | 70 | ]], |
71 | - [ 'listeners', [ |
|
72 | - 'value' => [ [ 'event' => 'test', 'service' => 'service' ] ], |
|
71 | + ['listeners', [ |
|
72 | + 'value' => [['event' => 'test', 'service' => 'service']], |
|
73 | 73 | 'ignore_getter' => true, |
74 | - 'post' => ['assertListenerSpecsProperty', [ '', '@target', '###' ] ], |
|
74 | + 'post' => ['assertListenerSpecsProperty', ['', '@target', '###']], |
|
75 | 75 | ]], |
76 | - [ 'listeners', [ |
|
77 | - 'value' => [ [ 'event' => 'test2', 'service' => 'someClass', 'method' => 'method', 'priority' => 12 ] ], |
|
76 | + ['listeners', [ |
|
77 | + 'value' => [['event' => 'test2', 'service' => 'someClass', 'method' => 'method', 'priority' => 12]], |
|
78 | 78 | 'ignore_getter' => true, |
79 | - 'post' => ['assertListenerSpecsProperty', [ '', '@target', '###' ] ], |
|
79 | + 'post' => ['assertListenerSpecsProperty', ['', '@target', '###']], |
|
80 | 80 | ]], |
81 | - [ 'listener', [ |
|
81 | + ['listener', [ |
|
82 | 82 | 'value' => 'test', |
83 | - 'setter_args' => [ 'service', 'method', 10 ], |
|
84 | - 'setter_value' => [ 'event' => 'test', 'service' => 'service', 'method' => 'method', 'priority' => 10, 'instance' => null ], |
|
83 | + 'setter_args' => ['service', 'method', 10], |
|
84 | + 'setter_value' => ['event' => 'test', 'service' => 'service', 'method' => 'method', 'priority' => 10, 'instance' => null], |
|
85 | 85 | 'setter_assert' => 'assertListenerSpecsProperty', |
86 | 86 | 'ignore_getter' => true, |
87 | 87 | ]], |
88 | - [ 'listener', [ |
|
88 | + ['listener', [ |
|
89 | 89 | 'value' => 'test', |
90 | - 'setter_args' => [ 'service', 10 ], |
|
91 | - 'setter_value' => [ 'event' => 'test', 'service' => 'service', 'method' => null, 'priority' => 10, 'instance' => null ], |
|
90 | + 'setter_args' => ['service', 10], |
|
91 | + 'setter_value' => ['event' => 'test', 'service' => 'service', 'method' => null, 'priority' => 10, 'instance' => null], |
|
92 | 92 | 'setter_assert' => 'assertListenerSpecsProperty', |
93 | 93 | 'ignore_getter' => true, |
94 | 94 | ]] |
@@ -132,20 +132,20 @@ discard block |
||
132 | 132 | $this->target->setListener('test02', 'service02', 10); |
133 | 133 | |
134 | 134 | //In ZF3 EventManager detach should be a callable or it will throws an error |
135 | - $callback = [$testListener,'callback']; |
|
135 | + $callback = [$testListener, 'callback']; |
|
136 | 136 | $events = $this->getMockBuilder(EventManager::class) |
137 | 137 | ->setMethods(['attach', 'detach']) |
138 | 138 | ->getMock(); |
139 | 139 | $events->expects($this->exactly(2)) |
140 | 140 | ->method('attach') |
141 | 141 | ->withConsecutive( |
142 | - [ $this->equalTo('test01'), $this->anything(), $this->equalTo(0) ], |
|
143 | - [ $this->equalTo('test02'), $this->anything(), $this->equalTo(10) ] |
|
142 | + [$this->equalTo('test01'), $this->anything(), $this->equalTo(0)], |
|
143 | + [$this->equalTo('test02'), $this->anything(), $this->equalTo(10)] |
|
144 | 144 | ) |
145 | 145 | ->will( |
146 | 146 | $this->onConsecutiveCalls( |
147 | - [$testListener,'callback'], |
|
148 | - [$testListener,'callback'] |
|
147 | + [$testListener, 'callback'], |
|
148 | + [$testListener, 'callback'] |
|
149 | 149 | ) |
150 | 150 | ); |
151 | 151 | |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | public function listenerProvider() |
187 | 187 | { |
188 | 188 | return [ |
189 | - [ 'nonExistant', null ], |
|
190 | - [ '\CoreTest\Listener\DLATListenerMock', null ], |
|
191 | - [ 'listener', new DLATListenerMock() ], |
|
192 | - [ 'listener', new DLATListenerMock(), 'invoke' ], |
|
193 | - [ 'listener', new DLATListenerMock(), 'method', 'callback' ], |
|
194 | - [ 'listener', new DLATListenerMock(), 'methodButNone', 'noMethod' ], |
|
195 | - [ 'listener', new DLATNonInvokableListenerMock() ], |
|
189 | + ['nonExistant', null], |
|
190 | + ['\CoreTest\Listener\DLATListenerMock', null], |
|
191 | + ['listener', new DLATListenerMock()], |
|
192 | + ['listener', new DLATListenerMock(), 'invoke'], |
|
193 | + ['listener', new DLATListenerMock(), 'method', 'callback'], |
|
194 | + ['listener', new DLATListenerMock(), 'methodButNone', 'noMethod'], |
|
195 | + ['listener', new DLATNonInvokableListenerMock()], |
|
196 | 196 | ]; |
197 | 197 | } |
198 | 198 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | if (null === $listener) { |
212 | 212 | if (!class_exists($service, true)) { |
213 | 213 | $this->expectException('\UnexpectedValueException'); |
214 | - $this->expectExceptionMessage('Cannot create deferred listener "' . $service); |
|
214 | + $this->expectExceptionMessage('Cannot create deferred listener "'.$service); |
|
215 | 215 | } |
216 | 216 | $this->services->expects($this->once())->method('has')->with($service)->willReturn(false); |
217 | 217 | $this->services->expects($this->never())->method('get'); |
@@ -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 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | private $target = [ |
38 | 38 | MongoQueue::class, |
39 | 39 | 'setupArgs', |
40 | - '@testInheritance' => [ 'as_reflection' => true ], |
|
40 | + '@testInheritance' => ['as_reflection' => true], |
|
41 | 41 | '@testConstruction' => false, |
42 | 42 | '@testPushLazyWithStringName' => '#mockPush', |
43 | 43 | '@testPushLazyWithArraySpec' => '#mockPush', |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | ] |
47 | 47 | ]; |
48 | 48 | |
49 | - private $inheritance = [ AbstractQueue::class ]; |
|
49 | + private $inheritance = [AbstractQueue::class]; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | ->setMethods(['getInsertedId'])->getMock(); |
128 | 128 | $resultMock->expects($this->once())->method('getInsertedId')->willReturn('ID'); |
129 | 129 | $this->mongoCollectionMock->expects($this->once())->method('insertOne') |
130 | - ->with($this->callback(function ($value) { |
|
130 | + ->with($this->callback(function($value) { |
|
131 | 131 | return isset($value['queue']) && $value['queue'] == $this->queueName |
132 | 132 | && isset($value['status']) && $value['status'] == MongoQueue::STATUS_PENDING |
133 | 133 | && !isset($value['tried']) |
@@ -156,7 +156,7 @@ discard block |
||
156 | 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) { |
|
159 | + ->with($this->callback(function($value) use ($options) { |
|
160 | 160 | return isset($value['queue']) && $value['queue'] == $this->queueName |
161 | 161 | && isset($value['status']) && $value['status'] == MongoQueue::STATUS_PENDING |
162 | 162 | && !isset($value['tried']) |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | && isset($value['created']) && isset($value['scheduled']) |
165 | 165 | && $value['scheduled'] instanceof \MongoDB\BSON\UTCDateTime |
166 | 166 | && $value['created'] instanceof \MongoDB\BSON\UTCDateTime |
167 | - && (int) ((string) $value['scheduled']) - (int) ((string)$value['created']) == $options['delay'] * 1000 |
|
167 | + && (int) ((string) $value['scheduled']) - (int) ((string) $value['created']) == $options['delay'] * 1000 |
|
168 | 168 | && isset($value['priority']) && $value['priority'] == $options['priority'] |
169 | 169 | ; |
170 | 170 | })) |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | ->with( |
188 | 188 | $this->equalTo(['_id' => new \MongoDB\BSON\ObjectID($job->getId())]), |
189 | 189 | $this->callback( |
190 | - function ($value) { |
|
190 | + function($value) { |
|
191 | 191 | if (!array_key_exists('$set', $value)) { |
192 | 192 | return false; |
193 | 193 | } |
@@ -216,7 +216,7 @@ discard block |
||
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 | 218 | ->with( |
219 | - $this->callback(function ($value) { |
|
219 | + $this->callback(function($value) { |
|
220 | 220 | return |
221 | 221 | isset($value['queue']) && $value['queue'] == $this->queueName |
222 | 222 | && isset($value['status']) && $value['status'] == MongoQueue::STATUS_PENDING |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | ; |
225 | 225 | }), |
226 | 226 | $this->callback( |
227 | - function ($value) { |
|
227 | + function($value) { |
|
228 | 228 | if (!array_key_exists('$set', $value)) { |
229 | 229 | return false; |
230 | 230 | } |
@@ -234,10 +234,10 @@ discard block |
||
234 | 234 | ; |
235 | 235 | } |
236 | 236 | ), |
237 | - $this->callback(function ($value) { |
|
237 | + $this->callback(function($value) { |
|
238 | 238 | return |
239 | 239 | isset($value['sort']) && $value['sort'] == ['priority' => 1, 'scheduled' => 1] |
240 | - && isset($value['returnDocument'])&&$value['returnDocument'] = \MongoDB\Operation\FindOneAndUpdate::RETURN_DOCUMENT_AFTER |
|
240 | + && isset($value['returnDocument']) && $value['returnDocument'] = \MongoDB\Operation\FindOneAndUpdate::RETURN_DOCUMENT_AFTER |
|
241 | 241 | ; |
242 | 242 | }) |
243 | 243 | ) |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | /* @var AbstractJob $job2 */ |
265 | 265 | $job1 = new $this->testJobClass('TestJob1'); |
266 | 266 | $job2 = new $this->testJobClass('TestJob2'); |
267 | - $filter = [ 'queue' => $this->queueName ]; |
|
268 | - $opt = [ 'sort' => [ 'scheduled' => 1, 'priority' => 1 ] ]; |
|
267 | + $filter = ['queue' => $this->queueName]; |
|
268 | + $opt = ['sort' => ['scheduled' => 1, 'priority' => 1]]; |
|
269 | 269 | $envelopes = [ |
270 | 270 | [ |
271 | 271 | '_id' => $job1->getId(), |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | ], |
282 | 282 | ]; |
283 | 283 | $this->jobManagerMock->expects($this->exactly(2))->method('get') |
284 | - ->with($this->testJobClass)->will($this->returnCallback(function () { |
|
284 | + ->with($this->testJobClass)->will($this->returnCallback(function() { |
|
285 | 285 | return new $this->testJobClass(); |
286 | 286 | })); |
287 | 287 | |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | $jobs = $this->target->listing(); |
308 | 308 | |
309 | 309 | $this->assertEquals(1, $cursor->called, "Cursor::toArray should have been called exactly one time, but was called '{$cursor->called}' times'"); |
310 | - $this->assertTrue(is_array($jobs), 'Return value should have been an array, but is "' . gettype($jobs) . '" instead."'); |
|
311 | - $this->assertTrue(2 == count($jobs), 'Only 2 jobs should have been returned, but it were ' . count($jobs)); |
|
310 | + $this->assertTrue(is_array($jobs), 'Return value should have been an array, but is "'.gettype($jobs).'" instead."'); |
|
311 | + $this->assertTrue(2 == count($jobs), 'Only 2 jobs should have been returned, but it were '.count($jobs)); |
|
312 | 312 | |
313 | 313 | $this->assertArrayHasKey('job', $jobs[0]); |
314 | 314 | $this->assertEquals($job1, $jobs[0]['job'], 'Job1 is not the same'); |
@@ -323,8 +323,8 @@ discard block |
||
323 | 323 | 'limit' => 10, |
324 | 324 | ]; |
325 | 325 | |
326 | - $filter = [ 'queue' => $this->queueName, 'status' => $options['status'] ]; |
|
327 | - $opt = [ 'sort' => [ 'scheduled' => 1, 'priority' => 1 ], 'limit' => $options['limit'] ]; |
|
326 | + $filter = ['queue' => $this->queueName, 'status' => $options['status']]; |
|
327 | + $opt = ['sort' => ['scheduled' => 1, 'priority' => 1], 'limit' => $options['limit']]; |
|
328 | 328 | |
329 | 329 | $this->jobManagerMock->expects($this->never())->method('get'); |
330 | 330 | $cursor = new class() { |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | ->with( |
352 | 352 | $this->equalTo(['_id' => new \MongoDB\BSON\ObjectID($job->getId())]), |
353 | 353 | $this->callback( |
354 | - function ($value) use ($options) { |
|
354 | + function($value) use ($options) { |
|
355 | 355 | if (!array_key_exists('$set', $value)) { |
356 | 356 | return false; |
357 | 357 | } |