From 0100ac97dcee66572315144010253a9e583e9f40 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Fri, 20 Dec 2024 10:29:35 +0100 Subject: [PATCH] feat: simplify things --- src/Command/ExampleCommand.php | 8 +------- src/Resources/config/config.xml | 16 ---------------- tests/Command/ExampleCommandTest.php | 10 ++++------ 3 files changed, 5 insertions(+), 29 deletions(-) delete mode 100644 src/Resources/config/config.xml diff --git a/src/Command/ExampleCommand.php b/src/Command/ExampleCommand.php index 2852142..98e53e4 100644 --- a/src/Command/ExampleCommand.php +++ b/src/Command/ExampleCommand.php @@ -13,18 +13,12 @@ )] class ExampleCommand extends Command { - // Provides a description, printed out in bin/console - protected function configure(): void - { - $this->setDescription('Does something very special.'); - } - // Actual code executed in the command protected function execute(InputInterface $input, OutputInterface $output): int { $output->writeln('It works!'); // Exit code 0 for success - return 0; + return self::SUCCESS; } } diff --git a/src/Resources/config/config.xml b/src/Resources/config/config.xml deleted file mode 100644 index b45fed5..0000000 --- a/src/Resources/config/config.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - Minimal configuration - - - textField - - test - - - - diff --git a/tests/Command/ExampleCommandTest.php b/tests/Command/ExampleCommandTest.php index 4e5b96e..46c7755 100644 --- a/tests/Command/ExampleCommandTest.php +++ b/tests/Command/ExampleCommandTest.php @@ -11,13 +11,11 @@ class ExampleCommandTest extends TestCase { public function testDescriptionIsCorrect(): void { - $application = new Application(); $command = new ExampleCommand(); - $application->add($command); - - $commandTester = new CommandTester($application->find('swag-commands:example')); + $commandTester = new CommandTester($command); $commandTester->execute([]); + $commandTester->assertCommandIsSuccessful(); - $this->assertSame('Does something very special.', $command->getDescription()); + $this->assertSame('Add a short description for your command', $command->getDescription()); } -} \ No newline at end of file +}