Skip to content

Commit

Permalink
Try restoring base controller after test.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspertey committed Nov 23, 2024
1 parent 3a1d541 commit 1e68e1d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/Generator/ControllerMakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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',
Expand Down

0 comments on commit 1e68e1d

Please sign in to comment.