addCustomRule() public method

When wanting to override a core rule just specify the rule name as $name. Eg, 'required', 'minLength'. Note the lowercase first letter. The name of the rule should not contain any whitespace or special characters as the name will be available to use as a function name in the method chaining syntax.
Since: 2.0
public addCustomRule ( string $name, string $class )
$name string
$class string
Exemplo n.º 1
0
 public function testCreateRuleInstanceWithGlobalMessage()
 {
     $message = 'Test message';
     $ruleName = 'test';
     $class = '\\DummyAbstractRule';
     $this->object->setGlobalMessage($ruleName, $message);
     $this->object->addCustomRule($ruleName, $class);
     $instance = $this->object->createRuleInstance($ruleName);
     $this->assertEquals($message, $instance->getMessage());
 }