public function testIsGettingErrorMessage() { $constraint = new Enum(['foo', 'bar']); $this->assertFalse($constraint->validate('test'), 'The "test" value is not part of the Enum'); $this->assertEquals('Invalid option for enum. Allowed options are: foo, bar', $constraint->getErrorMessage()); }
public function testErrorMessageIsCustomizable() { $constraint = new Enum(['foo', 'bar'], 'CUSTOM!'); $this->assertSame('[field] CUSTOM!', $constraint->getErrorMessage('field')); }