mirror of
https://github.com/flarum/core.git
synced 2025-08-04 23:47:32 +02:00
fix: console extender does not accept ::class attribute for schedule (#3903)
This commit is contained in:
@@ -78,6 +78,23 @@ class ConsoleTest extends ConsoleTestCase
|
||||
|
||||
$this->assertStringContainsString('cache:clear', $this->runCommand($input));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function scheduled_command_exists_when_added_with_class_syntax()
|
||||
{
|
||||
$this->extend(
|
||||
(new Extend\Console())
|
||||
->schedule('cache:clear', ScheduledCommandCallback::class)
|
||||
);
|
||||
|
||||
$input = [
|
||||
'command' => 'schedule:list'
|
||||
];
|
||||
|
||||
$this->assertStringContainsString('cache:clear', $this->runCommand($input));
|
||||
}
|
||||
}
|
||||
|
||||
class CustomCommand extends AbstractCommand
|
||||
@@ -94,3 +111,11 @@ class CustomCommand extends AbstractCommand
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
class ScheduledCommandCallback
|
||||
{
|
||||
public function __invoke(Event $event)
|
||||
{
|
||||
$event->everyMinute();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user