@@ -60,8 +60,14 @@ public function testShouldCreateRootJobAndReturnIt()
60
60
61
61
$ this ->assertSame ($ job , $ result );
62
62
$ this ->assertEquals (Job::STATUS_NEW , $ job ->getStatus ());
63
- $ this ->assertEquals (new \DateTime (), $ job ->getCreatedAt (), '' , 1 );
64
- $ this ->assertEquals (new \DateTime (), $ job ->getStartedAt (), '' , 1 );
63
+ $ this ->assertEquals (
64
+ (new \DateTime ())->getTimestamp (),
65
+ $ job ->getCreatedAt ()->getTimestamp ()
66
+ );
67
+ $ this ->assertEquals (
68
+ (new \DateTime ())->getTimestamp (),
69
+ $ job ->getStartedAt ()->getTimestamp ()
70
+ );
65
71
$ this ->assertNull ($ job ->getStoppedAt ());
66
72
$ this ->assertEquals ('job-name ' , $ job ->getName ());
67
73
$ this ->assertEquals ('owner-id ' , $ job ->getOwnerId ());
@@ -183,7 +189,10 @@ public function testCreateChildJobShouldCreateAndSaveJobAndPublishRecalculateRoo
183
189
184
190
$ this ->assertSame ($ job , $ result );
185
191
$ this ->assertEquals (Job::STATUS_NEW , $ job ->getStatus ());
186
- $ this ->assertEquals (new \DateTime (), $ job ->getCreatedAt (), '' , 1 );
192
+ $ this ->assertEquals (
193
+ (new \DateTime ())->getTimestamp (),
194
+ $ job ->getCreatedAt ()->getTimestamp ()
195
+ );
187
196
$ this ->assertNull ($ job ->getStartedAt ());
188
197
$ this ->assertNull ($ job ->getStoppedAt ());
189
198
$ this ->assertEquals ('job-name ' , $ job ->getName ());
@@ -256,7 +265,10 @@ public function testStartJobShouldUpdateJobWithRunningStatusAndStartAtTime()
256
265
$ processor ->startChildJob ($ job );
257
266
258
267
$ this ->assertEquals (Job::STATUS_RUNNING , $ job ->getStatus ());
259
- $ this ->assertEquals (new \DateTime (), $ job ->getStartedAt (), '' , 1 );
268
+ $ this ->assertEquals (
269
+ (new \DateTime ())->getTimestamp (),
270
+ $ job ->getStartedAt ()->getTimestamp ()
271
+ );
260
272
}
261
273
262
274
public function testSuccessChildJobShouldThrowIfRootJob ()
@@ -325,7 +337,10 @@ public function testSuccessJobShouldUpdateJobWithSuccessStatusAndStopAtTime()
325
337
$ processor ->successChildJob ($ job );
326
338
327
339
$ this ->assertEquals (Job::STATUS_SUCCESS , $ job ->getStatus ());
328
- $ this ->assertEquals (new \DateTime (), $ job ->getStoppedAt (), '' , 1 );
340
+ $ this ->assertEquals (
341
+ (new \DateTime ())->getTimestamp (),
342
+ $ job ->getStoppedAt ()->getTimestamp ()
343
+ );
329
344
}
330
345
331
346
public function testFailChildJobShouldThrowIfRootJob ()
@@ -394,7 +409,10 @@ public function testFailJobShouldUpdateJobWithFailStatusAndStopAtTime()
394
409
$ processor ->failChildJob ($ job );
395
410
396
411
$ this ->assertEquals (Job::STATUS_FAILED , $ job ->getStatus ());
397
- $ this ->assertEquals (new \DateTime (), $ job ->getStoppedAt (), '' , 1 );
412
+ $ this ->assertEquals (
413
+ (new \DateTime ())->getTimestamp (),
414
+ $ job ->getStoppedAt ()->getTimestamp ()
415
+ );
398
416
}
399
417
400
418
public function testCancelChildJobShouldThrowIfRootJob ()
@@ -463,8 +481,14 @@ public function testCancelJobShouldUpdateJobWithCancelStatusAndStoppedAtTimeAndS
463
481
$ processor ->cancelChildJob ($ job );
464
482
465
483
$ this ->assertEquals (Job::STATUS_CANCELLED , $ job ->getStatus ());
466
- $ this ->assertEquals (new \DateTime (), $ job ->getStoppedAt (), '' , 1 );
467
- $ this ->assertEquals (new \DateTime (), $ job ->getStartedAt (), '' , 1 );
484
+ $ this ->assertEquals (
485
+ (new \DateTime ())->getTimestamp (),
486
+ $ job ->getStoppedAt ()->getTimestamp ()
487
+ );
488
+ $ this ->assertEquals (
489
+ (new \DateTime ())->getTimestamp (),
490
+ $ job ->getStartedAt ()->getTimestamp ()
491
+ );
468
492
}
469
493
470
494
public function testInterruptRootJobShouldThrowIfNotRootJob ()
@@ -536,7 +560,10 @@ public function testInterruptRootJobShouldUpdateJobAndSetInterruptedTrueAndStopp
536
560
$ processor ->interruptRootJob ($ rootJob , true );
537
561
538
562
$ this ->assertTrue ($ rootJob ->isInterrupted ());
539
- $ this ->assertEquals (new \DateTime (), $ rootJob ->getStoppedAt (), '' , 1 );
563
+ $ this ->assertEquals (
564
+ (new \DateTime ())->getTimestamp (),
565
+ $ rootJob ->getStoppedAt ()->getTimestamp ()
566
+ );
540
567
}
541
568
542
569
/**
0 commit comments