Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/develop' into MAGETWO-35406
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaroslav Onischenko committed May 15, 2015
2 parents b7f6947 + 05b2964 commit 66225e2
Show file tree
Hide file tree
Showing 93 changed files with 1,926 additions and 1,667 deletions.
24 changes: 24 additions & 0 deletions app/code/Magento/Contact/Block/ContactForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Contact\Block;

use Magento\Framework\View\Element\Template;

/**
* Main contact form block
*/
class ContactForm extends Template
{
/**
* @param Template\Context $context
* @param array $data
*/
public function __construct(Template\Context $context, array $data = [])
{
parent::__construct($context, $data);
$this->_isScopePrivate = true;
}
}
44 changes: 44 additions & 0 deletions app/code/Magento/Contact/Test/Unit/Block/ContactFormTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Contact\Test\Unit\Block;

use Magento\Contact\Block\ContactForm;

class ContactFormTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Magento\Contact\Block\ContactForm
*/
protected $contactForm;

/**
* @var \Magento\Framework\View\Element\Template\Context|\PHPUnit_Framework_MockObject_MockObject
*/
protected $contextMock;

/**
* {@inheritDoc}
*/
protected function setUp()
{
$this->contextMock = $this->getMockBuilder('Magento\Framework\View\Element\Template\Context')
->disableOriginalConstructor()
->getMock();

$this->contactForm = new ContactForm(
$this->contextMock
);
}

