Skip to content

Commit

Permalink
test(unit) mock Chromedriver zip file existence correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
lucatume committed Aug 1, 2024
1 parent 6a45900 commit bfc179b
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ public function should_throw_if_download_url_for_chrome_version_cannot_be_found_
public function should_throw_if_existing_zip_file_cannot_be_removed(): void
{
$this->setFunctionReturn('sys_get_temp_dir', codecept_output_dir());
$this->setFunctionReturn('is_file', function (string $file): bool {
return preg_match('~chromedriver\\.zip$~', $file) ? true : is_file($file);
},true);
$this->setFunctionReturn('unlink', function (string $file): bool {
return preg_match('~chromedriver\\.zip$~', $file) ? false : unlink($file);
}, true);
Expand Down

0 comments on commit bfc179b

Please sign in to comment.