Exemple #1
0
 /**
  * CCValidator::min_num tests
  */
 public function test_min_num()
 {
     $validator = new CCValidator(array('1' => '5', '2' => 15, '3' => '-5', '4' => '3x'));
     $this->assertTrue($validator->min_num('1', 5));
     $this->assertTrue($validator->min_num('1', 4));
     $this->assertFalse($validator->min_num('1', 6));
     $this->assertTrue($validator->min_num('2', 14));
     $this->assertFalse($validator->min_num('2', 16));
     $this->assertTrue($validator->min_num('3', -6));
     $this->assertFalse($validator->min_num('3', -4));
     $this->assertFalse($validator->min_num('4', 1));
     // test rules syntax
     $this->assertTrue($validator->rules('1', 'required', 'min_num:4'));
     $this->assertFalse($validator->rules('1', 'required', 'min_num:6'));
 }