-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #538 from magento-tango/MAGETWO-41082
[Tango] S58 - Support Tool, Child Containers, Bug Fixes
- Loading branch information
Showing
66 changed files
with
1,447 additions
and
748 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
app/code/Magento/Backend/Test/Unit/Model/View/Result/PageTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Backend\Test\Unit\Model\View\Result; | ||
|
||
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; | ||
|
||
class PageTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var \Magento\Backend\Model\View\Result\Page | ||
*/ | ||
protected $resultPage; | ||
|
||
/** | ||
* @var \Magento\Framework\View\Element\Template\Context | ||
*/ | ||
protected $context; | ||
|
||
/** | ||
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager | ||
*/ | ||
protected $objectManagerHelper; | ||
|
||
/** | ||
* @var \Magento\Framework\View\LayoutInterface|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
protected $layoutMock; | ||
|
||
/** | ||
* @var \Magento\Backend\Block\Widget\Breadcrumbs|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
protected $breadcrumbsBlockMock; | ||
|
||
protected function setUp() | ||
{ | ||
$this->layoutMock = $this->getMockBuilder('Magento\Framework\View\LayoutInterface') | ||
->setMethods(['setGeneratorPool']) | ||
->getMockForAbstractClass(); | ||
$this->breadcrumbsBlockMock = $this->getMockBuilder('Magento\Backend\Block\Widget\Breadcrumbs') | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
|
||
$this->objectManagerHelper = new ObjectManagerHelper($this); | ||
$this->context = $this->objectManagerHelper->getObject( | ||
'Magento\Framework\View\Element\Template\Context', | ||
['layout' => $this->layoutMock] | ||
); | ||
$this->resultPage = $this->objectManagerHelper->getObject( | ||
'Magento\Backend\Model\View\Result\Page', | ||
['context' => $this->context] | ||
); | ||
} | ||
|
||
public function testAddBreadcrumb() | ||
{ | ||
$label = 'label'; | ||
$title = 'title'; | ||
$link = '/link'; | ||
|
||
$this->layoutMock->expects($this->once()) | ||
->method('getBlock') | ||
->with('breadcrumbs') | ||
->willReturn($this->breadcrumbsBlockMock); | ||
$this->breadcrumbsBlockMock->expects($this->once()) | ||
->method('addLink') | ||
->with($label, $title, $link) | ||
->willReturnSelf(); | ||
|
||
$this->assertSame($this->resultPage, $this->resultPage->addBreadcrumb($label, $title, $link)); | ||
} | ||
|
||
public function testAddBreadcrumbNoBlock() | ||
{ | ||
$label = 'label'; | ||
$title = 'title'; | ||
|
||
$this->layoutMock->expects($this->once()) | ||
->method('getBlock') | ||
->with('breadcrumbs') | ||
->willReturn(false); | ||
$this->breadcrumbsBlockMock->expects($this->never()) | ||
->method('addLink'); | ||
|
||
$this->assertSame($this->resultPage, $this->resultPage->addBreadcrumb($label, $title)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.