diff --git a/tests/Command/StubTest.php b/tests/Command/StubTest.php index 9628b69..2c8546e 100644 --- a/tests/Command/StubTest.php +++ b/tests/Command/StubTest.php @@ -1,6 +1,7 @@ filter(fn ($stub, $path) => str($stub)->contains('model')) ->all(); - $this - ->artisan('ddd:stub') - ->expectsQuestion('What do you want to do?', 'some') - ->expectsSearch( - 'Which stub should be published?', - search: 'model', - answers: $matches, - answer: ['model.stub'] - ) - ->assertSuccessful() - ->execute(); + if (Feature::ExpectSearchAssertion->exists()) { + $this + ->artisan('ddd:stub') + ->expectsQuestion('What do you want to do?', 'some') + ->expectsSearch( + 'Which stub should be published?', + search: 'model', + answers: $matches, + answer: ['model.stub'] + ) + ->assertSuccessful() + ->execute(); + } else { + $this + ->artisan('ddd:stub') + ->expectsQuestion('What do you want to do?', 'some') + ->expectsQuestion('Which stub should be published?', ['model.stub']) + ->assertSuccessful() + ->execute(); + } assertDirectoryExists($publishedStubFolder); @@ -124,4 +134,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 957adf0..4398a26 100644 --- a/tests/Fixtures/Enums/Feature.php +++ b/tests/Fixtures/Enums/Feature.php @@ -9,7 +9,7 @@ enum Feature: string case Laravel11 = '11.0.0'; case LaravelPromptsPackage = '10.17'; case LaravelPackageOptimizeCommands = '11.27.1'; - case StubCommand = '11.30.0'; + case ExpectSearchAssertion = '11.30.0'; public function exists(): bool {