public static function getTester($cmd_name) { $app = new Application(); $app->configure(new ArrayInput(array()), new StreamOutput(fopen('php://memory', 'w', false))); $app->setEntryPoint(self::getEntryPointInstance()); $app->registerAllCommands(); $command = $app->find($cmd_name); return (object) array('tester' => new CommandTester($command), 'app' => $app, 'command' => $command); }
public function getCommandTester($cmd_name = 'user:update') { $app = new Application(); $app->configure(new ArrayInput(array()), new StreamOutput(fopen('php://memory', 'w', false))); $app->setEntryPoint($this->getEntryPointInstance()); $app->registerAllCommands(); $this->command = $app->find($cmd_name); return new CommandTester($this->command); }
/** * @expectedException InvalidArgumentException * @expectedExceptionMessageRegExp /The "\w+" option is not specified and not found in the config "sugarcrm\.\w+"/ */ public function testWrongDefaultOptionsOptionNotFound() { $cmd_name = 'test:default'; $config = new Config(array(__DIR__ . '/../yaml/empty.yaml')); $config->load(); $app = new Application(); $app->configure(); $app->setAutoExit(false); $app->getContainer()->set('config', $config); $app->add(new TestConfigOptionCommand($cmd_name)); $command = $app->find($cmd_name); $commandTester = new CommandTester($command); $commandTester->execute(array('command' => $cmd_name)); }