Skip to content

Commit 7cf9ebf

Browse files
committed
Merge pull request #902 from Vinai/page-config-reader-html
Add integration test for View\Page\Config\Reader\Html (MAGETWO-32720)
2 parents 9685d9c + ffe92e2 commit 7cf9ebf

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Magento\Framework\View\Page\Config\Reader;
4+
5+
6+
class HtmlTest extends \PHPUnit_Framework_TestCase
7+
{
8+
public function testInterpret()
9+
{
10+
/** @var \Magento\Framework\View\Layout\Reader\Context $readerContext */
11+
$readerContext = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
12+
'Magento\Framework\View\Layout\Reader\Context'
13+
);
14+
$pageXml = new \Magento\Framework\View\Layout\Element(__DIR__ . '/_files/_layout_update.xml', 0, true);
15+
$parentElement = new \Magento\Framework\View\Layout\Element('<page></page>');
16+
17+
$html = new Html();
18+
foreach ($pageXml->xpath('html') as $htmlElement) {
19+
$html->interpret($readerContext, $htmlElement, $parentElement);
20+
}
21+
22+
$structure = $readerContext->getPageConfigStructure();
23+
$this->assertEquals(['html' => ['test-name' => 'test-value']], $structure->getElementAttributes());
24+
}
25+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0"?>
2+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
3+
<html>
4+
<attribute name="test-name" value="test-value"/>
5+
</html>
6+
</page>

0 commit comments

Comments
 (0)