@@ -63,7 +63,6 @@ public function test_handles_missing_files_gracefully()
6363 $ this ->artisan ('files:delete-all ' )
6464 ->assertExitCode (0 );
6565 $ this ->assertFalse (File::exists ($ directory ) && count (File::files ($ directory )) > 0 );
66-
6766 }
6867
6968 public function test_handles_permission_errors_gracefully ()
@@ -79,49 +78,11 @@ public function test_handles_permission_errors_gracefully()
7978 $ this ->artisan ('files:delete-all ' );
8079
8180 // Ensure file still exists
82- $ this ->assertFileExists ($ filePath );
81+ chmod ($ filePath , 0775 );
82+ $ this ->assertTrue (File::exists ($ filePath ));
8383
8484 // Reset permissions
85- chmod ($ filePath , 0775 );
8685 File::delete ($ filePath );
8786 }
8887
89-
90- public function test_command_help_message ()
91- {
92- $ this ->artisan ('files:delete-all --help ' )
93- ->expectsOutputToContain ('Delete all files and folders recursively, skipping undeletable ones and logging them ' );
94- }
95-
96- public function test_deletes_only_specific_file_extensions ()
97- {
98- Storage::fake ();
99-
100- // Create multiple file types
101- Storage::put ('logs/app.log ' , 'Log content ' );
102- Storage::put ('logs/debug.txt ' , 'Debug content ' );
103-
104- // Run command with `--ext=log`
105- $ this ->artisan ('files:delete-all --ext=log ' );
106-
107- // Ensure only `.log` is deleted
108- $ this ->assertFalse (File::exists (storage_path ('app/logs/app.log ' )));
109- $ this ->assertTrue (File::exists (storage_path ('app/logs/debug.txt ' )));
110- }
111- public function test_deletes_directories ()
112- {
113- Storage::fake ();
114-
115- // Create multiple file types
116- Storage::put ('custom/logs/app.log ' , 'Log content ' );
117- Storage::put ('custom/app.log ' , 'Log content ' );
118-
119- // Run command with `--ext=log`
120- $ this ->artisan ('files:delete-all storage/app/custom/app.log --ext=log ' );
121-
122- // Ensure only `.log` is deleted
123- $ this ->assertFalse (File::exists (storage_path ('app/custom/logs/app.log ' )));
124- $ this ->assertFalse (File::exists (storage_path ('app/custom/app.log ' )));
125- $ this ->assertFalse (File::exists (storage_path ('app/custom ' )) && count (File::files (storage_path ('app/custom ' ))) > 0 );
126- }
12788}
0 commit comments