public function testArguments() { $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name')))); $this->assertEquals('foo', $input->getArgument('name'), '->getArgument() returns the value for the given argument'); $input->setArgument('name', 'bar'); $this->assertEquals('bar', $input->getArgument('name'), '->setArgument() sets the value for a given argument'); $this->assertEquals(array('name' => 'bar'), $input->getArguments(), '->getArguments() returns all argument values'); $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')))); $this->assertEquals('default', $input->getArgument('bar'), '->getArgument() returns the default value for optional arguments'); $this->assertEquals(array('name' => 'foo', 'bar' => 'default'), $input->getArguments(), '->getArguments() returns all argument values, even optional ones'); }
public function testParseArguments() { $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name')))); $this->assertEquals(array('name' => 'foo'), $input->getArguments(), '->parse() parses required arguments'); }