media = MediaLibrary::instance(); } public function testDontRenameFolderIfSluggingIsNotNeeded(): void { $file = UploadedFile::fake()->image('test.jpg', 500, 600); $this->media->makeFolder('testbb'); Event::fire('media.folder.create', [null, '//testbb', null]); Storage::disk('local')->assertExists('media/testbb'); } public function testRenameFolder(): void { $file = UploadedFile::fake()->image('test.jpg', 500, 600); $this->media->makeFolder('test bb'); Event::fire('media.folder.create', [null, '//test bb', null]); Storage::disk('local')->assertExists('media/test-bb'); Storage::disk('local')->assertMissing('media/test bb'); } public function testRenameSubfolder(): void { $file = UploadedFile::fake()->image('test.jpg', 500, 600); $this->media->makeFolder('test/aa bb'); Event::fire('media.folder.create', [null, '/test/aa bb', null]); Storage::disk('local')->assertExists('media/test/aa-bb'); } public function testRenameSubfolderWithDoubleSlash(): void { $file = UploadedFile::fake()->image('test.jpg', 500, 600); $this->media->makeFolder('test/aa bb'); Event::fire('media.folder.create', [null, '//test/aa bb', null]); Storage::disk('local')->assertExists('media/test/aa-bb'); } }