diff --git a/composer.json b/composer.json index 3e112d0..c96abdb 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/src/Commands/DeployLocal.php b/src/Commands/DeployLocal.php index 59a44cf..e8d4078 100644 --- a/src/Commands/DeployLocal.php +++ b/src/Commands/DeployLocal.php @@ -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".'); diff --git a/tests/DeployLocalTest.php b/tests/DeployLocalTest.php index 05e16ab..1b65180 100644 --- a/tests/DeployLocalTest.php +++ b/tests/DeployLocalTest.php @@ -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(); + } }