Ejemplo n.º 1
0
    $t->pass('->addArgument() throws an InvalidArgumentException if you try to add a required argument after an optional one');
}
// ->getArgument()
$t->comment('nbArgumentSetTest - Test get argument');
$set = new nbArgumentSet(array($fooArgument));
$t->is($set->getArgument('foo'), $fooArgument, '->getArgument() returns an nbArgument by its name');
try {
    $set->getArgument('bar');
    $t->fail('->getArgument() throws a RangeException exception if the argument name does not exist');
} catch (RangeException $e) {
    $t->pass('->getArgument() throws a RangeException exception if the argument name does not exist');
}
// ->hasArgument()
$t->comment('nbArgumentSetTest - Test has argument');
$set = new nbArgumentSet(array($fooArgument));
$t->is($set->hasArgument('foo'), true, '->hasArgument() returns true if an nbArgument exists for the given name');
$t->is($set->hasArgument('bar'), false, '->hasArgument() returns false if an nbArgument does not exists for the given name');
// ->countRequired()
$t->comment('nbArgumentSetTest - Test argument required count');
$set = new nbArgumentSet(array($requiredArgument));
$t->is($set->countRequired(), 1, '->countRequired() returns the number of required arguments');
$set->addArgument($fooArgument);
$t->is($set->countRequired(), 1, '->countRequired() returns the number of required arguments');
// ->count()
$t->comment('nbArgumentSetTest - Test get argument count');
$set = new nbArgumentSet();
$set->addArgument($fooArgument);
$t->is($set->count(), 1, '->count() returns the number of arguments');
$set->addArgument($barArgument);
$t->is($set->count(), 2, '->count() returns the number of arguments');
// ->getDefaultValues()