Skip to content

Commit 35d5ed2

Browse files
committed
Fix style
1 parent 77f76a1 commit 35d5ed2

File tree

2 files changed

+24
-40
lines changed

2 files changed

+24
-40
lines changed

src/Queue/Failed/MongoFailedJobProvider.php

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@ class MongoFailedJobProvider extends DatabaseFailedJobProvider
2525
*/
2626
public function log($connection, $queue, $payload, $exception)
2727
{
28-
$this->getTable()->insert(
29-
[
30-
'connection' => $connection,
31-
'queue' => $queue,
32-
'payload' => $payload,
33-
'failed_at' => new UTCDateTime(Carbon::now()),
34-
'exception' => (string) $exception,
35-
],
36-
);
28+
$this->getTable()->insert([
29+
'connection' => $connection,
30+
'queue' => $queue,
31+
'payload' => $payload,
32+
'failed_at' => new UTCDateTime(Carbon::now()),
33+
'exception' => (string) $exception,
34+
]);
3735
}
3836

3937
/**
@@ -45,14 +43,11 @@ public function all()
4543
{
4644
$all = $this->getTable()->orderBy('_id', 'desc')->get()->all();
4745

48-
$all = array_map(
49-
function ($job) {
50-
$job['id'] = (string) $job['_id'];
46+
$all = array_map(function ($job) {
47+
$job['id'] = (string) $job['_id'];
5148

52-
return (object) $job;
53-
},
54-
$all,
55-
);
49+
return (object) $job;
50+
}, $all);
5651

5752
return $all;
5853
}

tests/QueueTest.php

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
use function app;
1919
use function json_encode;
20-
use function now;
2120

2221
class QueueTest extends TestCase
2322
{
@@ -33,12 +32,7 @@ public function setUp(): void
3332
public function testQueueJobLifeCycle(): void
3433
{
3534
$uuid = Str::uuid();
36-
37-
Str::createUuidsUsing(
38-
function () use ($uuid) {
39-
return $uuid;
40-
},
41-
);
35+
Str::createUuidsUsing(fn () => $uuid);
4236

4337
$id = Queue::push('test', ['action' => 'QueueJobLifeCycle'], 'test');
4438
$this->assertNotNull($id);
@@ -47,22 +41,17 @@ function () use ($uuid) {
4741
$job = Queue::pop('test');
4842
$this->assertInstanceOf(MongoJob::class, $job);
4943
$this->assertEquals(1, $job->isReserved());
50-
$this->assertEquals(
51-
json_encode(
52-
[
53-
'uuid' => $uuid,
54-
'displayName' => 'test',
55-
'job' => 'test',
56-
'maxTries' => null,
57-
'maxExceptions' => null,
58-
'failOnTimeout' => false,
59-
'backoff' => null,
60-
'timeout' => null,
61-
'data' => ['action' => 'QueueJobLifeCycle'],
62-
],
63-
),
64-
$job->getRawBody(),
65-
);
44+
$this->assertEquals(json_encode([
45+
'uuid' => $uuid,
46+
'displayName' => 'test',
47+
'job' => 'test',
48+
'maxTries' => null,
49+
'maxExceptions' => null,
50+
'failOnTimeout' => false,
51+
'backoff' => null,
52+
'timeout' => null,
53+
'data' => ['action' => 'QueueJobLifeCycle'],
54+
]), $job->getRawBody());
6655

6756
// Remove reserved job
6857
$job->delete();
@@ -207,7 +196,7 @@ public function testFailedJobLogging()
207196
$this->assertSame('test_connection', $failedJob['connection']);
208197
$this->assertSame('test_queue', $failedJob['queue']);
209198
$this->assertSame('test_payload', $failedJob['payload']);
210-
$this->assertEquals(new UTCDateTime(now()), $failedJob['failed_at']);
199+
$this->assertEquals(new UTCDateTime(Carbon::now()), $failedJob['failed_at']);
211200
$this->assertStringStartsWith('Exception: test_exception in ', $failedJob['exception']);
212201
}
213202
}

0 commit comments

Comments
 (0)