Skip to content

Commit 8323c15

Browse files
author
Yuri Kovsher
committed
Merge remote-tracking branch 'remotes/tango-ce/MAGETWO-33853' into MAGETWO-33812
2 parents 839d51c + a04ae68 commit 8323c15

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

dev/tests/unit/testsuite/Magento/Framework/View/Layout/Reader/PoolTest.php renamed to dev/tests/unit/testsuite/Magento/Framework/View/Layout/ReaderPoolTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
namespace Magento\Framework\View\Layout\Reader;
7+
namespace Magento\Framework\View\Layout;
88

99
use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper;
1010

11-
class PoolTest extends \PHPUnit_Framework_TestCase
11+
class ReaderPoolTest extends \PHPUnit_Framework_TestCase
1212
{
1313
/** @var ObjectManagerHelper */
1414
protected $objectManagerHelper;
@@ -39,7 +39,7 @@ protected function setUp()
3939

4040
public function testInterpret()
4141
{
42-
/** @var Context $contextMock */
42+
/** @var Reader\Context $contextMock */
4343
$contextMock = $this->getMockBuilder('Magento\Framework\View\Layout\Reader\Context')
4444
->disableOriginalConstructor()->getMock();
4545

@@ -52,7 +52,7 @@ public function testInterpret()
5252
*/
5353
$moveReaderMock = $this->getMockBuilder('Magento\Framework\View\Layout\Reader\Move')
5454
->disableOriginalConstructor()->getMock();
55-
$moveReaderMock->expects($this->once())->method('interpret')
55+
$moveReaderMock->expects($this->exactly(2))->method('interpret')
5656
->willReturn($this->returnSelf());
5757
$moveReaderMock->method('getSupportedNodes')
5858
->willReturn(['move']);
@@ -62,13 +62,13 @@ public function testInterpret()
6262
*/
6363
$removeReaderMock = $this->getMockBuilder('Magento\Framework\View\Layout\Reader\Remove')
6464
->disableOriginalConstructor()->getMock();
65-
$removeReaderMock->expects($this->once())->method('interpret')
65+
$removeReaderMock->expects($this->exactly(2))->method('interpret')
6666
->with()
6767
->willReturn($this->returnSelf());
6868
$removeReaderMock->method('getSupportedNodes')
6969
->willReturn(['remove']);
7070

71-
$this->readerFactoryMock->expects($this->any())
71+
$this->readerFactoryMock->expects($this->exactly(2))
7272
->method('create')
7373
->will($this->returnValueMap(
7474
[
@@ -78,5 +78,6 @@ public function testInterpret()
7878
));
7979

8080
$this->pool->interpret($contextMock, $currentElement);
81+
$this->pool->interpret($contextMock, $currentElement);
8182
}
8283
}

lib/internal/Magento/Framework/View/Layout/ReaderPool.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,12 @@ public function getSupportedNodes()
7575
*/
7676
protected function prepareReader($readers)
7777
{
78-
/** @var $reader Layout\ReaderInterface */
79-
foreach ($readers as $readerClass) {
80-
$reader = $this->readerFactory->create($readerClass);
81-
$this->addReader($reader);
78+
if (empty($this->nodeReaders)) {
79+
/** @var $reader Layout\ReaderInterface */
80+
foreach ($readers as $readerClass) {
81+
$reader = $this->readerFactory->create($readerClass);
82+
$this->addReader($reader);
83+
}
8284
}
8385
}
8486

0 commit comments

Comments
 (0)