Skip to content

Commit

Permalink
Merge pull request #644 from staudenmeir/chromedriver
Browse files Browse the repository at this point in the history
[5.0] Adjust ChromeDriver command to beta releases
  • Loading branch information
taylorotwell authored May 1, 2019
2 parents 3cf0e79 + 2687519 commit 393d984
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/Console/ChromeDriverCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ class ChromeDriverCommand extends Command
protected $description = 'Install the ChromeDriver binary';

/**
* URL to the index page.
* URL to the home page.
*
* @var string
*/
protected $indexUrl = 'https://chromedriver.storage.googleapis.com';
protected $homeUrl = 'http://chromedriver.chromium.org/home';

/**
* URL to the latest release version.
Expand Down Expand Up @@ -136,18 +136,18 @@ protected function version()
{
$version = $this->argument('version');

if ($version) {
if (! ctype_digit($version)) {
return $version;
}
if (! $version) {
return $this->latestVersion();
}

if (! ctype_digit($version)) {
return $version;
}

$version = (int) $version;
$version = (int) $version;

if ($version < 70) {
return $this->legacyVersions[$version];
}
} else {
$version = $this->latestChromeVersion();
if ($version < 70) {
return $this->legacyVersions[$version];
}

return trim(file_get_contents(
Expand All @@ -156,17 +156,17 @@ protected function version()
}

/**
* Get the latest major Chrome version.
* Get the latest stable ChromeDriver version.
*
* @return int
* @return string
*/
protected function latestChromeVersion()
protected function latestVersion()
{
$index = file_get_contents($this->indexUrl);
$home = file_get_contents($this->homeUrl);

preg_match('#.*<Key>LATEST_RELEASE_(\d+)</Key>#', $index, $matches);
preg_match('/Latest stable release:.*?\?path=([\d.]+)/', $home, $matches);

return (int) $matches[1];
return $matches[1];
}

/**
Expand Down

0 comments on commit 393d984

Please sign in to comment.