Beispiel #1
0
 public function testRecursiveDetection()
 {
     $validator = new InArray(array('haystack' => array('firstDimension' => array('test', 0, 'A'), 'secondDimension' => array('value', 2, 'a')), 'recursive' => false));
     $this->assertFalse($validator->isValid('A'));
     $validator->setRecursive(true);
     $this->assertTrue($validator->isValid('A'));
 }
Beispiel #2
0
    public function testRecursiveStandalone()
    {
        $validator = new Validator\InArray(
            array(
                'firstDimension' => array('test', 0, 'A'),
                'secondDimension' => array('value', 2, 'a')
            )
        );
        $this->assertFalse($validator->isValid('A'));

        $validator->setRecursive(true);
        $this->assertTrue($validator->isValid('A'));
    }
Beispiel #3
0
 /**
  * {@inheritdoc}
  */
 public function isValid($value)
 {
     $validator = new InArray($this->options);
     return $validator->isValid($value);
 }