Skip to content

Commit b7baa4e

Browse files
author
Karpenko, Oleksandr
committed
MAGETWO-52958: Better Semantic for UI Components
1 parent b89b75e commit b7baa4e

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

app/code/Magento/Ui/Test/Unit/Config/Converter/HtmlContentTest.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,14 @@ public function setUp()
2727

2828
public function testConvert()
2929
{
30-
$dom = new \DOMDocument('1.0', 'UTF-8');
31-
$dom->formatOutput = true;
32-
$dom->load(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'expected.xml');
30+
$xml = '<?xml version="1.0"?>' .
31+
'<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' .
32+
'<block class="Magento\Customer\Block\Adminhtml\Edit\Tab\View" name="customer_edit_tab_view" ' .
33+
'template="Magento_Customer::tab/view.phtml">' .
34+
'<block class="Magento\Customer\Block\Adminhtml\Edit\Tab\View\PersonalInfo" '.
35+
'name="personal_info" template="Magento_Customer::tab/view/personal_info.phtml"/>' .
36+
'</block>' .
37+
'</layout>';
3338
$expectedResult = [
3439
'xsi:type' => 'array',
3540
'item' => [
@@ -41,27 +46,23 @@ public function testConvert()
4146
'name' => [
4247
'xsi:type' => 'string',
4348
'name' => 'block',
44-
'value' => 'customer_edit_tab_view_content',
49+
'value' => 'customer_edit_tab_view',
4550
],
4651
],
4752
];
4853

4954
$dom = new \DOMDocument('1.0', 'UTF-8');
5055
$dom->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'testForm.xml');
5156
$domXpath = new \DOMXPath($dom);
52-
$node = $domXpath->query('//form/htmlContent')->item(0);
57+
$node = $domXpath->query('//form/htmlContent/block')->item(0);
5358

5459
$actualResult = $this->converter->convert($node, []);
5560
$this->assertTrue(isset($actualResult['item']['layout']['value']));
5661

57-
$actualDom = $dom = new \DOMDocument('1.0', 'UTF-8');
58-
$actualDom->formatOutput = true;
59-
$actualDom->loadXML($actualResult['item']['layout']['value']);
62+
// assert xml structures
63+
$this->assertXmlStringEqualsXmlString($xml, $actualResult['item']['layout']['value']);
6064
$actualResult['item']['layout']['value'] = '';
6165

62-
// assert that expected and actual xml are the same
63-
$this->assertSame($dom, $actualDom);
64-
6566
// assert that all expected keys in array are exists
6667
$this->assertEquals($expectedResult, $actualResult);
6768
}

app/code/Magento/Ui/Test/Unit/Config/Converter/_files/expected.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)