From 93c34f7db93e2ac94d2a7921947f55fb97fc8950 Mon Sep 17 00:00:00 2001 From: Awilum Date: Mon, 19 Oct 2020 11:42:38 +0300 Subject: [PATCH] feat(tests): add tests for MediaFilesMeta add() method #477 --- tests/Foundation/Media/MediaFilesMetaTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/Foundation/Media/MediaFilesMetaTest.php b/tests/Foundation/Media/MediaFilesMetaTest.php index 01b646ce..97b3e9f6 100644 --- a/tests/Foundation/Media/MediaFilesMetaTest.php +++ b/tests/Foundation/Media/MediaFilesMetaTest.php @@ -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']); +});