17
17
18
18
use function app ;
19
19
use function json_encode ;
20
- use function now ;
21
20
22
21
class QueueTest extends TestCase
23
22
{
@@ -33,12 +32,7 @@ public function setUp(): void
33
32
public function testQueueJobLifeCycle (): void
34
33
{
35
34
$ uuid = Str::uuid ();
36
-
37
- Str::createUuidsUsing (
38
- function () use ($ uuid ) {
39
- return $ uuid ;
40
- },
41
- );
35
+ Str::createUuidsUsing (fn () => $ uuid );
42
36
43
37
$ id = Queue::push ('test ' , ['action ' => 'QueueJobLifeCycle ' ], 'test ' );
44
38
$ this ->assertNotNull ($ id );
@@ -47,22 +41,17 @@ function () use ($uuid) {
47
41
$ job = Queue::pop ('test ' );
48
42
$ this ->assertInstanceOf (MongoJob::class, $ job );
49
43
$ 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 ());
66
55
67
56
// Remove reserved job
68
57
$ job ->delete ();
@@ -207,7 +196,7 @@ public function testFailedJobLogging()
207
196
$ this ->assertSame ('test_connection ' , $ failedJob ['connection ' ]);
208
197
$ this ->assertSame ('test_queue ' , $ failedJob ['queue ' ]);
209
198
$ 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 ' ]);
211
200
$ this ->assertStringStartsWith ('Exception: test_exception in ' , $ failedJob ['exception ' ]);
212
201
}
213
202
}
0 commit comments