Skip to content

Commit

Permalink
Merge branch '1.x' into 2.x
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Jul 27, 2023
2 parents 8b1dbb2 + 2363165 commit ab72e41
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG-1.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

This changelog references the relevant changes (bug and security fixes) done to `orchestra/dusk-updater`.

## 1.7.1

Released: 2023-07-27

### Fixes

* Normalize directory separator when renaming ChromeDriver binary.

## 1.7.0

Released: 2023-07-22
Expand Down
2 changes: 1 addition & 1 deletion src/Concerns/DetectsChromeVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function findVersionUrl(?string $version): string
$milestones = $this->resolveChromeVersionsPerMilestone();

return $milestones['milestones'][$version]['version']
?? throw new Exception('Could not get the ChromeDriver version.');
?? throw new Exception('Could not determine the ChromeDriver version.');
}

/**
Expand Down
10 changes: 7 additions & 3 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
*/
function rename_chromedriver_binary(string $binary, string $operatingSystem): string
{
return mb_strpos($binary, DIRECTORY_SEPARATOR) > 0
? array_reverse(explode(DIRECTORY_SEPARATOR, str_replace('chromedriver', 'chromedriver-'.$operatingSystem, $binary), 2))[0]
: str_replace('chromedriver', 'chromedriver-'.$operatingSystem, $binary);
$binary = str_replace(DIRECTORY_SEPARATOR, '/', $binary);

if (mb_strpos($binary, '/') > 0) {
return array_reverse(explode('/', str_replace('chromedriver', 'chromedriver-'.$operatingSystem, $binary), 2))[0];
}

return str_replace('chromedriver', 'chromedriver-'.$operatingSystem, $binary);
}

/**
Expand Down
7 changes: 4 additions & 3 deletions tests/HelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ public static function chromedriverBinaryFilenameDataProvider()
yield ['mac-arm', 'chromedriver', 'chromedriver-mac-arm'];
yield ['win', 'chromedriver.exe', 'chromedriver-win.exe'];

yield ['linux', 'chromedriver-115'.DIRECTORY_SEPARATOR.'chromedriver', 'chromedriver-linux'];
yield ['mac-intel', 'chromedriver-115'.DIRECTORY_SEPARATOR.'chromedriver', 'chromedriver-mac-intel'];
yield ['mac-arm', 'chromedriver-115'.DIRECTORY_SEPARATOR.'chromedriver', 'chromedriver-mac-arm'];
yield ['linux', 'chromedriver-115/chromedriver', 'chromedriver-linux'];
yield ['mac-intel', 'chromedriver-115/chromedriver', 'chromedriver-mac-intel'];
yield ['mac-arm', 'chromedriver-115/chromedriver', 'chromedriver-mac-arm'];
yield ['win', 'chromedriver-115/chromedriver.exe', 'chromedriver-win.exe'];
yield ['win', 'chromedriver-115'.DIRECTORY_SEPARATOR.'chromedriver.exe', 'chromedriver-win.exe'];
}
}

0 comments on commit ab72e41

Please sign in to comment.