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

feat(tests): add tests for MediaFilesMeta add() method #477

This commit is contained in:
Awilum
2020-10-19 11:42:38 +03:00
parent 357bf438af
commit 93c34f7db9

View File

@@ -19,3 +19,11 @@ test('test update() method', function () {
$this->assertTrue(flextype('media_files_meta')->update('foo.txt', 'description', 'Foo description'));
$this->assertEquals('Foo description', flextype('yaml')->decode(flextype('filesystem')->file(PATH['project'] . '/uploads/.meta/foo.txt.yaml')->get())['description']);
});
test('test add() method', function () {
flextype('filesystem')->file(PATH['project'] . '/uploads/foo.txt')->put('foo');
flextype('filesystem')->file(PATH['project'] . '/uploads/.meta/foo.txt.yaml')->put(flextype('yaml')->encode(['title' => 'Foo', 'description' => '', 'type' => 'text/plain', 'filesize' => 3, 'uploaded_on' => 1603090370, 'exif' => []]));
$this->assertTrue(flextype('media_files_meta')->add('foo.txt', 'bar', 'Bar'));
$this->assertEquals('Bar', flextype('yaml')->decode(flextype('filesystem')->file(PATH['project'] . '/uploads/.meta/foo.txt.yaml')->get())['bar']);
});