|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace SonsOfPHP\Bard\Tests\Console\Command; |
| 6 | + |
| 7 | +use PHPUnit\Framework\Attributes\CoversClass; |
| 8 | +use PHPUnit\Framework\Attributes\Group; |
| 9 | +use PHPUnit\Framework\Attributes\UsesClass; |
| 10 | +use PHPUnit\Framework\TestCase; |
| 11 | +use SonsOfPHP\Bard\Console\Application; |
| 12 | +use SonsOfPHP\Bard\Console\Command\AbstractCommand; |
| 13 | +use SonsOfPHP\Bard\Console\Command\AddCommand; |
| 14 | +use SonsOfPHP\Bard\Console\Command\CopyCommand; |
| 15 | +use SonsOfPHP\Bard\Console\Command\InitCommand; |
| 16 | +use SonsOfPHP\Bard\Console\Command\InstallCommand; |
| 17 | +use SonsOfPHP\Bard\Console\Command\MergeCommand; |
| 18 | +use SonsOfPHP\Bard\Console\Command\PullCommand; |
| 19 | +use SonsOfPHP\Bard\Console\Command\PushCommand; |
| 20 | +use SonsOfPHP\Bard\Console\Command\ReleaseCommand; |
| 21 | +use SonsOfPHP\Bard\Console\Command\SplitCommand; |
| 22 | +use SonsOfPHP\Bard\Console\Command\UpdateCommand; |
| 23 | +use SonsOfPHP\Bard\JsonFile; |
| 24 | +use SonsOfPHP\Bard\Worker\File\Composer\Package\Authors; |
| 25 | +use SonsOfPHP\Bard\Worker\File\Composer\Package\BranchAlias; |
| 26 | +use SonsOfPHP\Bard\Worker\File\Composer\Package\Funding; |
| 27 | +use SonsOfPHP\Bard\Worker\File\Composer\Package\Support; |
| 28 | +use SonsOfPHP\Bard\Worker\File\Composer\Root\ClearSection; |
| 29 | +use SonsOfPHP\Bard\Worker\File\Composer\Root\UpdateAutoloadDevSection; |
| 30 | +use SonsOfPHP\Bard\Worker\File\Composer\Root\UpdateAutoloadSection; |
| 31 | +use SonsOfPHP\Bard\Worker\File\Composer\Root\UpdateProvideSection; |
| 32 | +use SonsOfPHP\Bard\Worker\File\Composer\Root\UpdateReplaceSection; |
| 33 | +use SonsOfPHP\Bard\Worker\File\Composer\Root\UpdateRequireDevSection; |
| 34 | +use SonsOfPHP\Bard\Worker\File\Composer\Root\UpdateRequireSection; |
| 35 | +use Symfony\Component\Console\Tester\CommandTester; |
| 36 | + |
| 37 | +#[Group('bard')] |
| 38 | +#[CoversClass(MergeCommand::class)] |
| 39 | +#[UsesClass(Application::class)] |
| 40 | +#[UsesClass(AbstractCommand::class)] |
| 41 | +#[UsesClass(AddCommand::class)] |
| 42 | +#[UsesClass(CopyCommand::class)] |
| 43 | +#[UsesClass(InitCommand::class)] |
| 44 | +#[UsesClass(InstallCommand::class)] |
| 45 | +#[UsesClass(PullCommand::class)] |
| 46 | +#[UsesClass(PushCommand::class)] |
| 47 | +#[UsesClass(ReleaseCommand::class)] |
| 48 | +#[UsesClass(SplitCommand::class)] |
| 49 | +#[UsesClass(UpdateCommand::class)] |
| 50 | +#[UsesClass(JsonFile::class)] |
| 51 | +#[UsesClass(Authors::class)] |
| 52 | +#[UsesClass(BranchAlias::class)] |
| 53 | +#[UsesClass(Funding::class)] |
| 54 | +#[UsesClass(Support::class)] |
| 55 | +#[UsesClass(ClearSection::class)] |
| 56 | +#[UsesClass(UpdateAutoloadDevSection::class)] |
| 57 | +#[UsesClass(UpdateAutoloadSection::class)] |
| 58 | +#[UsesClass(UpdateProvideSection::class)] |
| 59 | +#[UsesClass(UpdateReplaceSection::class)] |
| 60 | +#[UsesClass(UpdateRequireSection::class)] |
| 61 | +#[UsesClass(UpdateRequireDevSection::class)] |
| 62 | +final class MergeCommandTest extends TestCase |
| 63 | +{ |
| 64 | + private Application $application; |
| 65 | + |
| 66 | + private MergeCommand $command; |
| 67 | + |
| 68 | + protected function setUp(): void |
| 69 | + { |
| 70 | + $this->application = new Application(); |
| 71 | + $this->command = $this->application->get('merge'); |
| 72 | + } |
| 73 | + |
| 74 | + public function testItExecutesSuccessfully(): void |
| 75 | + { |
| 76 | + $commandTester = new CommandTester($this->command); |
| 77 | + |
| 78 | + $commandTester->execute([ |
| 79 | + '--dry-run' => true, |
| 80 | + '-vvv' => true, |
| 81 | + ]); |
| 82 | + |
| 83 | + $commandTester->assertCommandIsSuccessful(); |
| 84 | + } |
| 85 | +} |
0 commit comments