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); }
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); }