converter = new HtmlContent(); } public function testConvert() { $xml = '' . '' . '' . '' . '' . ''; $expectedResult = [ 'xsi:type' => 'array', 'item' => [ 'layout' => [ 'xsi:type' => 'string', 'name' => 'layout', 'value' => '' ], 'name' => [ 'xsi:type' => 'string', 'name' => 'block', 'value' => 'customer_edit_tab_view', ], ], ]; $dom = new \DOMDocument('1.0', 'UTF-8'); $dom->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'testForm.xml'); $domXpath = new \DOMXPath($dom); $node = $domXpath->query('//form/htmlContent/block')->item(0); $actualResult = $this->converter->convert($node, []); $this->assertTrue(isset($actualResult['item']['layout']['value'])); // assert xml structures $this->assertXmlStringEqualsXmlString($xml, $actualResult['item']['layout']['value']); $actualResult['item']['layout']['value'] = ''; // assert that all expected keys in array are exists $this->assertEquals($expectedResult, $actualResult); } }