Example #1
0
 /**
  *  This test we will test multiple fields against different filters
  *
  * @return null
  */
 public function testIsSatisfiedByWithMultipleFields()
 {
     $raw = array('field-a' => 123, 'field-b' => '*****@*****.**', 'field-c' => 'true', 'field-d' => '1.234', 'field-e' => '192.168.1.1');
     $this->controller->addFilter('field-a', 'php-int-filter')->addFilter('field-b', 'php-email-filter')->addFilter('field-c', 'php-bool-filter')->addFilter('field-d', 'php-float-filter')->addFilter('field-e', 'php-ip-filter');
     $this->assertTrue($this->controller->isSatisfiedBy($raw));
     $this->assertFalse($this->controller->isError());
     /* 
      * notice that the string true has been changes to the php value true	
      */
     $expected = array('field-a' => 123, 'field-b' => '*****@*****.**', 'field-c' => true, 'field-d' => '1.234', 'field-e' => '192.168.1.1');
     $this->assertEquals($expected, $this->controller->getAllClean());
     $this->assertEquals($expected['field-a'], $this->controller->getClean('field-a'));
     $this->assertEquals($expected['field-b'], $this->controller->getClean('field-b'));
     $this->assertEquals($expected['field-c'], $this->controller->getClean('field-c'));
     $this->assertEquals($expected['field-d'], $this->controller->getClean('field-d'));
     $this->assertEquals($expected['field-e'], $this->controller->getClean('field-e'));
 }