1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-09 06:36:52 +02:00

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

This commit is contained in:
Awilum
2020-10-18 00:02:26 +03:00
parent 163394daa8
commit a483ba6d23

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 IdFieldTest', function () {
flextype('entries')->create('foo', []);
$id = flextype('entries')->fetch('foo')['id'];
$this->assertEquals('foo', $id);
flextype('entries')->create('foo/bar', []);
$id = flextype('entries')->fetch('foo/bar')['id'];
$this->assertEquals('foo/bar', $id);
});