Esempio n. 1
0
 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'));
 }
Esempio n. 2
0
 public function testErrorMessageIsCustomizable()
 {
     $constraint = new Pattern('/^\\d{4}\\-\\d{2}-\\d{2}$/', 'CUSTOM!');
     $this->assertSame('[field] CUSTOM!', $constraint->getErrorMessage('field'));
 }