File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed
tests/TestCase/Model/Behavior Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change 19
19
use Cake \ORM \Entity ;
20
20
use Cake \ORM \TableRegistry ;
21
21
use Cake \TestSuite \TestCase ;
22
+ use Cake \Utility \Time ;
22
23
23
24
/**
24
25
* Behavior test case
@@ -213,10 +214,8 @@ public function testGetTimestamp() {
213
214
'Should return a timestamp object '
214
215
);
215
216
216
- $ now = time ();
217
- $ ts = $ return ->getTimestamp ();
218
-
219
- $ this ->assertLessThan (3 , abs ($ now - $ ts ), "Timestamp is expected to within 3 seconds of the current timestamp " );
217
+ $ now = Time::now ();
218
+ $ this ->assertEquals ($ now , $ return );
220
219
221
220
return $ this ->Behavior ;
222
221
}
@@ -374,12 +373,8 @@ public function testSaveTriggersInsert() {
374
373
375
374
$ row = $ table ->find ('all ' )->where (['id ' => $ entity ->id ])->first ();
376
375
377
- $ now = time ();
378
-
379
- $ storedValue = $ row ->created ->getTimestamp ();
380
- $ this ->assertLessThan (3 , abs ($ storedValue - $ now ), "The stored created timestamp is expected to within 3 seconds of the current timestamp " );
381
-
382
- $ storedValue = $ row ->updated ->getTimestamp ();
383
- $ this ->assertLessThan (3 , abs ($ storedValue - $ now ), "The stored updated timestamp is expected to within 3 seconds of the current timestamp " );
376
+ $ now = Time::now ();
377
+ $ this ->assertEquals ($ now , $ row ->created );
378
+ $ this ->assertEquals ($ now , $ row ->updated );
384
379
}
385
380
}
You can’t perform that action at this time.
0 commit comments