Add slash test

This commit is contained in:
philipp lang 2021-09-13 01:18:40 +02:00
parent acf891f47a
commit b36455ff46
1 changed files with 16 additions and 0 deletions

View File

@ -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']]);