예제 #1
0
 /**
  * @covers h4kuna\DataType\Basic\Int::fromString
  * @todo   Implement testFromString().
  */
 public function testFromString()
 {
     $this->assertSame(1, Ints::fromString(1));
     $this->assertSame(1, Ints::fromString('1.0'));
     $this->assertSame(1, Ints::fromString('1'));
     $this->assertSame(1, Ints::fromString(' 1 '));
     $this->assertSame(-1000, Ints::fromString('- 1 000'));
     $this->setExpectedException('h4kuna\\DataType\\DataTypeException');
     $this->assertSame(1, Ints::fromString('1.1'));
     // not int
 }
예제 #2
0
 /**
  * @dataProvider provideTestFilter
  */
 public function testFilter($options, $raw, $filtered, $valid)
 {
     $int = new Ints($options);
     $this->assertEquals($filtered, $int->filter($raw));
     $this->assertEquals($valid, $int->validate($raw));
 }