Skip to content

Commit

Permalink
test: add test to download browser in other path
Browse files Browse the repository at this point in the history
  • Loading branch information
asciito committed Oct 20, 2023
1 parent f49ccef commit de8e84f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/Commands/InstallBrowserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function handle(): int

$dir = dirname($filename);

$this->message("Google Chrome Browser unzip on [$dir]", 'info');
$this->message("Google Chrome Browser unzip it on [$dir]", 'info');
} catch (\Throwable $e) {
Log::error($e->getMessage());

Expand Down
23 changes: 22 additions & 1 deletion tests/Feature/InstallBrowserCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,29 @@
});

it('download the browser on other path', function () {
Http::fake();
File::partialMock()
->shouldReceive('append')
->andReturn(true);

})->todo();
$google = GoogleForTesting::partialMock();
$downloadable = Mockery::mock(GoogleDownloadable::class);

$downloadable->shouldReceive('getVersion')
->andReturn('200.0.0.0');

$downloadable->shouldReceive('download');

$google->shouldReceive('getLatestVersion')
->andReturn($downloadable);

artisan('install:browser --latest --path=/some/dir/to/download')
->doesntExpectOutputToContain("There' no versions available for [200.0.0.0]")
->expectsOutputToContain('Downloading Google Chrome Browser [200.0.0.0]')
->expectsOutputToContain('Google Chrome Browser [200.0.0.0] downloaded')
->expectsOutputToContain("Google Chrome Browser unzip it on [/some/dir/to/download]")
->assertSuccessful();
});

it('try to download a pre-existing browser version', function () {

Expand Down

0 comments on commit de8e84f

Please sign in to comment.