getFailedRules() public méthode

Returns a list of rules that caused fields to fail, indexed by the field name.
Since: 2.0
public getFailedRules ( ) : Fuel\Validation\RuleInterface[]
Résultat Fuel\Validation\RuleInterface[]
Exemple #1
0
 public function testSetGetErrors()
 {
     $this->object->setError('field1', 'msg1', 'one');
     $this->object->setError('field2', 'msg2', 'two');
     $this->object->setError('field3', 'msg3', 'three');
     $this->assertEquals('msg1', $this->object->getError('field1'));
     $this->assertEquals('msg2', $this->object->getError('field2'));
     $this->assertEquals('msg3', $this->object->getError('field3'));
     $this->assertEquals(array('field1' => 'msg1', 'field2' => 'msg2', 'field3' => 'msg3'), $this->object->getErrors());
     $this->assertEquals(array('field1' => 'one', 'field2' => 'two', 'field3' => 'three'), $this->object->getFailedRules());
 }
Exemple #2
0
 public function testMerge()
 {
     $result1 = new Result();
     $result1->setResult(false);
     $result1->setError('foo', 'foo failed', 'foocheck');
     $result1->setValidated('bar');
     $result2 = new Result();
     $result2->setResult(true);
     $result2->setError('baz', 'baz failed', 'bazcheck');
     $result2->setValidated('bat');
     $result1->merge($result2, 'sub.');
     $this->assertEquals(['foo' => 'foo failed', 'sub.baz' => 'baz failed'], $result1->getErrors());
     $this->assertEquals(['foo' => 'foocheck', 'sub.baz' => 'bazcheck'], $result1->getFailedRules());
     $this->assertEquals(['bar', 'sub.bat'], $result1->getValidated());
 }