1
0
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:
IanM
2023-10-21 17:34:48 +01:00
committed by GitHub
parent db0d9cb006
commit 94de8b42b4
2 changed files with 31 additions and 1 deletions

View File

@@ -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();
}
}