$es->addErrors($es1); $t->is($es->getGlobalErrors(), array($e1), '->addErrors() adds an array of errors to the current error'); $t->is($es->getNamedErrors(), array(0 => $e1, '1' => $e2), '->addErrors() merges a sfValidatorErrorSchema to the current error'); // ->getGlobalErrors() $t->diag('->getGlobalErrors()'); $e = new sfValidatorErrorSchema($v1); $e->addError($e1); $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');