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

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

This commit is contained in:
Awilum
2020-10-19 12:21:55 +03:00
parent 2f842f3d24
commit 4c41662ee6

View File

@@ -27,3 +27,11 @@ test('test add() method', function () {
$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']);
});
test('test delete() 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')->delete('foo.txt', 'title'));
$this->assertTrue(empty(flextype('yaml')->decode(flextype('filesystem')->file(PATH['project'] . '/uploads/.meta/foo.txt.yaml')->get())['bar']));
});