diff --git a/src/LaravelDDDServiceProvider.php b/src/LaravelDDDServiceProvider.php index ac534c7..c35ff7b 100644 --- a/src/LaravelDDDServiceProvider.php +++ b/src/LaravelDDDServiceProvider.php @@ -63,12 +63,22 @@ public function configurePackage(Package $package): void Commands\Migration\DomainMigrateMakeCommand::class, ]); - if (app()->version() >= 11) { + if ($this->laravelVersion(11)) { $package->hasCommand(Commands\DomainClassMakeCommand::class); $package->hasCommand(Commands\DomainEnumMakeCommand::class); $package->hasCommand(Commands\DomainInterfaceMakeCommand::class); $package->hasCommand(Commands\DomainTraitMakeCommand::class); } + + // if ($this->laravelVersion('11.30.0')) { + // $package->hasCommand(Commands\PublishCommand::class); + // $package->hasCommand(Commands\StubCommand::class); + // } + } + + protected function laravelVersion($value) + { + return version_compare(app()->version(), $value, '>='); } protected function registerMigrations() diff --git a/tests/Command/StubTest.php b/tests/Command/StubTest.php index 1fc04fd..9628b69 100644 --- a/tests/Command/StubTest.php +++ b/tests/Command/StubTest.php @@ -124,4 +124,4 @@ expect(count($stubFiles))->toEqual(1); expect($stubFiles[0]->getFilename())->toEqual('model.stub'); -}); +})->skipOnLaravelVersionsBelow('11.30.0'); diff --git a/tests/Fixtures/Enums/Feature.php b/tests/Fixtures/Enums/Feature.php index 4c29e61..957adf0 100644 --- a/tests/Fixtures/Enums/Feature.php +++ b/tests/Fixtures/Enums/Feature.php @@ -6,9 +6,10 @@ enum Feature: string { case PromptForMissingInput = '9.49.0'; case IncludeFilepathInGeneratorCommandOutput = '9.32.0'; + case Laravel11 = '11.0.0'; case LaravelPromptsPackage = '10.17'; case LaravelPackageOptimizeCommands = '11.27.1'; - case Laravel11 = '11.0.0'; + case StubCommand = '11.30.0'; public function exists(): bool { diff --git a/tests/Pest.php b/tests/Pest.php index 1691c65..d31d21e 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -9,7 +9,7 @@ function skipOnLaravelVersionsBelow($minimumVersion) $version = app()->version(); if (version_compare($version, $minimumVersion, '<')) { - test()->markTestSkipped("Only relevant from Laravel {$minimumVersion} onwards (Current version: {$version})."); + test()->markTestSkipped("Only available on Laravel {$minimumVersion}+ (Current version: {$version})."); } }