get('kernel'); $this->factory = new CommandTestFactory($kernel); } /** * @Given /^I run command (?P.+)$/ * * @param string $name Command name. * @param TableNode $table Command parameters in table format. * * @return void */ public function runCommand($name, TableNode $table = null) { $params = []; if ($table !== null) { foreach ($table as $row) { $params[current($row)] = next($row); } } $this->command = $this->factory->create($name, $params)->run(); } /** * @Then /^(?:|[Cc]ommand )[Rr]eturned (?P\d+) exit code$/ * * @param integer $code Command exit code. * * @return void */ public function checkExitCode($code = 0) { self::assertEquals($code, $this->command->getExitCode()); } }