Skip to content

Commit

Permalink
feat: Install handles missing CreatesApplication trait
Browse files Browse the repository at this point in the history
Laravel 11+ apps may be missing file tests/CreatesApplication.php
because its code has been moved into the framework as method
Illuminate\Foundation\Testing\TestCase::createApplication().

Installing a new Dusk test case class stub will remove the
unneeded CreatesApplication reference.
  • Loading branch information
derekmd committed Oct 20, 2024
1 parent ef799cc commit abc2cda
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ public function handle()
return 1;
}

// Laravel 11+ apps may not define a CreatesApplication trait.
if (! trait_exists(\Tests\CreatesApplication::class)) {
file_put_contents($stubDestination, str_replace(
'use CreatesApplication, ',
'use ',
file_get_contents($stubDestination),
));
}

$this->info('Firefox scaffolding installed successfully.');

$this->comment('Downloading Geckodriver binaries...');
Expand Down

0 comments on commit abc2cda

Please sign in to comment.