Skip to content

Commit 48da6e1

Browse files
committed
ITT: Ability to pass command object added.
1 parent 195465c commit 48da6e1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Helpers/InteractsWithConsole.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22

33
namespace Illuminated\Testing\Helpers;
44

5+
use Illuminate\Console\Command;
56
use Symfony\Component\Console\Input\ArrayInput;
67
use Symfony\Component\Console\Output\BufferedOutput;
78

89
trait InteractsWithConsole
910
{
10-
protected function runConsoleCommand($class, array $parameters = [])
11+
protected function runConsoleCommand($command, array $parameters = [])
1112
{
12-
$command = new $class;
13+
if (!($command instanceof Command)) {
14+
$command = new $command;
15+
}
1316

1417
$command->setLaravel($this->app);
1518
$command->run(new ArrayInput($parameters), new BufferedOutput);

0 commit comments

Comments
 (0)