Ejemplo n.º 1
0
 /**
  * CCValidator::min, max and between tests
  */
 public function test_string_size()
 {
     $validator = new CCValidator(array('1' => 15, '2' => 'foo', '3' => ''));
     $this->assertTrue($validator->min('1', 2));
     $this->assertFalse($validator->min('1', 6));
     $this->assertTrue($validator->max('1', 16));
     $this->assertFalse($validator->max('1', 1));
     $this->assertTrue($validator->between('1', 0, 2));
     $this->assertFalse($validator->between('1', 10, 20));
     $this->assertTrue($validator->between('2', 2, 6));
     $this->assertFalse($validator->between('2', 0, 2));
     $this->assertTrue($validator->between('3', 0, 16));
     $this->assertFalse($validator->between('3', 2, 6));
     $this->assertTrue($validator->rules('2', 'min:2', 'max:6'));
     $this->assertFalse($validator->rules('2', 'min:4', 'max:6'));
 }