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

feat(expressions): add date expression function

This commit is contained in:
Awilum
2022-07-11 13:45:10 +03:00
parent fbc61dbbe9
commit 076e22a415
2 changed files with 49 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<?php
use Flextype\Component\Filesystem\Filesystem;
use function Glowy\Filesystem\filesystem;
use function Flextype\entries;
beforeEach(function() {
filesystem()->directory(FLEXTYPE_PATH_PROJECT . '/entries')->create();
});
afterEach(function (): void {
filesystem()->directory(FLEXTYPE_PATH_PROJECT . '/entries')->delete();
});
test('date expression', function () {
$date = date("F j, Y, g:i a");
entries()->create('date', ['test' => '[[ date("F j, Y, g:i a") ]]']);
expect(entries()->fetch('date')['test'])->toBe($date);
});