From ce01822ff6310dd5151a450bb61b12fa77bc5e9d Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Wed, 5 May 2021 18:48:14 -0400 Subject: [PATCH] Add console test --- .../console/AbstractCommandTest.php | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 tests/integration/console/AbstractCommandTest.php diff --git a/tests/integration/console/AbstractCommandTest.php b/tests/integration/console/AbstractCommandTest.php new file mode 100644 index 000000000..0f8a068ef --- /dev/null +++ b/tests/integration/console/AbstractCommandTest.php @@ -0,0 +1,57 @@ +extend( + (new Extend\Console()) + ->command(CustomEchoTranslationsCommand::class) + ); + + $input = [ + 'command' => 'customEchoTranslationsCommand' + ]; + + // Arbitrary translation + $this->assertEquals('Flarum Email Test', $this->runCommand($input)); + } +} + +class CustomEchoTranslationsCommand extends AbstractCommand +{ + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('customEchoTranslationsCommand'); + } + + /** + * {@inheritdoc} + */ + protected function fire() + { + $translator = resolve(Translator::class); + + $this->info($translator->trans('core.emails.send_test.subject')); + } +}