Skip to content

Commit

Permalink
Move hasHeadlessDisabled() and shouldStartMaximized() to
Browse files Browse the repository at this point in the history
`Laravel\Dusk\TestCase`.

We don't typically change this configuration. It shouldn't be in the
stubs file.

Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Apr 16, 2024
1 parent c9edd39 commit 224cac5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 18 additions & 0 deletions src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
18 changes: 0 additions & 18 deletions stubs/DuskTestCase.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
}

0 comments on commit 224cac5

Please sign in to comment.