public function testIsArray() { $argument = new InputArgument('foo', InputArgument::IS_ARRAY); $this->assertTrue($argument->isArray(), '->isArray() returns true if the argument can be an array'); $argument = new InputArgument('foo', InputArgument::OPTIONAL | InputArgument::IS_ARRAY); $this->assertTrue($argument->isArray(), '->isArray() returns true if the argument can be an array'); $argument = new InputArgument('foo', InputArgument::OPTIONAL); $this->assertFalse($argument->isArray(), '->isArray() returns false if the argument can not be an array'); }
$argument = new InputArgument('foo', 'ANOTHER_ONE'); $t->fail('__construct() throws an Exception if the mode is not valid'); } catch (\Exception $e) { $t->pass('__construct() throws an Exception if the mode is not valid'); } // ->isArray() $t->diag('->isArray()'); $argument = new InputArgument('foo', InputArgument::IS_ARRAY); $t->ok($argument->isArray(), '->isArray() returns true if the argument can be an array'); $argument = new InputArgument('foo', InputArgument::OPTIONAL | InputArgument::IS_ARRAY); $t->ok($argument->isArray(), '->isArray() returns true if the argument can be an array'); $argument = new InputArgument('foo', InputArgument::OPTIONAL); $t->ok(!$argument->isArray(), '->isArray() returns false if the argument can not be an array'); // ->getDescription() $t->diag('->getDescription()'); $argument = new InputArgument('foo', null, 'Some description'); $t->is($argument->getDescription(), 'Some description', '->getDescription() return the message description'); // ->getDefault() $t->diag('->getDefault()'); $argument = new InputArgument('foo', InputArgument::OPTIONAL, '', 'default'); $t->is($argument->getDefault(), 'default', '->getDefault() return the default value'); // ->setDefault() $t->diag('->setDefault()'); $argument = new InputArgument('foo', InputArgument::OPTIONAL, '', 'default'); $argument->setDefault(null);