Skip to content

Commit 32e3715

Browse files
committed
Merge pull request #43 from magento-mpi/public-pulls
[Github] Merge public Github commits
2 parents 3fcf0db + ee882bf commit 32e3715

File tree

7 files changed

+142
-4
lines changed

7 files changed

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