From 32fb7c7759bb1c9fc72871f036b5214a2260772e Mon Sep 17 00:00:00 2001 From: Derek Date: Sun, 20 Oct 2024 15:16:22 -0400 Subject: [PATCH] feat: Install handles missing CreatesApplication trait 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. --- src/Console/InstallCommand.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php index 3936ec6..3b594f8 100644 --- a/src/Console/InstallCommand.php +++ b/src/Console/InstallCommand.php @@ -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...');