Add test for moving PDF header file

This commit is contained in:
Philipp Lang 2021-09-17 15:11:50 +00:00
parent 2c3400715c
commit d5fecfea1a
1 changed files with 14 additions and 0 deletions

View File

@ -48,6 +48,20 @@ class MoveTest extends TestCase
$this->assertHasFile('pages/testneu-200x300.jpg'); $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() public function testItDoesntMoveOtherFilesInTheSameDirectory()
{ {
Cache::tags(['resizer', 'resizer.pages/test.jpg'])->set('resizer.original.pages/test.jpg', 'aa'); Cache::tags(['resizer', 'resizer.pages/test.jpg'])->set('resizer.original.pages/test.jpg', 'aa');