/** * @dataProvider providerForTestConvertCorrect */ public function testConvertCorrect($xmlString) { $input = new EzXml($xmlString); $this->assertEquals($xmlString, $input->getInternalRepresentation()); }
/** * Inspects given $inputValue and potentially converts it into a dedicated value object. * * @param \eZ\Publish\Core\FieldType\XmlText\Value|\eZ\Publish\Core\FieldType\XmlText\Input|string $inputValue * * @return \eZ\Publish\Core\FieldType\XmlText\Value The potentially converted and structurally plausible value. */ protected function createValueFromInput($inputValue) { if (is_string($inputValue)) { if (empty($inputValue)) { $inputValue = Value::EMPTY_VALUE; } $inputValue = new EzXml($inputValue); } if ($inputValue instanceof Input) { $doc = new DOMDocument(); $doc->loadXML($inputValue->getInternalRepresentation()); $inputValue = new Value($doc); } return $inputValue; }