From cd6628f9b6bab55a380cac25841889cb32c23e1d Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Fri, 28 Jun 2024 17:39:26 +0800 Subject: [PATCH 1/4] wip Signed-off-by: Mior Muhammad Zaki --- composer.json | 4 ++-- src/DuskServer.php | 26 +++++++++++++------------- tests/Browser/WorkbenchTest.php | 1 - workbench/routes/api.php | 4 +++- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index 136762e..14ce40a 100644 --- a/composer.json +++ b/composer.json @@ -42,8 +42,8 @@ "laravel/dusk": "^8.1", "laravel/serializable-closure": "^1.0", "orchestra/dusk-updater": "^2.4", - "orchestra/testbench": "^9.1.1", - "orchestra/testbench-core": ">=9.1.2 <9.2.0", + "orchestra/testbench": "^9.1.2", + "orchestra/testbench-core": ">=9.1.3 <9.2.0", "php-webdriver/webdriver": "^1.15.1", "symfony/polyfill-php83": "^1.28" }, diff --git a/src/DuskServer.php b/src/DuskServer.php index 3d94ca6..a5cec7b 100644 --- a/src/DuskServer.php +++ b/src/DuskServer.php @@ -2,8 +2,6 @@ namespace Orchestra\Testbench\Dusk; -use Illuminate\Support\ProcessUtils; -use Laravel\Dusk\OperatingSystem; use Orchestra\Testbench\Dusk\Exceptions\UnableToStartServer; use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\Process; @@ -182,7 +180,7 @@ protected function startServer(): void { $this->guardServerStarting(); - $this->process = Process::fromShellCommandline( + $this->process = new Process( command: $this->prepareCommand(), cwd: join_paths($this->basePath(), 'public'), env: array_merge(defined_environment_variables(), [ @@ -224,18 +222,20 @@ protected function guardServerStarting(): void /** * Prepare the command for starting the PHP server. * - * @return string + * @internal + * + * @return array */ - protected function prepareCommand(): string + protected function prepareCommand(): array { - return sprintf( - ((OperatingSystem::onWindows() ? '' : 'exec ').'%s -S %s:%s %s -t %s'), - ProcessUtils::escapeArgument((string) (new PhpExecutableFinder())->find(false)), - $this->host, - $this->port, - ProcessUtils::escapeArgument(join_paths(__DIR__, 'server.php')), - ProcessUtils::escapeArgument(join_paths($this->basePath(), 'public')), - ); + return [ + (string) (new PhpExecutableFinder())->find(false), + '-S', + sprintf('%s:%s', $this->host, $this->port), + __DIR__.'/server.php', + '-t', + "{$this->basePath()}/public", + ]; } /** diff --git a/tests/Browser/WorkbenchTest.php b/tests/Browser/WorkbenchTest.php index 1f62d34..a6cb313 100644 --- a/tests/Browser/WorkbenchTest.php +++ b/tests/Browser/WorkbenchTest.php @@ -3,7 +3,6 @@ namespace Orchestra\Testbench\Dusk\Tests\Browser; use Illuminate\Contracts\Http\Kernel as HttpKernel; -use Laravel\Dusk\Browser; use Orchestra\Testbench\Attributes\RequiresLaravel; use Orchestra\Testbench\Attributes\WithEnv; use Orchestra\Testbench\Concerns\WithWorkbench; diff --git a/workbench/routes/api.php b/workbench/routes/api.php index 80d19e3..4e291a1 100644 --- a/workbench/routes/api.php +++ b/workbench/routes/api.php @@ -13,6 +13,8 @@ | */ -Route::get('/hello', function () { +Route::get('api/hello', function () { return response()->json('hello world'); }); + +Route::get('api/failed', fn () => throw new RuntimeException('Bad route!')); From 099bd200576f1c9011272b05edbeb070607f604d Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Fri, 28 Jun 2024 17:43:30 +0800 Subject: [PATCH 2/4] wip Signed-off-by: Mior Muhammad Zaki --- src/DuskServer.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/DuskServer.php b/src/DuskServer.php index a5cec7b..8710f0b 100644 --- a/src/DuskServer.php +++ b/src/DuskServer.php @@ -222,8 +222,6 @@ protected function guardServerStarting(): void /** * Prepare the command for starting the PHP server. * - * @internal - * * @return array */ protected function prepareCommand(): array From 3ad956f88f6f67ac984c8ca5e2c55e5acce0815c Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Fri, 28 Jun 2024 17:45:29 +0800 Subject: [PATCH 3/4] Prepare 9.3.1 release Signed-off-by: Mior Muhammad Zaki --- CHANGELOG-9.x.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG-9.x.md b/CHANGELOG-9.x.md index 02dd46d..ca7f373 100644 --- a/CHANGELOG-9.x.md +++ b/CHANGELOG-9.x.md @@ -2,6 +2,16 @@ This changelog references the relevant changes (bug and security fixes) done to `orchestra/testbench-dusk`. +## 9.3.1 + +Released: 2024-06-28 + +### Changes + +* Update minimum support for Testbench v9.1.2+. ([v9.1.1...v9.1.2](https://github.com/orchestral/testbench/compare/v9.1.1...v9.1.2)) +* Update minimum support for Testbench Core v9.1.3+. ([v9.1.2...v9.1.3](https://github.com/orchestral/testbench-core/compare/v9.1.2...v9.1.3)) +* Provide Process's `$commandline` as `array` to leverage `proc_open()` on Symfony Process 7.1. + ## 9.3.0 Released: 2024-06-02 From e173ba71cff9534a1de6ba7d3b39b8729349eb8c Mon Sep 17 00:00:00 2001 From: crynobone Date: Wed, 10 Jul 2024 00:48:17 +0000 Subject: [PATCH 4/4] Update Skeleton --- laravel/.env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/.env.example b/laravel/.env.example index 8d53585..3cdfb37 100644 --- a/laravel/.env.example +++ b/laravel/.env.example @@ -10,7 +10,7 @@ APP_FALLBACK_LOCALE=en APP_FAKER_LOCALE=en_US APP_MAINTENANCE_DRIVER=file -APP_MAINTENANCE_STORE=database +# APP_MAINTENANCE_STORE=database BCRYPT_ROUNDS=12