Skip to content

Commit

Permalink
Merge pull request magento#328 from magento-south/BUGS
Browse files Browse the repository at this point in the history
[SOUTH] Bugs
  • Loading branch information
slavvka committed Jun 4, 2015
2 parents 4372961 + 7d5df6d commit 3a19534
Show file tree
Hide file tree
Showing 75 changed files with 3,154 additions and 717 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,44 @@
*/
namespace Magento\Catalog\Controller\Adminhtml\Product;

use Magento\Catalog\Helper\Product\Composite;
use Magento\Backend\Model\Session;
use Magento\Backend\App\Action\Context;

class ShowUpdateResult extends \Magento\Catalog\Controller\Adminhtml\Product
{
/** @var Composite */
protected $productCompositeHelper;

/**
* @param Context $context
* @param Builder $productBuilder
* @param Composite $productCompositeHelper
*/
public function __construct(
Context $context,
Builder $productBuilder,
Composite $productCompositeHelper
) {
$this->productCompositeHelper = $productCompositeHelper;
parent::__construct($context, $productBuilder);
}

/**
* Show item update result from updateAction
* in Wishlist and Cart controllers.
*
* @return bool
* @return \Magento\Framework\View\Result\Layout
*/
public function execute()
{
$session = $this->_objectManager->get('Magento\Backend\Model\Session');
if ($session->hasCompositeProductResult()
&& $session->getCompositeProductResult() instanceof \Magento\Framework\Object
$layout = false;
if ($this->_session->hasCompositeProductResult()
&& $this->_session->getCompositeProductResult() instanceof \Magento\Framework\Object
) {
$this->_objectManager->get('Magento\Catalog\Helper\Product\Composite')
->renderUpdateResult($session->getCompositeProductResult());
$session->unsCompositeProductResult();
} else {
$session->unsCompositeProductResult();
return false;
$layout = $this->productCompositeHelper->renderUpdateResult($this->_session->getCompositeProductResult());
}
$this->_session->unsCompositeProductResult();
return $layout;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Test\Unit\Controller\Adminhtml\Product;

use Magento\Catalog\Controller\Adminhtml\Product\ShowUpdateResult;

class ShowUpdateResultTest extends \PHPUnit_Framework_TestCase
{
/** @var \Magento\Backend\App\Action\Context|\PHPUnit_Framework_MockObject_MockObject */
protected $context;

/** @var \Magento\Framework\View\Layout|\PHPUnit_Framework_MockObject_MockObject */
protected $layout;

/** @var \Magento\Backend\Model\Session|\PHPUnit_Framework_MockObject_MockObject */
protected $session;

/** @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject */
protected $request;

/**
* Init session object
*
* @return \PHPUnit_Framework_MockObject_MockObject
*/
protected function getSession()
{
$session = $this->getMock(
'Magento\Backend\Model\Session',
['hasCompositeProductResult', 'getCompositeProductResult', 'unsCompositeProductResult'],
[],
'',
false
);
$session->expects($this->once())
->method('hasCompositeProductResult')
->willReturn(true);
$session->expects($this->once())
->method('unsCompositeProductResult');
$session->expects($this->atLeastOnce())
->method('getCompositeProductResult')
->willReturn(new \Magento\Framework\Object());

return $session;
}

/**
* Init context object
*
* @return \PHPUnit_Framework_MockObject_MockObject
*/
protected function getContext()
{
$productActionMock = $this->getMock('Magento\Catalog\Model\Product\Action', [], [], '', false);
$objectManagerMock = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface');
$objectManagerMock->expects($this->any())
->method('get')
->willreturn($productActionMock);

$eventManager = $this->getMockForAbstractClass('Magento\Framework\Event\Manager', ['dispatch'], '', false);

$eventManager->expects($this->any())
->method('dispatch')
->willReturnSelf();

$this->request = $this->getMock(
'Magento\Framework\App\Request\Http',
['getParam', 'getPost', 'getFullActionName', 'getPostValue'],
[],
'',
false
);

$responseInterfaceMock = $this->getMock(
'Magento\Framework\App\ResponseInterface',
['setRedirect', 'sendResponse'],
[],
'',
false
);

$managerInterfaceMock = $this->getMock('Magento\Framework\Message\ManagerInterface');
$this->session = $this->getSession();
$actionFlagMock = $this->getMock('Magento\Framework\App\ActionFlag', [], [], '', false);
$helperDataMock = $this->getMock('Magento\Backend\Helper\Data', [], [], '', false);
$this->context = $this->getMock(
'Magento\Backend\App\Action\Context',
[
'getRequest',
'getResponse',
'getObjectManager',
'getEventManager',
'getMessageManager',
'getSession',
'getActionFlag',
'getHelper',
'getTitle',
'getView',
'getResultRedirectFactory'
],
[],
'',
false
);

$this->context->expects($this->any())
->method('getEventManager')
->willReturn($eventManager);
$this->context->expects($this->any())
->method('getRequest')
->willReturn($this->request);
$this->context->expects($this->any())
->method('getResponse')
->willReturn($responseInterfaceMock);
$this->context->expects($this->any())
->method('getObjectManager')
->willReturn($objectManagerMock);

$this->context->expects($this->any())
->method('getMessageManager')
->willReturn($managerInterfaceMock);
$this->context->expects($this->any())
->method('getSession')
->willReturn($this->session);
$this->context->expects($this->any())
->method('getActionFlag')
->willReturn($actionFlagMock);
$this->context->expects($this->any())
->method('getHelper')
->willReturn($helperDataMock);

return $this->context;
}

public function testExecute()
{
$productCompositeHelper = $this->getMock('Magento\Catalog\Helper\Product\Composite', [], [], '', false);
$productCompositeHelper->expects($this->once())
->method('renderUpdateResult');

$productBuilder = $this->getMock('Magento\Catalog\Controller\Adminhtml\Product\Builder', [], [], '', false);
$context = $this->getContext();

/** @var \Magento\Catalog\Controller\Adminhtml\Product\ShowUpdateResult $controller */
$controller = new ShowUpdateResult($context, $productBuilder, $productCompositeHelper);
$controller->execute();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -392,14 +392,13 @@ ProductConfigure.prototype = {
if (Object.isFunction(this.onLoadIFrameCallback[this.current.listType])) {
this.onLoadIFrameCallback[this.current.listType](response);
}

document.fire(this.current.listType + ':afterIFrameLoaded');
}

// Hide loader
jQuery(this.blockForm).trigger('processStop');

this.clean('current');
this.initialize();
},

/**
Expand Down
14 changes: 7 additions & 7 deletions app/code/Magento/Cms/Api/BlockRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ interface BlockRepositoryInterface
/**
* Save block.
*
* @param Data\BlockInterface $block
* @return Data\BlockInterface
* @param \Magento\Cms\Api\Data\BlockInterface $block
* @return \Magento\Cms\Api\Data\BlockInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function save(Data\BlockInterface $block);
Expand All @@ -26,24 +26,24 @@ public function save(Data\BlockInterface $block);
* Retrieve block.
*
* @param int $blockId
* @return Data\BlockInterface
* @return \Magento\Cms\Api\Data\BlockInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getById($blockId);

/**
* Retrieve blocks matching the specified criteria.
*
* @param SearchCriteriaInterface $searchCriteria
* @return \Magento\Framework\Api\SearchResultsInterface
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
* @return \Magento\Cms\Api\Data\BlockSearchResultsInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getList(SearchCriteriaInterface $searchCriteria);
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria);

/**
* Delete block.
*
* @param Data\BlockInterface $block
* @param \Magento\Cms\Api\Data\BlockInterface $block
* @return bool true on success
* @throws \Magento\Framework\Exception\LocalizedException
*/
Expand Down
12 changes: 6 additions & 6 deletions app/code/Magento/Cms/Api/Data/BlockInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface BlockInterface
/**
* Get ID
*
* @return int
* @return int|null
*/
public function getId();

Expand All @@ -40,35 +40,35 @@ public function getIdentifier();
/**
* Get title
*
* @return string
* @return string|null
*/
public function getTitle();

/**
* Get content
*
* @return string
* @return string|null
*/
public function getContent();

/**
* Get creation time
*
* @return string
* @return string|null
*/
public function getCreationTime();

/**
* Get update time
*
* @return string
* @return string|null
*/
public function getUpdateTime();

/**
* Is active
*
* @return bool
* @return bool|null
*/
public function isActive();

Expand Down
Loading

0 comments on commit 3a19534

Please sign in to comment.