From 1e68e1de555b0d217349ffc568fae662073286f7 Mon Sep 17 00:00:00 2001 From: Jasper Tey Date: Fri, 22 Nov 2024 21:17:23 -0500 Subject: [PATCH] Try restoring base controller after test. --- tests/Generator/ControllerMakeTest.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/Generator/ControllerMakeTest.php b/tests/Generator/ControllerMakeTest.php index 86f41e8..77b57fc 100644 --- a/tests/Generator/ControllerMakeTest.php +++ b/tests/Generator/ControllerMakeTest.php @@ -209,8 +209,10 @@ // Remove the base controller $baseControllerPath = app_path('Http/Controllers/Controller.php'); + $originalBaseControllerContent = null; if (file_exists($baseControllerPath)) { + $originalBaseControllerContent = file_get_contents($baseControllerPath); unlink($baseControllerPath); } @@ -228,6 +230,11 @@ expect($contents) ->not->toContain("use App\Http\Controllers\Controller;") ->not->toContain('extends Controller'); + + // Restore the base controller + if ($originalBaseControllerContent) { + file_put_contents($baseControllerPath, $originalBaseControllerContent); + } })->with([ 'Invoicing:InvoiceController' => [ 'Invoicing',