Skip to content

Commit

Permalink
MAGETWO-43793: [github] broken references when viewing admin after in…
Browse files Browse the repository at this point in the history
…itial install #1795
  • Loading branch information
Bohdan Korablov committed Oct 23, 2015
1 parent dae56d5 commit b74a6ff
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
8 changes: 4 additions & 4 deletions lib/internal/Magento/Framework/View/Layout/Data/Structure.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ class Structure extends DataStructure
protected $logger;

/**
* @var \Magento\Framework\App\State
* @var State
*/
protected $state;

/**
* Constructor
*
* @param \Psr\Log\LoggerInterface $logger
* @param \Magento\Framework\App\State $state
* @param State $state
* @param array $elements
*/
public function __construct(
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\App\State $state,
State $state,
array $elements = null
) {
$this->logger = $logger;
Expand Down Expand Up @@ -118,7 +118,7 @@ public function reorderChildElement($parentName, $childName, $offsetOrSibling, $
if ($childName !== $sibling) {
$siblingParentName = $this->getParentId($sibling);
if ($parentName !== $siblingParentName) {
if ($this->state->getMode() == State::MODE_DEVELOPER) {
if ($this->state->getMode() === State::MODE_DEVELOPER) {
$this->logger->critical(
"Broken reference: the '{$childName}' tries to reorder itself towards '{$sibling}', but " .
"their parents are different: '{$parentName}' and '{$siblingParentName}' respectively."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class Helper

/**
* @param \Psr\Log\LoggerInterface $logger
* @param \Magento\Framework\App\State $state
* @param State $state
*/
public function __construct(
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\App\State $state
State $state
) {
$this->logger = $logger;
$this->state = $state;
Expand Down Expand Up @@ -200,7 +200,7 @@ public function scheduleElement(
} else {
$scheduledStructure->setElementToBrokenParentList($key);

if ($this->state->getMode() == State::MODE_DEVELOPER) {
if ($this->state->getMode() === State::MODE_DEVELOPER) {
$this->logger->critical(
"Broken reference: the '{$name}' element cannot be added as child to '{$parentName}', " .
'because the latter doesn\'t exist'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class StructureTest extends \PHPUnit_Framework_TestCase
protected $loggerMock;

/**
* @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject
* @var State|\PHPUnit_Framework_MockObject_MockObject
*/
protected $stateMock;

Expand Down Expand Up @@ -63,7 +63,6 @@ public function testReorderChildElementLog($loggerExpects, $stateMode)
$this->stateMock->expects($this->once())
->method('getMode')
->willReturn($stateMode);

$this->loggerMock->expects($loggerExpects)
->method('critical')
->with(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class HelperTest extends \PHPUnit_Framework_TestCase
protected $loggerMock;

/**
* @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject
* @var State|\PHPUnit_Framework_MockObject_MockObject
*/
protected $stateMock;

Expand Down Expand Up @@ -173,16 +173,13 @@ public function testScheduleElementLog($loggerExpects, $stateMode)
->method('hasStructureElement')
->with($parentName)
->willReturn(false);

$this->dataStructureMock->expects($this->once())
->method('hasElement')
->with($parentName)
->willReturn(false);

$this->stateMock->expects($this->once())
->method('getMode')
->willReturn($stateMode);

$this->loggerMock->expects($loggerExpects)
->method('critical')
->with(
Expand Down Expand Up @@ -259,7 +256,6 @@ public function testScheduleElement($hasParent, $setAsChild, $toRemoveList, $sib
);
$this->scheduledStructureMock->expects($this->any())->method('hasStructureElement')->willReturn(true);
$this->scheduledStructureMock->expects($this->once())->method('setElement')->with($key, [$block, $data]);

$this->dataStructureMock->expects($this->once())->method('createElement')->with($key, ['type' => $block]);
$this->dataStructureMock->expects($this->once())
->method('hasElement')
Expand All @@ -269,7 +265,6 @@ public function testScheduleElement($hasParent, $setAsChild, $toRemoveList, $sib
->method('setAsChild')
->with($key, $parentName, $alias)
->willReturn(true);

$this->scheduledStructureMock->expects($this->exactly($toRemoveList))
->method('setElementToBrokenParentList')
->with($key);
Expand Down

0 comments on commit b74a6ff

Please sign in to comment.