Exemplo n.º 1
0
$definition->addArguments(array($foo));
$t->is($definition->getArgument('foo'), $foo, '->getArgument() returns a InputArgument by its name');
try
{
  $definition->getArgument('bar');
  $t->fail('->getArgument() throws an exception if the InputArgument name does not exist');
}
catch (\Exception $e)
{
  $t->pass('->getArgument() throws an exception if the InputArgument name does not exist');
}

// ->hasArgument()
$t->diag('->hasArgument()');
$definition = new InputDefinition();
$definition->addArguments(array($foo));
$t->is($definition->hasArgument('foo'), true, '->hasArgument() returns true if a InputArgument exists for the given name');
$t->is($definition->hasArgument('bar'), false, '->hasArgument() returns false if a InputArgument exists for the given name');

// ->getArgumentRequiredCount()
$t->diag('->getArgumentRequiredCount()');
$definition = new InputDefinition();
$definition->addArgument($foo2);
$t->is($definition->getArgumentRequiredCount(), 1, '->getArgumentRequiredCount() returns the number of required arguments');
$definition->addArgument($foo);
$t->is($definition->getArgumentRequiredCount(), 1, '->getArgumentRequiredCount() returns the number of required arguments');

// ->getArgumentCount()
$t->diag('->getArgumentCount()');
$definition = new InputDefinition();
$definition->addArgument($foo2);
Exemplo n.º 2
0
 public function testHasArgument()
 {
     $this->initializeArguments();
     $definition = new InputDefinition();
     $definition->addArguments(array($this->foo));
     $this->assertEquals($definition->hasArgument('foo'), true, '->hasArgument() returns true if a InputArgument exists for the given name');
     $this->assertEquals($definition->hasArgument('bar'), false, '->hasArgument() returns false if a InputArgument exists for the given name');
 }