I call Laravel commands from a Laravel command. It works, but I want to test if the subcommands A and/or B are called.
Below a simplified version:
final class HandleActions extends Command
{
public function handle()
{
foreach ($items as $item) {
if ($item->price * 2.24 > 100) {
$this->call('order:reprocess'); // command A
}
if (!$item->stock) {
$this->call('order:cleanup'); // command B
}
}
}
}
I test this command like so (simplified), so I know that the main command is excited successfully.
$this->artisan('command')->assertExitCode(0);
// How do I assert command A is fired?
// How do I assert command B is fired?
I want to assert that subcommand 1 is fired and/or subcommand 2 fired. But how to do this?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3aMtlYm
via IFTTT
Aucun commentaire:
Enregistrer un commentaire