mirror of
https://github.com/flarum/core.git
synced 2025-08-13 20:04:24 +02:00
Compare commits
4 Commits
dw/2.0-use
...
dk/2836-tr
Author | SHA1 | Date | |
---|---|---|---|
|
ce01822ff6 | ||
|
7708be2fe6 | ||
|
bddfb5605d | ||
|
a56c748ad4 |
@@ -15,6 +15,7 @@ use Flarum\Foundation\AbstractServiceProvider;
|
||||
use Flarum\Foundation\Console\AssetsPublishCommand;
|
||||
use Flarum\Foundation\Console\CacheClearCommand;
|
||||
use Flarum\Foundation\Console\InfoCommand;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Illuminate\Console\Scheduling\Schedule as LaravelSchedule;
|
||||
use Illuminate\Console\Scheduling\ScheduleListCommand;
|
||||
use Illuminate\Console\Scheduling\ScheduleRunCommand;
|
||||
@@ -65,5 +66,9 @@ class ConsoleServiceProvider extends AbstractServiceProvider
|
||||
$event = $schedule->command($scheduled['command'], $scheduled['args']);
|
||||
$scheduled['callback']($event);
|
||||
}
|
||||
|
||||
$container->make('flarum.locales')->getTranslator()->getCatalogue(
|
||||
$container->make(SettingsRepositoryInterface::class)->get('default_locale', 'en')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
57
tests/integration/console/AbstractCommandTest.php
Normal file
57
tests/integration/console/AbstractCommandTest.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Tests\integration\console;
|
||||
|
||||
use Flarum\Console\AbstractCommand;
|
||||
use Flarum\Extend;
|
||||
use Flarum\Locale\Translator;
|
||||
use Flarum\Testing\integration\ConsoleTestCase;
|
||||
|
||||
class AbstractCommandTest extends ConsoleTestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function scheduled_command_exists_when_added()
|
||||
{
|
||||
$this->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'));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user