protected function buildValidationRules() { $rules = parent::buildValidationRules(); $options = $this->getOptions(); $rules->push(new ChoiceRule('valid-text', $this->getOptions())); return $rules; }
public function testValidationError() { $text_attribute = new TextAttribute(self::ATTR_NAME, $this->getTypeMock(), [TextAttribute::OPTION_MIN_LENGTH => 3, TextAttribute::OPTION_MAX_LENGTH => 5]); $result = $text_attribute->getValidator()->validate('erpen derp'); $this->assertEquals($result->getSeverity(), IncidentInterface::ERROR); }