/** * @test */ public function canRoundTripConvert() { $product = new Product(); $fixture = $this->getFixtureContent('Api/Client/System/XMLContentMapper/Fixture/product.xml'); $this->mapper->fromXML($product, $fixture); $color = $product->getAttributeByName('color'); $this->assertEquals(1, count($color->getValues()), 'Reconstituted product with unexpected amount of attributes'); $xmlOut = $this->mapper->toXML($product); $cleanFixture = $this->getDOMParserXMLOutput($fixture); $cleanXml = $this->getDOMParserXMLOutput($xmlOut); $this->assertEquals($cleanFixture, $cleanXml); }
/** * @return boolean */ public function afterReconstitution() { try { $this->xmlMapper->fromXML($this, $this->content); return true; } catch (InvalidArgumentException $e) { return false; } }