From 224cac524c8bb341250f9ded56400c0915ef0f53 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Tue, 16 Apr 2024 12:41:58 +0800 Subject: [PATCH] Move `hasHeadlessDisabled()` and `shouldStartMaximized()` to `Laravel\Dusk\TestCase`. We don't typically change this configuration. It shouldn't be in the stubs file. Signed-off-by: Mior Muhammad Zaki --- src/TestCase.php | 18 ++++++++++++++++++ stubs/DuskTestCase.stub | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/TestCase.php b/src/TestCase.php index 9f8535849..ade796381 100644 --- a/src/TestCase.php +++ b/src/TestCase.php @@ -69,6 +69,24 @@ protected function user() throw new Exception('User resolver has not been set.'); } + /** + * Determine whether the Dusk command has disabled headless mode. + */ + protected function hasHeadlessDisabled(): bool + { + return isset($_SERVER['DUSK_HEADLESS_DISABLED']) || + isset($_ENV['DUSK_HEADLESS_DISABLED']); + } + + /** + * Determine if the browser window should start maximized. + */ + protected function shouldStartMaximized(): bool + { + return isset($_SERVER['DUSK_START_MAXIMIZED']) || + isset($_ENV['DUSK_START_MAXIMIZED']); + } + /** * Determine if the tests are running within Laravel Sail. * diff --git a/stubs/DuskTestCase.stub b/stubs/DuskTestCase.stub index fc75a3d03..e144eb0c6 100644 --- a/stubs/DuskTestCase.stub +++ b/stubs/DuskTestCase.stub @@ -45,22 +45,4 @@ abstract class DuskTestCase extends BaseTestCase ) ); } - - /** - * Determine whether the Dusk command has disabled headless mode. - */ - protected function hasHeadlessDisabled(): bool - { - return isset($_SERVER['DUSK_HEADLESS_DISABLED']) || - isset($_ENV['DUSK_HEADLESS_DISABLED']); - } - - /** - * Determine if the browser window should start maximized. - */ - protected function shouldStartMaximized(): bool - { - return isset($_SERVER['DUSK_START_MAXIMIZED']) || - isset($_ENV['DUSK_START_MAXIMIZED']); - } }