public static function getVarcharValidator(Logger $logger, $length = 255)
 {
     if (empty($length)) {
         $length = 255;
     }
     $validator = new String($logger);
     $validator->withMaxLength($length);
     return $validator;
 }
Example #2
0
 public function testProgressive()
 {
     $string = new String($this->logger);
     $string->set("123456789");
     $this->assertTrue($string->isValid());
     $string->withMinLength(0);
     $this->assertTrue($string->isValid());
     $string->withMaxLength(4);
     $this->assertFalse($string->isValid());
     $string = new String($this->logger);
     $string->set("123456789");
     $this->assertTrue($string->isValid());
     $string->withMinLength(10);
     $this->assertFalse($string->isValid());
     $string = new String($this->logger);
     $string->set("123456789");
     $this->assertTrue($string->isValid());
     $string->withMaxLength(3);
     $this->assertFalse($string->isValid());
 }
 private static function getStringValidator($column, $logger)
 {
     $validator = new String($logger);
     $validator->withMaxLength($column->CHARACTER_MAXIMUM_LENGTH);
     return $validator;
 }