Skip to content

Commit 5167e01

Browse files
committed
Merge remote-tracking branch 'github/develop' into public-pulls
2 parents 3fcf0db + 2b16af7 commit 5167e01

File tree

7 files changed

+127
-4
lines changed

7 files changed

+127
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ atlassian*
3232
/pub/media/theme/*
3333
/pub/media/theme_customization/*
3434
!/pub/media/theme_customization/.htaccess
35+
/pub/media/wysiwyg/*
36+
!/pub/media/wysiwyg/.htaccess
3537
/pub/media/tmp/*
3638
!/pub/media/tmp/.htaccess
3739
/pub/static/*

COPYING.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Each Magento source file included in this distribution is licensed under OSL 3.0 or the Magento Enterprise Edition (MEE) license
22

33
http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
4-
Please see <insert file name of the OSL license> for the full text of the OSL 3.0 license or contact license@magentocommerce.com for a copy.
4+
Please see LICENSE.txt for the full text of the OSL 3.0 license or contact license@magentocommerce.com for a copy.
55

6-
Subject to Licensees payment of fees and compliance with the terms and conditions of the MEE License, the MEE License supersedes the OSL 3.0 license for each source file.
6+
Subject to Licensee's payment of fees and compliance with the terms and conditions of the MEE License, the MEE License supersedes the OSL 3.0 license for each source file.
77
Please see <insert file name of the MEE license> for the full text of the MEE License or visit http://magento.com/legal/terms/enterprise.

app/code/Magento/Theme/Block/Html/Topmenu.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public function getHtml($outermostClass = '', $childrenWrapClass = '', $limit =
6262
'page_block_html_topmenu_gethtml_after',
6363
['menu' => $this->_menu, 'transportObject' => $transportObject]
6464
);
65+
$html = $transportObject->getHtml();
6566

6667
return $html;
6768
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?php
2+
3+
namespace Magento\Framework\View\Layout\Reader;
4+
5+
class BlockTest extends \PHPUnit_Framework_TestCase
6+
{
7+
const IDX_TYPE = 0;
8+
const IDX_PARENT = 2;
9+
10+
/**
11+
* @var Block
12+
*/
13+
private $block;
14+
15+
/**
16+
* @var Context
17+
*/
18+
private $readerContext;
19+
20+
private $blockName = 'test.block';
21+
private $childBlockName = 'test.child.block';
22+
23+
public function setUp()
24+
{
25+
$this->block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
26+
'Magento\Framework\View\Layout\Reader\Block'
27+
);
28+
29+
$this->readerContext = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
30+
'Magento\Framework\View\Layout\Reader\Context'
31+
);
32+
}
33+
34+
public function testInterpretBlockDirective()
35+
{
36+
$pageXml = new \Magento\Framework\View\Layout\Element(__DIR__ . '/_files/_layout_update_block.xml', 0, true);
37+
$parentElement = new \Magento\Framework\View\Layout\Element('<page></page>');
38+
39+
foreach ($pageXml->xpath('body/block') as $blockElement) {
40+
$this->assertTrue(in_array($blockElement->getName(), $this->block->getSupportedNodes()));
41+
42+
$this->block->interpret($this->readerContext, $blockElement, $parentElement);
43+
}
44+
45+
$structure = $this->readerContext->getScheduledStructure();
46+
$this->assertArrayHasKey($this->blockName, $structure->getStructure());
47+
$this->assertEquals('block', $structure->getStructure()[$this->blockName][self::IDX_TYPE]);
48+
49+
$resultElementData = $structure->getStructureElementData($this->blockName);
50+
51+
$this->assertEquals(
52+
['group' => 'test.group', 'class' => 'Dummy\Class', 'template' => 'test.phtml', 'ttl' => 3],
53+
$resultElementData['attributes']
54+
);
55+
$this->assertEquals(
56+
['test_arg' => ['name' => 'test_arg', 'xsi:type' => 'string', 'value' => 'test-argument-value']],
57+
$resultElementData['arguments']
58+
);
59+
60+
$this->assertEquals('block', $structure->getStructure()[$this->childBlockName][self::IDX_TYPE]);
61+
$this->assertEquals($this->blockName, $structure->getStructure()[$this->childBlockName][self::IDX_PARENT]);
62+
}
63+
64+
/**
65+
* @depends testInterpretBlockDirective
66+
*/
67+
public function testInterpretReferenceBlockDirective()
68+
{
69+
$pageXml = new \Magento\Framework\View\Layout\Element(
70+
__DIR__ . '/_files/_layout_update_reference.xml', 0, true
71+
);
72+
$parentElement = new \Magento\Framework\View\Layout\Element('<page></page>');
73+
74+
foreach ($pageXml->xpath('body/*') as $element) {
75+
$this->assertTrue(in_array($element->getName(), $this->block->getSupportedNodes()));
76+
77+
$this->block->interpret($this->readerContext, $element, $parentElement);
78+
}
79+
80+
$structure = $this->readerContext->getScheduledStructure();
81+
$this->assertArrayHasKey($this->blockName, $structure->getStructure());
82+
$this->assertEquals('block', $structure->getStructure()[$this->blockName][self::IDX_TYPE]);
83+
84+
$resultElementData = $structure->getStructureElementData($this->blockName);
85+
86+
$this->assertEquals(
87+
['test_arg' => ['name' => 'test_arg', 'xsi:type' => 'string', 'value' => 'test-argument-value']],
88+
$resultElementData['arguments']
89+
);
90+
}
91+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0"?>
2+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
4+
<body>
5+
<block class="Dummy\Class"
6+
name="test.block"
7+
group="test.group"
8+
template="test.phtml"
9+
ttl="3">
10+
<arguments>
11+
<argument name="test_arg" xsi:type="string">test-argument-value</argument>
12+
</arguments>
13+
<block class="Dummy\Class" name="test.child.block"/>
14+
</block>
15+
</body>
16+
</page>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
4+
<body>
5+
<block class="Dummy\Class" name="test.block"/>
6+
<referenceBlock name="test.block">
7+
<arguments>
8+
<argument name="test_arg" xsi:type="string">test-argument-value</argument>
9+
</arguments>
10+
</referenceBlock>
11+
</body>
12+
</page>

lib/internal/Magento/Framework/View/Layout/Reader/Block.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ public function interpret(Context $readerContext, Layout\Element $currentElement
121121
default:
122122
break;
123123
}
124-
return $this->readerPool->interpret($readerContext, $currentElement);
124+
$this->readerPool->interpret($readerContext, $currentElement);
125+
return $this;
125126
}
126127

127128
/**
@@ -174,7 +175,7 @@ protected function scheduleReference(
174175
* Update data for scheduled element
175176
*
176177
* @param Layout\Element $currentElement
177-
* @param array $data
178+
* @param array &$data
178179
* @return array
179180
*/
180181
protected function updateScheduledData($currentElement, array &$data)

0 commit comments

Comments
 (0)