Skip to content

Commit ee882bf

Browse files
committed
MAGETWO-32829: [GITHUB] Add tests for View\Layout\Reader\Block and slight refactoring #906
- fixed code style and added lost copyright blocks
1 parent 5167e01 commit ee882bf

File tree

3 files changed

+30
-15
lines changed

3 files changed

+30
-15
lines changed

dev/tests/integration/testsuite/Magento/Framework/View/Layout/Reader/BlockTest.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?php
2-
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
36
namespace Magento\Framework\View\Layout\Reader;
47

58
class BlockTest extends \PHPUnit_Framework_TestCase
@@ -17,28 +20,35 @@ class BlockTest extends \PHPUnit_Framework_TestCase
1720
*/
1821
private $readerContext;
1922

23+
/**
24+
* @var string
25+
*/
2026
private $blockName = 'test.block';
27+
28+
/**
29+
* @var string
30+
*/
2131
private $childBlockName = 'test.child.block';
2232

2333
public function setUp()
2434
{
2535
$this->block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
2636
'Magento\Framework\View\Layout\Reader\Block'
2737
);
28-
2938
$this->readerContext = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
3039
'Magento\Framework\View\Layout\Reader\Context'
3140
);
3241
}
3342

3443
public function testInterpretBlockDirective()
3544
{
36-
$pageXml = new \Magento\Framework\View\Layout\Element(__DIR__ . '/_files/_layout_update_block.xml', 0, true);
45+
$pageXml = new \Magento\Framework\View\Layout\Element(
46+
__DIR__ . '/_files/_layout_update_block.xml', 0, true
47+
);
3748
$parentElement = new \Magento\Framework\View\Layout\Element('<page></page>');
3849

3950
foreach ($pageXml->xpath('body/block') as $blockElement) {
4051
$this->assertTrue(in_array($blockElement->getName(), $this->block->getSupportedNodes()));
41-
4252
$this->block->interpret($this->readerContext, $blockElement, $parentElement);
4353
}
4454

@@ -73,7 +83,6 @@ public function testInterpretReferenceBlockDirective()
7383

7484
foreach ($pageXml->xpath('body/*') as $element) {
7585
$this->assertTrue(in_array($element->getName(), $this->block->getSupportedNodes()));
76-
7786
$this->block->interpret($this->readerContext, $element, $parentElement);
7887
}
7988

@@ -88,4 +97,4 @@ public function testInterpretReferenceBlockDirective()
8897
$resultElementData['arguments']
8998
);
9099
}
91-
}
100+
}

dev/tests/integration/testsuite/Magento/Framework/View/Layout/Reader/_files/_layout_update_block.xml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?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">
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">
49
<body>
5-
<block class="Dummy\Class"
6-
name="test.block"
7-
group="test.group"
8-
template="test.phtml"
9-
ttl="3">
10+
<block class="Dummy\Class" name="test.block" group="test.group" template="test.phtml" ttl="3">
1011
<arguments>
1112
<argument name="test_arg" xsi:type="string">test-argument-value</argument>
1213
</arguments>

dev/tests/integration/testsuite/Magento/Framework/View/Layout/Reader/_files/_layout_update_reference.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?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">
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">
49
<body>
510
<block class="Dummy\Class" name="test.block"/>
611
<referenceBlock name="test.block">

0 commit comments

Comments
 (0)