Skip to content

Commit

Permalink
remove error when sidecar class doesn’t exist
Browse files Browse the repository at this point in the history
  • Loading branch information
d8vjork committed Dec 11, 2023
1 parent 869e207 commit b95fed4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}
],
"require": {
"php": "^8.1 || ^8.2",
"php": "^8.1",
"hammerstone/sidecar": "^0.4",
"illuminate/console": "^10.0",
"illuminate/filesystem": "^10.0",
Expand Down
6 changes: 0 additions & 6 deletions src/Commands/DeployLocal.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ public function __construct(protected Filesystem $filesystem)
*/
public function handle(): int
{
if (! class_exists('Hammerstone\Sidecar\Sidecar')) {
$this->error('You must first install hammerstone/sidecar composer package.');

return 1;
}

if (config('sidecar.env') !== 'local') {
$this->error('Make sure you have sidecar.env or app.env as "local".');

Expand Down
17 changes: 17 additions & 0 deletions tests/DeployLocalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,21 @@ public function testDeployLocalWithStopOptionTriggersASubProcessWithoutCreatingD

$process->assertRan('docker compose stop');
}

public function testDeployLocalWhenSidecarEnvConfigIsNotEqualLocalShowsError()
{
config(['sidecar.env' => 'production']);

$process = Process::fake();

$command = $this->artisan('sidecar:local');

$command->doesntExpectOutput('Docker compose file created successfully with all functions as services.');

$command->expectsOutput('Make sure you have sidecar.env or app.env as "local".');

$command->assertExitCode(2);

$process->assertNothingRan();
}
}

0 comments on commit b95fed4

Please sign in to comment.