} $comparator->setOption('throw_global_error', true); try { $v->clean(array('left' => 'foo', 'right' => 'bar', 'password' => 'oof', 'password_bis' => 'rab')); $t->skip('', 3); } catch (ErrorSchema $e) { $t->is(count($e->getNamedErrors()), 1, '->clean() throws an exception with all error messages'); $t->is(count($e->getGlobalErrors()), 1, '->clean() throws an exception with all error messages'); $t->is($e->getCode(), 'invalid password [invalid]', '->clean() throws an exception with all error messages'); } $userValidator = new Schema(array('left' => new String(array('min_length' => 2)), 'right' => new String(array('min_length' => 2)), 'password' => new String(array('min_length' => 2)), 'password_bis' => new String(array('min_length' => 2)))); $userValidator->setPostValidator(new AndOperator(array($comparator, $comparator1))); $v = new Schema(array('left' => new String(array('min_length' => 2)), 'right' => new String(array('min_length' => 2)), 'password' => new String(array('min_length' => 2)), 'password_bis' => new String(array('min_length' => 2)), 'user' => $userValidator)); $v->setPostValidator(new AndOperator(array($comparator, $comparator1))); try { $v->clean(array('left' => 'foo', 'right' => 'bar', 'password' => 'oof', 'password_bis' => 'rab', 'user' => array('left' => 'foo', 'right' => 'bar', 'password' => 'oof', 'password_bis' => 'rab'))); $t->skip('', 7); } catch (ErrorSchema $e) { $t->is(count($e->getNamedErrors()), 2, '->clean() throws an exception with all error messages'); $t->is(count($e->getGlobalErrors()), 1, '->clean() throws an exception with all error messages'); $t->is(count($e['user']->getNamedErrors()), 1, '->clean() throws an exception with all error messages'); $t->is(count($e['user']->getGlobalErrors()), 1, '->clean() throws an exception with all error messages'); $t->is(isset($e['user']) ? $e['user']->getCode() : '', 'invalid password [invalid]', '->clean() throws an exception with all error messages'); $t->is(isset($e['user']['password']) ? $e['user']['password']->getCode() : '', 'invalid', '->clean() throws an exception with all error messages'); $t->is($e->getCode(), 'invalid user [invalid password [invalid]] password [invalid]', '->clean() throws an exception with all error messages'); } // __clone() $t->diag('__clone()'); $v = new Schema(array('v1' => $v1, 'v2' => $v2)); $v1 = clone $v; $f1 = $v1->getFields();