public function testIsGettingErrorMessage() { $constraint = new Pattern('/^\\d{4}\\-\\d{2}-\\d{2}$/'); $this->assertFalse($constraint->validate(null)); $this->assertEquals('[field] Required pattern does not match', $constraint->getErrorMessage('field')); }
public function testErrorMessageIsCustomizable() { $constraint = new Pattern('/^\\d{4}\\-\\d{2}-\\d{2}$/', 'CUSTOM!'); $this->assertSame('[field] CUSTOM!', $constraint->getErrorMessage('field')); }