Fixed: Clean folder when deleting single folder
This commit is contained in:
parent
58d4f260da
commit
6b0ab3182c
|
@ -51,6 +51,7 @@ class ResizeMake extends Command
|
|||
|
||||
if ($this->option('folder')) {
|
||||
throw_unless(in_array($this->option('folder'), array_column(Setting::get('folders'), 'folder')), Exception::class, 'Folder not found');
|
||||
Storage::deleteDirectory('uploads/public/c'.$this->option('folder'));
|
||||
$this->resize($this->option('folder'));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -63,4 +63,19 @@ class ResizeMakeTest extends TestCase
|
|||
$this->assertFileCount(1, 'pages');
|
||||
}
|
||||
|
||||
public function testCleanSingleFolderBeforeResizing()
|
||||
{
|
||||
Setting::set('folders', [
|
||||
['folder' => '/pages'],
|
||||
['folder' => 'otherdir'],
|
||||
]);
|
||||
Setting::set('sizes', []);
|
||||
Setting::set('breakpoints', []);
|
||||
Storage::put('uploads/public/c/pages/test-100x100.jpg', UploadedFile::fake()->image('test.jpg', 100, 100)->get());
|
||||
|
||||
Artisan::call('resize:make', ['-f' => '/pages']);
|
||||
|
||||
$this->assertFileCount(0, 'pages');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue