public function testAllWithCommandLoader() { $application =
new Application();
$commands =
$application->
all();
$this->
assertInstanceOf(HelpCommand::
class,
$commands['help'
], '->all() returns the registered commands'
);
$application->
add(new \
FooCommand());
$commands =
$application->
all('foo'
);
$this->
assertCount(1,
$commands, '->all() takes a namespace as its first argument'
);
$application->
setCommandLoader(new FactoryCommandLoader([ 'foo:bar1' =>
fn () =>
new \
Foo1Command(),
]));
$commands =
$application->
all('foo'
);
$this->
assertCount(2,
$commands, '->all() takes a namespace as its first argument'
);
$this->
assertInstanceOf(\FooCommand::
class,
$commands['foo:bar'
], '->all() returns the registered commands'
);
$this->
assertInstanceOf(\Foo1Command::
class,
$commands['foo:bar1'
], '->all() returns the registered commands'
);
} public function testRegister() { $application =
new Application();
$command =
$application->
register('foo'
);