Skip to content

Commit

Permalink
Fix for laravel 10.
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperTey committed Nov 23, 2024
1 parent b404fb6 commit 29a328b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/Commands/DomainControllerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected function buildClass($name)
$replace = [];

$appRootNamespace = $this->laravel->getNamespace();
$pathToAppBaseController = parent::getPath("Http\Controllers\Controller");
$pathToAppBaseController = app_path('Http/Controllers/Controller.php');

$baseControllerExists = $this->files->exists($pathToAppBaseController);

Expand Down
18 changes: 4 additions & 14 deletions tests/Generator/ControllerMakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,8 @@

expect($contents)
->toContain("namespace {$expectedNamespace};")
->toContain("use App\Http\Controllers\Controller;")
->toContain("use App\Http\Controllers\Controller;".PHP_EOL."use Illuminate\Http\Request;")
->toContain('extends Controller');

// if (Feature::Laravel11->exists()) {
// // These assertions don't seem to pass on Laravel 10
// expect($contents)
// ->toContain("use App\Http\Controllers\Controller;")
// ->toContain('extends Controller');
// }
})->with([
'Invoicing:InvoiceController' => [
'Invoicing',
Expand Down Expand Up @@ -232,12 +225,9 @@
expect($contents = file_get_contents($expectedPath))
->toContain("namespace {$expectedNamespace};");

if (Feature::Laravel11->exists()) {
// These assertions don't seem to pass on Laravel 10
expect($contents)
->not->toContain("use App\Http\Controllers\Controller;")
->not->toContain('extends Controller');
}
expect($contents)
->not->toContain("use App\Http\Controllers\Controller;")
->not->toContain('extends Controller');
})->with([
'Invoicing:InvoiceController' => [
'Invoicing',
Expand Down

0 comments on commit 29a328b

Please sign in to comment.