1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-10 07:06:45 +02:00

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

This commit is contained in:
Awilum
2020-10-18 00:02:38 +03:00
parent a483ba6d23
commit 9eb88721b2

View File

@@ -0,0 +1,21 @@
<?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 CreatedByField', function () {
flextype('entries')->create('foo', []);
$created_by = flextype('entries')->fetch('foo')['created_by'];
$this->assertEquals('', $created_by);
flextype('entries')->create('bar', ['created_by' => 'Zed']);
$created_by = flextype('entries')->fetch('bar')['created_by'];
$this->assertEquals('Zed', $created_by);
});