diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeArtisan/InstructionTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeArtisan/InstructionTest.php index a78b06e8..e14b6018 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeArtisan/InstructionTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeArtisan/InstructionTest.php @@ -2,6 +2,8 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeArtisan; +use Composer\InstalledVersions; +use Composer\Semver\VersionParser; use Illuminate\Contracts\Console\Kernel; use LastDragon_ru\LaraASP\Core\Utils\Path; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; @@ -33,21 +35,25 @@ public function testInvoke(): void { $instance = $this->app()->make(Instruction::class); $this->override(Kernel::class, static function (MockInterface $mock) use ($command, $expected): void { - $mock - ->shouldReceive('addCommands') - ->atLeast() - ->once() - ->andReturns(); - $mock - ->shouldReceive('addCommandPaths') - ->atLeast() - ->once() - ->andReturns(); - $mock - ->shouldReceive('addCommandRoutePaths') - ->atLeast() - ->once() - ->andReturns(); + if (InstalledVersions::satisfies(new VersionParser(), 'illuminate/contracts', '^11.0.0')) { + // todo(documentator): Remove after https://github.com/LastDragon-ru/lara-asp/issues/143 + $mock + ->shouldReceive('addCommands') + ->atLeast() + ->once() + ->andReturns(); + $mock + ->shouldReceive('addCommandPaths') + ->atLeast() + ->once() + ->andReturns(); + $mock + ->shouldReceive('addCommandRoutePaths') + ->atLeast() + ->once() + ->andReturns(); + } + $mock ->shouldReceive('handle') ->withArgs( @@ -77,21 +83,25 @@ public function testInvokeFailed(): void { $instance = $this->app()->make(Instruction::class); $this->override(Kernel::class, static function (MockInterface $mock) use ($command): void { - $mock - ->shouldReceive('addCommands') - ->atLeast() - ->once() - ->andReturns(); - $mock - ->shouldReceive('addCommandPaths') - ->atLeast() - ->once() - ->andReturns(); - $mock - ->shouldReceive('addCommandRoutePaths') - ->atLeast() - ->once() - ->andReturns(); + // todo(documentator): Remove after https://github.com/LastDragon-ru/lara-asp/issues/143 + if (InstalledVersions::satisfies(new VersionParser(), 'illuminate/contracts', '^11.0.0')) { + $mock + ->shouldReceive('addCommands') + ->atLeast() + ->once() + ->andReturns(); + $mock + ->shouldReceive('addCommandPaths') + ->atLeast() + ->once() + ->andReturns(); + $mock + ->shouldReceive('addCommandRoutePaths') + ->atLeast() + ->once() + ->andReturns(); + } + $mock ->shouldReceive('handle') ->withArgs(