private static function getIntegerValidator($column, $logger)
 {
     $validator = new Integer($logger);
     if (strpos($column->COLUMN_TYPE, "unsigned")) {
         throw new \InvalidArgumentException("Cannot validate unsigned integer type yet... Knock yourself out ;-)");
     } else {
         $validator->withMin(-2147483648)->withMax(2147483647);
     }
     return $validator;
 }
Exemple #2
0
 public function testProgressive()
 {
     $integer = new Integer($this->logger);
     $integer->set(5);
     $this->assertTrue($integer->isValid());
     $integer->withMin(0);
     $this->assertTrue($integer->isValid());
     $integer->withMax(4);
     $this->assertFalse($integer->isValid());
     $integer = new Integer($this->logger);
     $integer->set(5);
     $this->assertTrue($integer->isValid());
     $integer->withMin(10);
     $this->assertFalse($integer->isValid());
     $integer = new Integer($this->logger);
     $integer->set(5);
     $this->assertTrue($integer->isValid());
     $integer->withMax(3);
     $this->assertFalse($integer->isValid());
 }