From d5fecfea1a0d1338ad1410165f75dd40121d9ef1 Mon Sep 17 00:00:00 2001 From: Philipp Lang Date: Fri, 17 Sep 2021 15:11:50 +0000 Subject: [PATCH] Add test for moving PDF header file --- tests/MoveTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/MoveTest.php b/tests/MoveTest.php index cd70d16..7057553 100644 --- a/tests/MoveTest.php +++ b/tests/MoveTest.php @@ -48,6 +48,20 @@ class MoveTest extends TestCase $this->assertHasFile('pages/testneu-200x300.jpg'); } + public function testRenamePdfHeaderFile() + { + Setting::set('folders', ['pages']); + Setting::set('sizes', []); + Setting::set('breakpoints', []); + $this->media->put('/pages/test.pdf', file_get_contents(__DIR__.'/stub/dummy.pdf')); + UploadedFile::fake()->image(100, 100)->storeAs('uploads/public/c/pages', 'test-200x300.pdf.jpg', 'local'); + + Event::fire('media.file.rename', [null, '/pages/test.pdf', '/pages/testneu.pdf']); + + $this->assertFileCount(1, 'pages'); + $this->assertHasFile('pages/testneu-200x300.pdf.jpg'); + } + public function testItDoesntMoveOtherFilesInTheSameDirectory() { Cache::tags(['resizer', 'resizer.pages/test.jpg'])->set('resizer.original.pages/test.jpg', 'aa');