style updates
This commit is contained in:
+13
-14
@@ -40,7 +40,7 @@ abstract class DuskTestCase extends BaseTestCase
|
||||
*/
|
||||
protected function driver(): RemoteWebDriver
|
||||
{
|
||||
$options = (new ChromeOptions())->addArguments([
|
||||
$options = (new ChromeOptions)->addArguments([
|
||||
'--disable-gpu',
|
||||
'--headless=new',
|
||||
'--window-size=1920,1080',
|
||||
@@ -56,8 +56,8 @@ abstract class DuskTestCase extends BaseTestCase
|
||||
$_ENV['DUSK_DRIVER_URL'] ?? 'http://127.0.0.1:9515',
|
||||
DesiredCapabilities::chrome()->setCapability(
|
||||
ChromeOptions::CAPABILITY,
|
||||
$options
|
||||
)
|
||||
$options,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ abstract class DuskTestCase extends BaseTestCase
|
||||
|
||||
$_ENV['APP_URL'] = $url;
|
||||
$_SERVER['APP_URL'] = $url;
|
||||
putenv('APP_URL='.$url);
|
||||
putenv('APP_URL=' . $url);
|
||||
|
||||
if (property_exists(BaseTestCase::class, 'baseUrl')) {
|
||||
static::$baseUrl = $url;
|
||||
@@ -94,7 +94,7 @@ abstract class DuskTestCase extends BaseTestCase
|
||||
$fallbackUrl = 'http://127.0.0.1:8000';
|
||||
$_ENV['APP_URL'] = $fallbackUrl;
|
||||
$_SERVER['APP_URL'] = $fallbackUrl;
|
||||
putenv('APP_URL='.$fallbackUrl);
|
||||
putenv('APP_URL=' . $fallbackUrl);
|
||||
|
||||
if (property_exists(BaseTestCase::class, 'baseUrl')) {
|
||||
static::$baseUrl = $fallbackUrl;
|
||||
@@ -115,14 +115,14 @@ abstract class DuskTestCase extends BaseTestCase
|
||||
private static function startLaravelServer(string $host, int $port): void
|
||||
{
|
||||
$root = dirname(__DIR__);
|
||||
$logPath = $root.'/storage/logs/dusk-server.log';
|
||||
$logPath = $root . '/storage/logs/dusk-server.log';
|
||||
|
||||
if (! is_dir(dirname($logPath))) {
|
||||
@mkdir(dirname($logPath), 0775, true);
|
||||
}
|
||||
|
||||
$php = escapeshellarg(PHP_BINARY);
|
||||
$artisan = escapeshellarg($root.'/artisan');
|
||||
$artisan = escapeshellarg($root . '/artisan');
|
||||
$hostArg = escapeshellarg($host);
|
||||
$portArg = (string) $port;
|
||||
$log = escapeshellarg($logPath);
|
||||
@@ -157,7 +157,7 @@ abstract class DuskTestCase extends BaseTestCase
|
||||
usleep(100_000);
|
||||
} while (microtime(true) < $deadline);
|
||||
|
||||
$log = dirname(__DIR__).'/storage/logs/dusk-server.log';
|
||||
$log = dirname(__DIR__) . '/storage/logs/dusk-server.log';
|
||||
$hint = is_file($log) ? " Check {$log}." : '';
|
||||
|
||||
throw new \RuntimeException("{$service} is not reachable at {$host}:{$port}.{$hint}");
|
||||
@@ -171,8 +171,8 @@ abstract class DuskTestCase extends BaseTestCase
|
||||
*/
|
||||
private static function ensureChromeDriverBinaryAlias(): void
|
||||
{
|
||||
$binDirectory = dirname(__DIR__).'/vendor/laravel/dusk/bin';
|
||||
$expected = $binDirectory.'/chromedriver-mac-arm';
|
||||
$binDirectory = dirname(__DIR__) . '/vendor/laravel/dusk/bin';
|
||||
$expected = $binDirectory . '/chromedriver-mac-arm';
|
||||
|
||||
if (is_file($expected)) {
|
||||
@chmod($expected, 0755);
|
||||
@@ -185,18 +185,17 @@ abstract class DuskTestCase extends BaseTestCase
|
||||
}
|
||||
|
||||
$candidates = array_values(array_filter(
|
||||
glob($binDirectory.'/chromedriver*') ?: [],
|
||||
glob($binDirectory . '/chromedriver*') ?: [],
|
||||
static function (string $path) use ($expected): bool {
|
||||
return is_file($path)
|
||||
&& $path !== $expected
|
||||
&& ! str_ends_with($path, '.zip')
|
||||
&& ! str_ends_with($path, '.txt');
|
||||
}
|
||||
},
|
||||
));
|
||||
|
||||
usort($candidates, static function (string $left, string $right): int {
|
||||
$score = static fn (string $path): int =>
|
||||
str_contains($path, 'mac-arm64') ? 0
|
||||
$score = static fn (string $path): int => str_contains($path, 'mac-arm64') ? 0
|
||||
: (str_contains($path, 'mac-arm') ? 1
|
||||
: (str_contains($path, 'mac') ? 2 : 3));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user