diff --git a/tests/ResizerTest.php b/tests/ResizerTest.php index 4b4430c..327fa2c 100644 --- a/tests/ResizerTest.php +++ b/tests/ResizerTest.php @@ -48,6 +48,22 @@ class ResizerTest extends TestCase $this->assertHasFile('pages/test-500x600.jpg'); } + public function testCopyOriginalFileWithoutSizesWhenFilenameDoesntBeginWithASlash(): void + { + Setting::set('folders', [['folder' => '/pages']]); + Setting::set('sizes', []); + Setting::set('breakpoints', []); + + $file = UploadedFile::fake()->image('test.jpg', 500, 600); + $media = MediaLibrary::instance(); + $media->put('/pages/test.jpg', $file->get()); + Event::fire('media.file.upload', [null, 'pages/test.jpg', null]); + + $this->assertFileCount(2, 'pages'); + $this->assertHasFile('pages/test.jpg'); + $this->assertHasFile('pages/test-500x600.jpg'); + } + public function testCopyTwoDirectoriesDeepButNotAnotherDirectory(): void { Setting::set('folders', [['folder' => '/pages']]);