publicfunctiontestAdd() { $application = newApplication(); $application->add($foo = new \FooCommand()); $commands = $application->all(); $this->assertEquals($foo, $commands['foo:bar'], '->add() registers a command');
$application = newApplication(); $application->addCommands([$foo = new \FooCommand(), $foo1 = new \Foo1Command()]); $commands = $application->all(); $this->assertEquals([$foo, $foo1], [$commands['foo:bar'], $commands['foo:bar1']], '->addCommands() registers an array of commands'); }
publicfunctiontestAddCommandWithEmptyConstructor() { $this->expectException(\LogicException::class); $this->expectExceptionMessage('Command class "Foo5Command" is not correctly initialized. You probably forgot to call the parent constructor.'); $application = newApplication(); $application->add(new \Foo5Command()); }
if(!$this->skipDatabase){ // Wrap database related logic in a try-catch
// so that non-db commands can still execute
try{ $em = $this->kernel->getContainer()->get(ModelManager::class);