Add test for deleting cache of old file
continuous-integration/drone/push Build is passing Details

This commit is contained in:
philipp lang 2021-12-27 02:21:32 +01:00
parent 425a6aa3be
commit a1d12b7df3
1 changed files with 18 additions and 0 deletions

View File

@ -48,6 +48,24 @@ class MoveTest extends TestCase
$this->assertHasFile('pages/testneu-200x300.jpg');
}
public function testitDeletesOldAndNewCacheWhenMoving()
{
Setting::set('folders', ['pages']);
Setting::set('sizes', []);
Setting::set('breakpoints', []);
$this->media->put('/pages/test.jpg', UploadedFile::fake()->image('test.jpg', 100, 100)->get());
UploadedFile::fake()->image(100, 100)->storeAs('uploads/public/c/pages', 'test-200x300.jpg', 'local');
Cache::tags(['resizer', 'resizer.pages/test.jpg'])->put('resizer.original.pages/test.jpg', 'AAA');
Cache::tags(['resizer', 'resizer.pages/testneu.jpg'])->put('resizer.original.pages/testneu.jpg', 'AAA');
Event::fire('media.file.rename', [null, '/pages/test.jpg', '/pages/testneu.jpg']);
$this->assertFileCount(1, 'pages');
$this->assertHasFile('pages/testneu-200x300.jpg');
$this->assertFalse(Cache::tags(['resizer', 'resizer.pages/test.jpg'])->has('resizer.original.pages/test.jpg'));
$this->assertFalse(Cache::tags(['resizer', 'resizer.pages/testneu.jpg'])->has('resizer.original.pages/test.jpg'));
}
public function testRenamePdfHeaderFile()
{
Setting::set('folders', ['pages']);