/** * @depends testAppHasDi * @param Application $app */ public function testApplicationCallCommandByName(Application $app) { $input = new StringInput('SomeCommandName'); $mockObj = $this->getMock(Command::class, array('execute'), array('SomeCommandName')); $mockObj->expects($this->once())->method('execute'); $app->add($mockObj); $returnCode = $app->run($input, new NullOutput()); $this->assertSame(0, $returnCode); }