@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | public function __invoke(Job $jobEntity, $options = []) |
79 | 79 | { |
80 | - $options= array_merge($this->options, $options); |
|
80 | + $options = array_merge($this->options, $options); |
|
81 | 81 | |
82 | 82 | $ats = $jobEntity->getAtsMode(); |
83 | 83 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $urlHelper = $this->urlHelper; |
91 | 91 | |
92 | 92 | if ($ats->isIntern() || $ats->isEmail()) { |
93 | - $query = [ 'subscriberUri' => $serverUrlHelper(array()) . '/subscriber/' . 1 ]; |
|
93 | + $query = ['subscriberUri' => $serverUrlHelper(array()).'/subscriber/'.1]; |
|
94 | 94 | $route = 'lang/apply'; |
95 | 95 | $params = [ |
96 | 96 | 'applyId' => $jobEntity->getApplyId(), |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | if ($options['linkOnly']) { |
109 | - $result=$url; |
|
109 | + $result = $url; |
|
110 | 110 | if ($options['absolute'] && !preg_match('~^https?://~', $url)) { |
111 | 111 | $result = $serverUrlHelper($url); |
112 | 112 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | foreach ($options as $key=>$val) { |
127 | 127 | if (array_key_exists($this->options, $key)) { |
128 | - $this->options[$key]=$val; |
|
128 | + $this->options[$key] = $val; |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | '@testConstructor*' => false, |
48 | 48 | ]; |
49 | 49 | |
50 | - private $inheritance = [ AbstractStrategy::class ]; |
|
50 | + private $inheritance = [AbstractStrategy::class]; |
|
51 | 51 | |
52 | 52 | private $attributes = [ |
53 | 53 | 'tmpl' => [ |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | $logger = $this->target->getLogger(); |
113 | 113 | |
114 | - static::assertTrue((new \ReflectionClass($logger))->isAnonymous(),'getLogger did not return an anonymous NullLogger.'); |
|
114 | + static::assertTrue((new \ReflectionClass($logger))->isAnonymous(), 'getLogger did not return an anonymous NullLogger.'); |
|
115 | 115 | static::assertInstanceOf(LoggerInterface::class, $logger); |
116 | 116 | } |
117 | 117 |
@@ -46,8 +46,8 @@ |
||
46 | 46 | { |
47 | 47 | $events = $this->prophesize(EventManagerInterface::class); |
48 | 48 | $events->attach(AbstractWorkerEvent::EVENT_PROCESS_IDLE, [$this->target, 'onIdle'], 1) |
49 | - ->willReturn('handle') |
|
50 | - ->shouldBeCalled(); |
|
49 | + ->willReturn('handle') |
|
50 | + ->shouldBeCalled(); |
|
51 | 51 | |
52 | 52 | $this->target->attach($events->reveal()); |
53 | 53 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | private $target = IdleSleepStrategy::class; |
34 | 34 | |
35 | - private $inheritance = [ AbstractStrategy::class ]; |
|
35 | + private $inheritance = [AbstractStrategy::class]; |
|
36 | 36 | |
37 | 37 | |
38 | 38 | public function testSetDuration() |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | 'delay' => 100, |
153 | 153 | ]; |
154 | 154 | $resultMock = $this->getMockBuilder(\MongoDB\InsertOneResult::class)->disableOriginalConstructor() |
155 | - ->setMethods(['getInsertedId'])->getMock(); |
|
155 | + ->setMethods(['getInsertedId'])->getMock(); |
|
156 | 156 | $resultMock->expects($this->once())->method('getInsertedId')->willReturn('ID'); |
157 | 157 | $this->mongoCollectionMock->expects($this->once())->method('insertOne') |
158 | - ->with($this->callback(function($value) use ($options) { |
|
158 | + ->with($this->callback(function($value) use ($options) { |
|
159 | 159 | |
160 | - return isset($value['queue']) && $value['queue'] == $this->queueName |
|
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,17 +184,17 @@ 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(function($value) { |
|
190 | - if (!array_key_exists('$set', $value)) { return false;} |
|
191 | - $value = $value['$set']; |
|
187 | + ->with( |
|
188 | + $this->equalTo(['_id' => new \MongoDB\BSON\ObjectID($job->getId())]), |
|
189 | + $this->callback(function($value) { |
|
190 | + if (!array_key_exists('$set', $value)) { return false;} |
|
191 | + $value = $value['$set']; |
|
192 | 192 | return isset($value['tried']) && $value['tried'] == 10 |
193 | 193 | && !array_key_exists('created', $value) |
194 | 194 | ; |
195 | - } |
|
196 | - )) |
|
197 | - ->willReturn(null); |
|
195 | + } |
|
196 | + )) |
|
197 | + ->willReturn(null); |
|
198 | 198 | |
199 | 199 | $this->target->retry($job); |
200 | 200 | } |
@@ -211,31 +211,31 @@ discard block |
||
211 | 211 | |
212 | 212 | $this->jobManagerMock->expects($this->once())->method('get')->with(get_class($job))->willReturn(new $this->testJobClass()); |
213 | 213 | $this->mongoCollectionMock->expects($this->once())->method('findOneAndUpdate') |
214 | - ->with( |
|
215 | - $this->callback(function($value) { |
|
216 | - return |
|
214 | + ->with( |
|
215 | + $this->callback(function($value) { |
|
216 | + return |
|
217 | 217 | isset($value['queue']) && $value['queue'] == $this->queueName |
218 | 218 | && isset($value['status']) && $value['status'] == MongoQueue::STATUS_PENDING |
219 | 219 | && isset($value['scheduled']['$lte']) && $value['scheduled']['$lte'] instanceOf \MongoDB\BSON\UTCDateTime |
220 | - ; |
|
221 | - }), |
|
220 | + ; |
|
221 | + }), |
|
222 | 222 | |
223 | - $this->callback(function($value) { |
|
224 | - if (!array_key_exists('$set', $value)) { return false;} |
|
225 | - $value = $value['$set']; |
|
226 | - return isset($value['status']) && $value['status'] == MongoQueue::STATUS_RUNNING |
|
223 | + $this->callback(function($value) { |
|
224 | + if (!array_key_exists('$set', $value)) { return false;} |
|
225 | + $value = $value['$set']; |
|
226 | + return isset($value['status']) && $value['status'] == MongoQueue::STATUS_RUNNING |
|
227 | 227 | && array_key_exists('executed', $value) |
228 | - ; |
|
229 | - } |
|
230 | - ), |
|
228 | + ; |
|
229 | + } |
|
230 | + ), |
|
231 | 231 | |
232 | - $this->callback(function($value) { |
|
233 | - return |
|
232 | + $this->callback(function($value) { |
|
233 | + return |
|
234 | 234 | isset($value['sort']) && $value['sort'] == ['priority' => 1, 'scheduled' => 1] |
235 | 235 | && isset($value['returnDocument'])&&$value['returnDocument'] = \MongoDB\Operation\FindOneAndUpdate::RETURN_DOCUMENT_AFTER |
236 | - ; |
|
237 | - })) |
|
238 | - ->willReturn($envelope); |
|
236 | + ; |
|
237 | + })) |
|
238 | + ->willReturn($envelope); |
|
239 | 239 | |
240 | 240 | $actualJob = $this->target->pop(); |
241 | 241 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | public function testPopEmptyQueue() |
246 | 246 | { |
247 | 247 | $this->mongoCollectionMock->expects($this->once())->method('findOneAndUpdate') |
248 | - ->willReturn(null); |
|
248 | + ->willReturn(null); |
|
249 | 249 | |
250 | 250 | $actualJob = $this->target->pop(); |
251 | 251 | |
@@ -319,8 +319,8 @@ discard block |
||
319 | 319 | }; |
320 | 320 | |
321 | 321 | $this->mongoCollectionMock->expects($this->once())->method('find') |
322 | - ->with($filter, $opt) |
|
323 | - ->willReturn($cursor); |
|
322 | + ->with($filter, $opt) |
|
323 | + ->willReturn($cursor); |
|
324 | 324 | |
325 | 325 | $this->target->listing($options); |
326 | 326 | |
@@ -334,19 +334,19 @@ discard block |
||
334 | 334 | $job->setId(new \MongoDB\BSON\ObjectID()); |
335 | 335 | $options = ['message' => 'test failure message']; |
336 | 336 | $this->mongoCollectionMock->expects($this->once())->method('findOneAndUpdate') |
337 | - ->with( |
|
338 | - $this->equalTo(['_id' => new \MongoDB\BSON\ObjectID($job->getId())]), |
|
339 | - $this->callback(function($value) use ($options) { |
|
340 | - if (!array_key_exists('$set', $value)) { return false;} |
|
341 | - $value = $value['$set']; |
|
342 | - return isset($value['status']) && $value['status'] == MongoQueue::STATUS_FAILED |
|
337 | + ->with( |
|
338 | + $this->equalTo(['_id' => new \MongoDB\BSON\ObjectID($job->getId())]), |
|
339 | + $this->callback(function($value) use ($options) { |
|
340 | + if (!array_key_exists('$set', $value)) { return false;} |
|
341 | + $value = $value['$set']; |
|
342 | + return isset($value['status']) && $value['status'] == MongoQueue::STATUS_FAILED |
|
343 | 343 | && !array_key_exists('created', $value) |
344 | 344 | && !array_key_exists('scheduled', $value) |
345 | 345 | && isset($value['message']) && $value['message'] == $options['message'] |
346 | - ; |
|
347 | - } |
|
348 | - )) |
|
349 | - ->willReturn(null); |
|
346 | + ; |
|
347 | + } |
|
348 | + )) |
|
349 | + ->willReturn(null); |
|
350 | 350 | |
351 | 351 | $this->target->fail($job, $options); |
352 | 352 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | private $target = [ |
36 | 36 | MongoQueue::class, |
37 | 37 | 'setupArgs', |
38 | - '@testInheritance' => [ 'as_reflection' => true ], |
|
38 | + '@testInheritance' => ['as_reflection' => true], |
|
39 | 39 | '@testConstruction' => false, |
40 | 40 | '@testPushLazyWithStringName' => '#mockPush', |
41 | 41 | '@testPushLazyWithArraySpec' => '#mockPush', |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ] |
45 | 45 | ]; |
46 | 46 | |
47 | - private $inheritance = [ AbstractQueue::class ]; |
|
47 | + private $inheritance = [AbstractQueue::class]; |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * |
@@ -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(function($value) { |
190 | - if (!array_key_exists('$set', $value)) { return false;} |
|
190 | + if (!array_key_exists('$set', $value)) { return false; } |
|
191 | 191 | $value = $value['$set']; |
192 | 192 | return isset($value['tried']) && $value['tried'] == 10 |
193 | 193 | && !array_key_exists('created', $value) |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | }), |
222 | 222 | |
223 | 223 | $this->callback(function($value) { |
224 | - if (!array_key_exists('$set', $value)) { return false;} |
|
224 | + if (!array_key_exists('$set', $value)) { return false; } |
|
225 | 225 | $value = $value['$set']; |
226 | 226 | return isset($value['status']) && $value['status'] == MongoQueue::STATUS_RUNNING |
227 | 227 | && array_key_exists('executed', $value) |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $this->callback(function($value) { |
233 | 233 | return |
234 | 234 | isset($value['sort']) && $value['sort'] == ['priority' => 1, 'scheduled' => 1] |
235 | - && isset($value['returnDocument'])&&$value['returnDocument'] = \MongoDB\Operation\FindOneAndUpdate::RETURN_DOCUMENT_AFTER |
|
235 | + && isset($value['returnDocument']) && $value['returnDocument'] = \MongoDB\Operation\FindOneAndUpdate::RETURN_DOCUMENT_AFTER |
|
236 | 236 | ; |
237 | 237 | })) |
238 | 238 | ->willReturn($envelope); |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | /* @var AbstractJob $job2 */ |
260 | 260 | $job1 = new $this->testJobClass('TestJob1'); |
261 | 261 | $job2 = new $this->testJobClass('TestJob2'); |
262 | - $filter = [ 'queue' => $this->queueName ]; |
|
263 | - $opt = [ 'sort' => [ 'scheduled' => 1, 'priority' => 1 ] ]; |
|
262 | + $filter = ['queue' => $this->queueName]; |
|
263 | + $opt = ['sort' => ['scheduled' => 1, 'priority' => 1]]; |
|
264 | 264 | $envelopes = [ |
265 | 265 | [ |
266 | 266 | '_id' => $job1->getId(), |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | ], |
277 | 277 | ]; |
278 | 278 | $this->jobManagerMock->expects($this->exactly(2))->method('get') |
279 | - ->with($this->testJobClass)->will($this->returnCallback(function () { return new $this->testJobClass(); })); |
|
279 | + ->with($this->testJobClass)->will($this->returnCallback(function() { return new $this->testJobClass(); })); |
|
280 | 280 | |
281 | 281 | $cursor = new class($envelopes) { |
282 | 282 | private $envelopes; |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | $jobs = $this->target->listing(); |
294 | 294 | |
295 | 295 | $this->assertEquals(1, $cursor->called, "Cursor::toArray should have been called exactly one time, but was called '{$cursor->called}' times'"); |
296 | - $this->assertTrue(is_array($jobs), 'Return value should have been an array, but is "' . gettype($jobs) . '" instead."'); |
|
297 | - $this->assertTrue(2 == count($jobs), 'Only 2 jobs should have been returned, but it were ' . count($jobs)); |
|
296 | + $this->assertTrue(is_array($jobs), 'Return value should have been an array, but is "'.gettype($jobs).'" instead."'); |
|
297 | + $this->assertTrue(2 == count($jobs), 'Only 2 jobs should have been returned, but it were '.count($jobs)); |
|
298 | 298 | |
299 | 299 | $this->assertArrayHasKey('job', $jobs[0]); |
300 | 300 | $this->assertEquals($job1, $jobs[0]['job'], 'Job1 is not the same'); |
@@ -310,8 +310,8 @@ discard block |
||
310 | 310 | 'limit' => 10, |
311 | 311 | ]; |
312 | 312 | |
313 | - $filter = [ 'queue' => $this->queueName, 'status' => $options['status'] ]; |
|
314 | - $opt = [ 'sort' => [ 'scheduled' => 1, 'priority' => 1 ], 'limit' => $options['limit'] ]; |
|
313 | + $filter = ['queue' => $this->queueName, 'status' => $options['status']]; |
|
314 | + $opt = ['sort' => ['scheduled' => 1, 'priority' => 1], 'limit' => $options['limit']]; |
|
315 | 315 | |
316 | 316 | $this->jobManagerMock->expects($this->never())->method('get'); |
317 | 317 | $cursor = new class() { |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | ->with( |
338 | 338 | $this->equalTo(['_id' => new \MongoDB\BSON\ObjectID($job->getId())]), |
339 | 339 | $this->callback(function($value) use ($options) { |
340 | - if (!array_key_exists('$set', $value)) { return false;} |
|
340 | + if (!array_key_exists('$set', $value)) { return false; } |
|
341 | 341 | $value = $value['$set']; |
342 | 342 | return isset($value['status']) && $value['status'] == MongoQueue::STATUS_FAILED |
343 | 343 | && !array_key_exists('created', $value) |
@@ -27,5 +27,5 @@ |
||
27 | 27 | |
28 | 28 | private $target = RecoverableJobException::class; |
29 | 29 | |
30 | - private $inheritance = [ AbstractJobException::class ]; |
|
30 | + private $inheritance = [AbstractJobException::class]; |
|
31 | 31 | } |
@@ -27,5 +27,5 @@ |
||
27 | 27 | |
28 | 28 | private $target = FatalJobException::class; |
29 | 29 | |
30 | - private $inheritance = [ AbstractJobException::class ]; |
|
30 | + private $inheritance = [AbstractJobException::class]; |
|
31 | 31 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | '@testConstruction' => false, |
32 | 32 | ]; |
33 | 33 | |
34 | - private $inheritance = [ JobExceptionInterface::class, \RuntimeException::class ]; |
|
34 | + private $inheritance = [JobExceptionInterface::class, \RuntimeException::class]; |
|
35 | 35 | |
36 | 36 | public function provideConstructionTestData() |
37 | 37 | { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | public function testDoesDeleteJobIfProcessedSuccessfully() |
73 | 73 | { |
74 | - /* @var AbstractJob $jobMock */ |
|
74 | + /* @var AbstractJob $jobMock */ |
|
75 | 75 | $job = $this->prophesize(AbstractJob::class); |
76 | 76 | $job->execute()->willReturn(ProcessJobEvent::JOB_STATUS_SUCCESS); |
77 | 77 | $jobMock = $job->reveal(); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | { |
91 | 91 | $options = ['delay' => 10]; |
92 | 92 | |
93 | - /* @var AbstractJob $jobMock */ |
|
93 | + /* @var AbstractJob $jobMock */ |
|
94 | 94 | $job = $this->prophesize(AbstractJob::class); |
95 | 95 | $job->execute()->willThrow(new RecoverableJobException('test recoverable', $options)); |
96 | 96 | $jobMock = $job->reveal(); |
@@ -41,12 +41,12 @@ |
||
41 | 41 | private $target = [ |
42 | 42 | MongoWorker::class, |
43 | 43 | 'setupConstructorArgs', |
44 | - '@testInheritance' => [ 'as_reflection' => true ] |
|
44 | + '@testInheritance' => ['as_reflection' => true] |
|
45 | 45 | ]; |
46 | 46 | |
47 | 47 | private $eventsMock; |
48 | 48 | |
49 | - private $inheritance = [ AbstractWorker::class ]; |
|
49 | + private $inheritance = [AbstractWorker::class]; |
|
50 | 50 | |
51 | 51 | private function setupConstructorArgs() |
52 | 52 | { |
@@ -30,5 +30,5 @@ |
||
30 | 30 | 'as_reflection' => true, |
31 | 31 | ]; |
32 | 32 | |
33 | - private $inheritance = [ AbstractWorkerController::class ]; |
|
33 | + private $inheritance = [AbstractWorkerController::class]; |
|
34 | 34 | } |