public function testGetDescription()
 {
     $argument = new InputArgument('foo', null, 'Some description');
     $this->assertEquals('Some description', $argument->getDescription(), '->getDescription() return the message description');
 }
Ejemplo n.º 2
0
  $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);
$t->ok(is_null($argument->getDefault()), '->setDefault() can reset the default value by passing null');
$argument->setDefault('another');
$t->is($argument->getDefault(), 'another', '->setDefault() changes the default value');

$argument = new InputArgument('foo', InputArgument::OPTIONAL | InputArgument::IS_ARRAY);