/**
* @return void
*/
public function testScope()
{
$this->assertTrue($this->contactForm->isScopePrivate());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</head>
<body>
<referenceContainer name="content">
<block class="Magento\Framework\View\Element\Template" name="contactForm" template="Magento_Contact::form.phtml">
<block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
<container name="form.additional.info" label="Form Additional Info"/>
</block>
</referenceContainer>
Expand Down
61 changes: 0 additions & 61 deletions app/code/Magento/Developer/Model/View/Layout/Plugin.php

This file was deleted.

3 changes: 0 additions & 3 deletions app/code/Magento/Developer/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
<type name="Magento\Framework\View\TemplateEngineFactory">
<plugin name="debug_hints" type="Magento\Developer\Model\TemplateEngine\Plugin\DebugHints" sortOrder="10"/>
</type>
<type name="Magento\Framework\View\Layout">
<plugin name="exception_handler" type="Magento\Developer\Model\View\Layout\Plugin" sortOrder="10"/>
</type>
<type name="Magento\Framework\View\Result\Page">
<arguments>
<argument name="pageConfigRendererFactory" xsi:type="object">Magento\Developer\Model\View\Page\Config\RendererFactory</argument>
Expand Down
26 changes: 16 additions & 10 deletions app/code/Magento/GroupedProduct/Controller/Adminhtml/Edit/Popup.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<?php
/**
*
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\GroupedProduct\Controller\Adminhtml\Edit;

class Popup extends \Magento\Backend\App\AbstractAction
use Magento\Backend\App\AbstractAction;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Registry;
use Magento\Catalog\Model\ProductFactory;
use Psr\Log\LoggerInterface;
use Magento\Framework\Controller\ResultFactory;

class Popup extends AbstractAction
{
/**
* @var \Magento\Framework\Registry
Expand All @@ -30,10 +36,10 @@ class Popup extends \Magento\Backend\App\AbstractAction
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Catalog\Model\ProductFactory $factory,
\Psr\Log\LoggerInterface $logger
Context $context,
Registry $registry,
ProductFactory $factory,
LoggerInterface $logger
) {
$this->registry = $registry;
$this->factory = $factory;
Expand All @@ -54,7 +60,7 @@ protected function _isAllowed()
/**
* Get associated grouped products grid popup
*
* @return void
* @return \Magento\Framework\View\Result\Layout
*/
public function execute()
{
Expand Down Expand Up @@ -84,8 +90,8 @@ public function execute()
$product->setAttributeSetId($setId);
}
$this->registry->register('current_product', $product);

$this->_view->loadLayout(false);
$this->_view->renderLayout();
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
return $resultLayout;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
namespace Magento\GroupedProduct\Test\Unit\Controller\Adminhtml\Edit;

use Magento\Framework\Controller\ResultFactory;

class PopupTest extends \PHPUnit_Framework_TestCase
{
/**
Expand All @@ -17,6 +19,11 @@ class PopupTest extends \PHPUnit_Framework_TestCase
*/
protected $action;

/**
* @var \Magento\Backend\App\Action\Context
*/
protected $context;

/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
Expand All @@ -33,25 +40,46 @@ class PopupTest extends \PHPUnit_Framework_TestCase
protected $registry;

/**
* @var \PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Framework\Controller\ResultFactory|\PHPUnit_Framework_MockObject_MockObject
*/
protected $resultFactoryMock;

/**
* @var \Magento\Framework\View\Result\Layout|\PHPUnit_Framework_MockObject_MockObject
*/
protected $view;
protected $resultLayoutMock;

protected function setUp()
{
$this->request = $this->getMock('Magento\Framework\App\RequestInterface', [], [], '', false);
$this->factory = $this->getMock('Magento\Catalog\Model\ProductFactory', ['create'], [], '', false);
$this->registry = $this->getMock('Magento\Framework\Registry', [], [], '', false);
$this->view = $this->getMock('Magento\Framework\App\ViewInterface', [], [], '', false);
$this->resultFactoryMock = $this->getMockBuilder('Magento\Framework\Controller\ResultFactory')
->disableOriginalConstructor()
->getMock();
$this->resultLayoutMock = $this->getMockBuilder('Magento\Framework\View\Result\Layout')
->disableOriginalConstructor()
->getMock();

$this->resultFactoryMock->expects($this->any())
->method('create')
->with(ResultFactory::TYPE_LAYOUT, [])
->willReturn($this->resultLayoutMock);

$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->context = $this->objectManager->getObject(
'Magento\Backend\App\Action\Context',
[
'request' => $this->request,
'resultFactory' => $this->resultFactoryMock
]
);
$this->action = $this->objectManager->getObject(
'Magento\GroupedProduct\Controller\Adminhtml\Edit\Popup',
[
'request' => $this->request,
'context' => $this->context,
'factory' => $this->factory,
'registry' => $this->registry,
'view' => $this->view
'registry' => $this->registry
]
);
}
Expand Down Expand Up @@ -90,10 +118,7 @@ public function testPopupActionNoProductId()
$this->request->expects($this->at(3))->method('getParam')->with('set')->will($this->returnValue($setId));
$this->registry->expects($this->once())->method('register')->with('current_product', $product);

$this->view->expects($this->once())->method('loadLayout')->with(false);
$this->view->expects($this->once())->method('renderLayout');

$this->action->execute();
$this->assertSame($this->resultLayoutMock, $this->action->execute());
}

public function testPopupActionWithProductIdNoSetId()
Expand Down Expand Up @@ -130,9 +155,6 @@ public function testPopupActionWithProductIdNoSetId()
$this->request->expects($this->at(3))->method('getParam')->with('set')->will($this->returnValue($setId));
$this->registry->expects($this->once())->method('register')->with('current_product', $product);

$this->view->expects($this->once())->method('loadLayout')->with(false);
$this->view->expects($this->once())->method('renderLayout');

$this->action->execute();
$this->assertSame($this->resultLayoutMock, $this->action->execute());
}
}
9 changes: 4 additions & 5 deletions app/code/Magento/ImportExport/Controller/Adminhtml/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\ImportExport\Controller\Adminhtml;

use Magento\Backend\App\Action;

/**
* Export controller
*
* @author Magento Core Team <core@magentocommerce.com>
*/
namespace Magento\ImportExport\Controller\Adminhtml;

class Export extends \Magento\Backend\App\Action
class Export extends Action
{
/**
* Check access (in the ACL) for current user
Expand Down
Loading

0 comments on commit 66225e2

Please sign in to comment.