Exemplo n.º 1
0
$e->addError($e2, 'e2');
$e->addError($e1, '2');
$t->is($e->getGlobalErrors(), array($e1), '->getGlobalErrors() returns all globals/non named errors');
// ->getNamedErrors()
$t->diag('->getNamedErrors()');
$t->is($e->getNamedErrors(), array('e2' => $e2, '2' => $e1), '->getNamedErrors() returns all named errors');
// ->getValue()
$t->diag('->getValue()');
$t->is($e->getValue(), null, '->getValue() always returns null');
// ->getArguments()
$t->diag('->getArguments()');
$t->is($e->getArguments(), array(), '->getArguments() always returns an empty array');
$t->is($e->getArguments(true), array(), '->getArguments() always returns an empty array');
// ->getMessageFormat()
$t->diag('->getMessageFormat()');
$t->is($e->getMessageFormat(), '', '->getMessageFormat() always returns an empty string');
// ->getMessage()
$t->diag('->getMessage()');
$t->is($e->getMessage(), '"foo" is too long (1 characters max). e2 ["bar" is too short (5 characters min).] 2 ["foo" is too long (1 characters max).]', '->getMessage() returns the error message string');
// ->getCode()
$t->diag('->getCode()');
$t->is($e->getCode(), 'max_length e2 [min_length] 2 [max_length]', '->getCode() returns the error code');
// implements \Countable
$t->diag('implements \\Countable');
$e = new ErrorSchema($v1, array('e1' => $e1, 'e2' => $e2));
$t->is(count($e), 2, '"Error" implements \\Countable');
// implements \Iterator
$t->diag('implements \\Iterator');
$e = new ErrorSchema($v1, array('e1' => $e1, $e2));
$e->addError($e2, '2');
$errors = array();