From ed9408f7f58c048fc91dbf57d6240ebd9e077bdd Mon Sep 17 00:00:00 2001 From: Awilum Date: Mon, 19 Oct 2020 20:10:29 +0300 Subject: [PATCH] feat(tests): add tests for MediaFiles move() method #477 --- tests/Foundation/Media/MediaFilesTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/Foundation/Media/MediaFilesTest.php b/tests/Foundation/Media/MediaFilesTest.php index 71097422..6ec84c9e 100644 --- a/tests/Foundation/Media/MediaFilesTest.php +++ b/tests/Foundation/Media/MediaFilesTest.php @@ -41,3 +41,12 @@ test('test fetchCollection() method', function () { $this->assertTrue(count(flextype('media_files')->fetchCollection('/')) == 2); $this->assertEquals('Foo', flextype('media_files')->fetchCollection('/')['foo.txt']['title']); }); + +test('test move() 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')->move('foo.txt', 'bar.txt')); + $this->assertTrue(flextype('media_files')->move('bar.txt', 'foo.txt')); + $this->assertFalse(flextype('media_files')->move('bar.txt', 'foo.txt')); +});