'pages']]); Setting::set('sizes', []); Setting::set('breakpoints', []); $this->media->put('pages/test.jpg', UploadedFile::fake()->image('test.jpg', 100, 100)->get()); Artisan::call('resize:make'); $this->assertFileCount(1, 'pages'); } public function testItDeletesOtherFilesBeforeResizingAll() { Setting::set('folders', [['folder' => 'pages']]); Setting::set('sizes', []); Setting::set('breakpoints', []); Storage::put('uploads/public/c/otherdir/test.jpg', UploadedFile::fake()->image('test.jpg', 100, 100)->get()); Artisan::call('resize:make'); $this->assertFileCount(0, 'otherdir'); } public function testOnlyResizeASingleFolder() { Setting::set('folders', [ ['folder' => 'pages'], ['folder' => 'otherdir'], ]); Setting::set('sizes', []); Setting::set('breakpoints', []); $this->media->put('pages/test.jpg', UploadedFile::fake()->image('test.jpg', 100, 100)->get()); Storage::put('uploads/public/c/pages/test-100x100.jpg', UploadedFile::fake()->image('test.jpg', 100, 100)->get()); $this->media->put('otherdir/test.jpg', UploadedFile::fake()->image('test.jpg', 100, 100)->get()); Storage::put('uploads/public/c/otherdir/test-100x100.jpg', UploadedFile::fake()->image('test.jpg', 100, 100)->get()); Storage::put('uploads/public/c/otherdir/test-200x200.jpg', UploadedFile::fake()->image('test.jpg', 100, 100)->get()); Artisan::call('resize:make', ['-f' => 'pages']); $this->assertFileCount(2, 'otherdir'); $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'); } }