/** * @see ValueValidator::validate() * * @param DataValue $value The value to validate * * @throws InvalidArgumentException * @return Result */ public function validate($value) { if (!$value instanceof DataValue) { throw new InvalidArgumentException('DataValue expected'); } $arrayValue = $value->getArrayValue(); $result = $this->validator->validate($arrayValue); return $result; }
/** * @dataProvider instanceProvider * @param DataValue $value * @param array $arguments */ public function testToArray(DataValue $value, array $arguments) { $array = $value->toArray(); $this->assertInternalType('array', $array); $this->assertTrue(array_key_exists('type', $array)); $this->assertTrue(array_key_exists('value', $array)); $this->assertEquals($value->getType(), $array['type']); $this->assertEquals($value->getArrayValue(), $array['value']); }