Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…to2ce into bugfixes49
  • Loading branch information
sivaschenko committed Aug 31, 2015
2 parents 5acea4a + 79895c4 commit 774b342
Show file tree
Hide file tree
Showing 199 changed files with 44,465 additions and 1,609 deletions.
3 changes: 2 additions & 1 deletion .htaccess
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
############################################
## uncomment the line below to enable developer mode
## overrides deployment configuration mode value
## use command bin/magento deploy:mode:set to switch modes

# SetEnv MAGE_MODE developer

Expand Down
6 changes: 5 additions & 1 deletion app/code/Magento/Backend/Model/View/Result/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ public function setActiveMenu($itemId)
*/
public function addBreadcrumb($label, $title, $link = null)
{
$this->layout->getBlock('breadcrumbs')->addLink($label, $title, $link);
/** @var \Magento\Backend\Block\Widget\Breadcrumbs $block */
$block = $this->layout->getBlock('breadcrumbs');
if ($block) {
$block->addLink($label, $title, $link);
}
return $this;
}

Expand Down
89 changes: 89 additions & 0 deletions app/code/Magento/Backend/Test/Unit/Model/View/Result/PageTest.php
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));
}
}
15 changes: 7 additions & 8 deletions app/code/Magento/Backend/view/adminhtml/layout/admin_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
<update handle="styles" />
<body>
<!-- @todo ui: - delete after bugfix -->
<remove name="legal"/>
<remove name="page.menu"/>
<remove name="header"/>
<remove name="page.title"/>
<remove name="user"/>
<remove name="header.wrapper.scope"/>
<referenceContainer name="legal" remove="true"/>
<referenceContainer name="page.menu" remove="true"/>
<referenceContainer name="header" remove="true"/>
<referenceBlock name="page.title" remove="true"/>
<referenceBlock name="user" remove="true"/>

<remove name="global.search"/>
<remove name="notification.messages"/>
<referenceBlock name="global.search" remove="true"/>
<referenceBlock name="notification.messages" remove="true"/>
<!-- @todo ui: - end -->

<move element="messages" destination="login.content" before="-"/>
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Backend/view/adminhtml/layout/popup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<remove name="header"/>
<remove name="menu"/>
<referenceContainer name="header" remove="true"/>
<referenceBlock name="menu" remove="true"/>
</body>
</page>
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ public function dispatch(\Magento\Framework\App\RequestInterface $request)
}

/**
* @param \Magento\Framework\Phrase|null $title
* @return \Magento\Backend\Model\View\Result\Page
*/
protected function createActionPage()
protected function createActionPage($title = null)
{
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
$resultPage = $this->resultPageFactory->create();
Expand All @@ -91,6 +92,9 @@ protected function createActionPage()
$resultPage->addBreadcrumb(__('Catalog'), __('Catalog'))
->addBreadcrumb(__('Manage Product Attributes'), __('Manage Product Attributes'))
->setActiveMenu('Magento_Catalog::catalog_attributes_attributes');
if (!empty($title)) {
$resultPage->addBreadcrumb($title, $title);
}
}
$resultPage->getConfig()->getTitle()->prepend(__('Product Attributes'));
return $resultPage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ public function execute()

$item = $id ? __('Edit Product Attribute') : __('New Product Attribute');

$resultPage = $this->createActionPage();
$resultPage = $this->createActionPage($item);
$resultPage->getConfig()->getTitle()->prepend($id ? $model->getName() : __('New Product Attribute'));
$resultPage->addBreadcrumb($item, $item);
$resultPage->getLayout()
->getBlock('attribute_edit_js')
->setIsPopup((bool)$this->getRequest()->getParam('popup'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function _validateMassStatus(array $productIds, $status)
*/
public function execute()
{
$productIds = (array) $this->getRequest()->getParam('product');
$productIds = (array) $this->getRequest()->getParam('selected');
$storeId = (int) $this->getRequest()->getParam('store', 0);
$status = (int) $this->getRequest()->getParam('status');

Expand Down
Loading

0 comments on commit 774b342

Please sign in to comment.