/** * Tests that new methods can be called on Validator by adding rules using Validator::add(). */ public function testAddCustomRegexMethods() { $this->assertNull(Validator::rules('foo')); Validator::add('foo', '/^foo$/'); $this->assertTrue(Validator::isFoo('foo')); $this->assertFalse(Validator::isFoo('bar')); $this->assertTrue(in_array('foo', Validator::rules())); $this->assertEqual('/^foo$/', Validator::rules('foo')); $this->expectException("Rule `bar` is not a validation rule."); $this->assertNull(Validator::isBar('foo')); }