12 namespace Symfony\Component\Console\Tests\Input;
21 $this->assertEquals(
'foo', $argument->getName(),
'__construct() takes a name as its first argument');
27 $this->assertFalse($argument->isRequired(),
'__construct() gives a "InputArgument::OPTIONAL" mode by default');
30 $this->assertFalse($argument->isRequired(),
'__construct() can take "InputArgument::OPTIONAL" as its mode');
33 $this->assertFalse($argument->isRequired(),
'__construct() can take "InputArgument::OPTIONAL" as its mode');
36 $this->assertTrue($argument->isRequired(),
'__construct() can take "InputArgument::REQUIRED" as its mode');
44 $this->setExpectedException(
'InvalidArgumentException', sprintf(
'Argument mode "%s" is not valid.', $mode));
60 $this->assertTrue($argument->isArray(),
'->isArray() returns true if the argument can be an array');
62 $this->assertTrue($argument->isArray(),
'->isArray() returns true if the argument can be an array');
64 $this->assertFalse($argument->isArray(),
'->isArray() returns false if the argument can not be an array');
69 $argument =
new InputArgument(
'foo', null,
'Some description');
70 $this->assertEquals(
'Some description', $argument->getDescription(),
'->getDescription() return the message description');
76 $this->assertEquals(
'default', $argument->getDefault(),
'->getDefault() return the default value');
82 $argument->setDefault(null);
83 $this->assertNull($argument->getDefault(),
'->setDefault() can reset the default value by passing null');
84 $argument->setDefault(
'another');
85 $this->assertEquals(
'another', $argument->getDefault(),
'->setDefault() changes the default value');
88 $argument->setDefault(array(1, 2));
89 $this->assertEquals(array(1, 2), $argument->getDefault(),
'->setDefault() changes the default value');
99 $argument->setDefault(
'default');
109 $argument->setDefault(
'default');