1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-08 14:16:46 +02:00

feat(tests): add tests for entry ModifiedAtField #477

This commit is contained in:
Awilum
2020-10-18 00:09:20 +03:00
parent 25d260b600
commit 092bf5962d

View File

@@ -0,0 +1,20 @@
<?php
use Flextype\Component\Filesystem\Filesystem;
beforeEach(function() {
filesystem()->directory(PATH['project'] . '/entries')->create();
});
afterEach(function (): void {
filesystem()->directory(PATH['project'] . '/entries')->delete();
});
test('test ModifiedAtField', function () {
flextype('entries')->create('foo', []);
$modified_at = flextype('entries')->fetch('foo')['modified_at'];
$this->assertTrue(strlen($modified_at) > 0);
$this->assertTrue((ctype_digit($modified_at) && strtotime(date('Y-m-d H:i:s', $modified_at)) === (int)$modified_at));
});