|
70 | 70 | { |
71 | 71 | $t->pass('->clean() throws an sfValidatorError exception if one of the validators fails'); |
72 | 72 | $t->is($e[0]->getCode(), 'max_length', '->clean() throws a sfValidatorSchemaError'); |
73 | | - $t->is($e instanceof sfValidatorErrorSchema, 'max_length', '->clean() throws a sfValidatorSchemaError'); |
| 73 | + $t->ok($e instanceof sfValidatorErrorSchema, '->clean() throws a sfValidatorSchemaError'); |
74 | 74 | } |
75 | 75 |
|
76 | 76 | $v1->setOption('max_length', 2); |
|
86 | 86 | $t->is(count($e), 2, '->clean() throws an error for every error'); |
87 | 87 | $t->is($e[0]->getCode(), 'max_length', '->clean() throws a sfValidatorSchemaError'); |
88 | 88 | $t->is($e[1]->getCode(), 'max_length', '->clean() throws a sfValidatorSchemaError'); |
89 | | - $t->is($e instanceof sfValidatorErrorSchema, 'max_length', '->clean() throws a sfValidatorSchemaError'); |
| 89 | + $t->ok($e instanceof sfValidatorErrorSchema, '->clean() throws a sfValidatorSchemaError'); |
90 | 90 | } |
91 | 91 |
|
92 | 92 | $v->setOption('halt_on_error', true); |
|
101 | 101 | $t->pass('->clean() throws an sfValidatorError exception if one of the validators fails'); |
102 | 102 | $t->is(count($e), 1, '->clean() only returns the first error if halt_on_error option is true'); |
103 | 103 | $t->is($e[0]->getCode(), 'max_length', '->clean() throws a sfValidatorSchemaError'); |
104 | | - $t->is($e instanceof sfValidatorErrorSchema, 'max_length', '->clean() throws a sfValidatorSchemaError'); |
| 104 | + $t->ok($e instanceof sfValidatorErrorSchema, '->clean() throws a sfValidatorSchemaError'); |
105 | 105 | } |
106 | 106 |
|
107 | 107 | try |
|
115 | 115 | { |
116 | 116 | $t->pass('->clean() throws an sfValidatorError exception if one of the validators fails'); |
117 | 117 | $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError if invalid message is not empty'); |
118 | | - $t->is(!$e instanceof sfValidatorErrorSchema, 'max_length', '->clean() throws a sfValidatorError if invalid message is not empty'); |
| 118 | + $t->ok(!$e instanceof sfValidatorErrorSchema, '->clean() throws a sfValidatorError if invalid message is not empty'); |
119 | 119 | } |
120 | 120 |
|
121 | 121 | // ->asString() |
|
127 | 127 | , '->asString() returns a string representation of the validator'); |
128 | 128 |
|
129 | 129 | $v = new sfValidatorAnd(array($v1, $v2), array(), array('required' => 'This is required.')); |
130 | | -$t->is($v->asString(), "(\n String({ max_length: 3 })\n and({}, { required: 'This is required.' })\n String({ min_length: 3 })\n)" |
| 130 | +$t->is($v->asString(), "(\n String({ max_length: 3 })\n and({}, { required: 'This is required.' })\n String({ min_length: 3 })\n)" |
131 | 131 | , '->asString() returns a string representation of the validator'); |
0 commit comments