Exemplo n.º 1
0
 public function testParser()
 {
     $parser = $this->getMock('\\PHPVS\\Parser');
     $parser->expects($this->exactly(2))->method('parse');
     RuleSet::attachParser($parser);
     Validator::int()->prepare();
     Sanitizer::int()->prepare();
     RuleSet::detachParser($parser);
 }
Exemplo n.º 2
0
 public function testInt()
 {
     $this->assertNull(Sanitizer::int()->filter('not an int', $default = null));
     $this->assertSame(Sanitizer::int()->filter('not an int', $default = 1), 1);
     $this->assertEquals(Sanitizer::int()->filter(2), 2);
 }