public function setValue($value) { try { $value = $this->validate($value); } catch (\Exception $e) { throw new \InvalidArgumentException('Validation error for [' . $this->getName() . ']: ' . $e->getMessage()); } $this->value = $value; $this->hasValue = true; }
/** * @dataProvider getDataForValidationFail * @expectedException \InvalidArgumentException */ public function testValidationFail($options, $value) { $ir = new InformationRequest('foo', $options); $ir->setValue($value); }