Skip to content

Commit 3a19534

Browse files
committed
Merge pull request #328 from magento-south/BUGS
[SOUTH] Bugs
2 parents 4372961 + 7d5df6d commit 3a19534

File tree

75 files changed

+3154
-717
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+3154
-717
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/ShowUpdateResult.php

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,44 @@
66
*/
77
namespace Magento\Catalog\Controller\Adminhtml\Product;
88

9+
use Magento\Catalog\Helper\Product\Composite;
10+
use Magento\Backend\Model\Session;
11+
use Magento\Backend\App\Action\Context;
12+
913
class ShowUpdateResult extends \Magento\Catalog\Controller\Adminhtml\Product
1014
{
15+
/** @var Composite */
16+
protected $productCompositeHelper;
17+
18+
/**
19+
* @param Context $context
20+
* @param Builder $productBuilder
21+
* @param Composite $productCompositeHelper
22+
*/
23+
public function __construct(
24+
Context $context,
25+
Builder $productBuilder,
26+
Composite $productCompositeHelper
27+
) {
28+
$this->productCompositeHelper = $productCompositeHelper;
29+
parent::__construct($context, $productBuilder);
30+
}
31+
1132
/**
1233
* Show item update result from updateAction
1334
* in Wishlist and Cart controllers.
1435
*
15-
* @return bool
36+
* @return \Magento\Framework\View\Result\Layout
1637
*/
1738
public function execute()
1839
{
19-
$session = $this->_objectManager->get('Magento\Backend\Model\Session');
20-
if ($session->hasCompositeProductResult()
21-
&& $session->getCompositeProductResult() instanceof \Magento\Framework\Object
40+
$layout = false;
41+
if ($this->_session->hasCompositeProductResult()
42+
&& $this->_session->getCompositeProductResult() instanceof \Magento\Framework\Object
2243
) {
23-
$this->_objectManager->get('Magento\Catalog\Helper\Product\Composite')
24-
->renderUpdateResult($session->getCompositeProductResult());
25-
$session->unsCompositeProductResult();
26-
} else {
27-
$session->unsCompositeProductResult();
28-
return false;
44+
$layout = $this->productCompositeHelper->renderUpdateResult($this->_session->getCompositeProductResult());
2945
}
46+
$this->_session->unsCompositeProductResult();
47+
return $layout;
3048
}
3149
}
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Test\Unit\Controller\Adminhtml\Product;
7+
8+
use Magento\Catalog\Controller\Adminhtml\Product\ShowUpdateResult;
9+
10+
class ShowUpdateResultTest extends \PHPUnit_Framework_TestCase
11+
{
12+
/** @var \Magento\Backend\App\Action\Context|\PHPUnit_Framework_MockObject_MockObject */
13+
protected $context;
14+
15+
/** @var \Magento\Framework\View\Layout|\PHPUnit_Framework_MockObject_MockObject */
16+
protected $layout;
17+
18+
/** @var \Magento\Backend\Model\Session|\PHPUnit_Framework_MockObject_MockObject */
19+
protected $session;
20+
21+
/** @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject */
22+
protected $request;
23+
24+
/**
25+
* Init session object
26+
*
27+
* @return \PHPUnit_Framework_MockObject_MockObject
28+
*/
29+
protected function getSession()
30+
{
31+
$session = $this->getMock(
32+
'Magento\Backend\Model\Session',
33+
['hasCompositeProductResult', 'getCompositeProductResult', 'unsCompositeProductResult'],
34+
[],
35+
'',
36+
false
37+
);
38+
$session->expects($this->once())
39+
->method('hasCompositeProductResult')
40+
->willReturn(true);
41+
$session->expects($this->once())
42+
->method('unsCompositeProductResult');
43+
$session->expects($this->atLeastOnce())
44+
->method('getCompositeProductResult')
45+
->willReturn(new \Magento\Framework\Object());
46+
47+
return $session;
48+
}
49+
50+
/**
51+
* Init context object
52+
*
53+
* @return \PHPUnit_Framework_MockObject_MockObject
54+
*/
55+
protected function getContext()
56+
{
57+
$productActionMock = $this->getMock('Magento\Catalog\Model\Product\Action', [], [], '', false);
58+
$objectManagerMock = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface');
59+
$objectManagerMock->expects($this->any())
60+
->method('get')
61+
->willreturn($productActionMock);
62+
63+
$eventManager = $this->getMockForAbstractClass('Magento\Framework\Event\Manager', ['dispatch'], '', false);
64+
65+
$eventManager->expects($this->any())
66+
->method('dispatch')
67+
->willReturnSelf();
68+
69+
$this->request = $this->getMock(
70+
'Magento\Framework\App\Request\Http',
71+
['getParam', 'getPost', 'getFullActionName', 'getPostValue'],
72+
[],
73+
'',
74+
false
75+
);
76+
77+
$responseInterfaceMock = $this->getMock(
78+
'Magento\Framework\App\ResponseInterface',
79+
['setRedirect', 'sendResponse'],
80+
[],
81+
'',
82+
false
83+
);
84+
85+
$managerInterfaceMock = $this->getMock('Magento\Framework\Message\ManagerInterface');
86+
$this->session = $this->getSession();
87+
$actionFlagMock = $this->getMock('Magento\Framework\App\ActionFlag', [], [], '', false);
88+
$helperDataMock = $this->getMock('Magento\Backend\Helper\Data', [], [], '', false);
89+
$this->context = $this->getMock(
90+
'Magento\Backend\App\Action\Context',
91+
[
92+
'getRequest',
93+
'getResponse',
94+
'getObjectManager',
95+
'getEventManager',
96+
'getMessageManager',
97+
'getSession',
98+
'getActionFlag',
99+
'getHelper',
100+
'getTitle',
101+
'getView',
102+
'getResultRedirectFactory'
103+
],
104+
[],
105+
'',
106+
false
107+
);
108+
109+
$this->context->expects($this->any())
110+
->method('getEventManager')
111+
->willReturn($eventManager);
112+
$this->context->expects($this->any())
113+
->method('getRequest')
114+
->willReturn($this->request);
115+
$this->context->expects($this->any())
116+
->method('getResponse')
117+
->willReturn($responseInterfaceMock);
118+
$this->context->expects($this->any())
119+
->method('getObjectManager')
120+
->willReturn($objectManagerMock);
121+
122+
$this->context->expects($this->any())
123+
->method('getMessageManager')
124+
->willReturn($managerInterfaceMock);
125+
$this->context->expects($this->any())
126+
->method('getSession')
127+
->willReturn($this->session);
128+
$this->context->expects($this->any())
129+
->method('getActionFlag')
130+
->willReturn($actionFlagMock);
131+
$this->context->expects($this->any())
132+
->method('getHelper')
133+
->willReturn($helperDataMock);
134+
135+
return $this->context;
136+
}
137+
138+
public function testExecute()
139+
{
140+
$productCompositeHelper = $this->getMock('Magento\Catalog\Helper\Product\Composite', [], [], '', false);
141+
$productCompositeHelper->expects($this->once())
142+
->method('renderUpdateResult');
143+
144+
$productBuilder = $this->getMock('Magento\Catalog\Controller\Adminhtml\Product\Builder', [], [], '', false);
145+
$context = $this->getContext();
146+
147+
/** @var \Magento\Catalog\Controller\Adminhtml\Product\ShowUpdateResult $controller */
148+
$controller = new ShowUpdateResult($context, $productBuilder, $productCompositeHelper);
149+
$controller->execute();
150+
}
151+
}

app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,14 +392,13 @@ ProductConfigure.prototype = {
392392
if (Object.isFunction(this.onLoadIFrameCallback[this.current.listType])) {
393393
this.onLoadIFrameCallback[this.current.listType](response);
394394
}
395-
396395
document.fire(this.current.listType + ':afterIFrameLoaded');
397396
}
398-
399397
// Hide loader
400398
jQuery(this.blockForm).trigger('processStop');
401399

402400
this.clean('current');
401+
this.initialize();
403402
},
404403

405404
/**

app/code/Magento/Cms/Api/BlockRepositoryInterface.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ interface BlockRepositoryInterface
1616
/**
1717
* Save block.
1818
*
19-
* @param Data\BlockInterface $block
20-
* @return Data\BlockInterface
19+
* @param \Magento\Cms\Api\Data\BlockInterface $block
20+
* @return \Magento\Cms\Api\Data\BlockInterface
2121
* @throws \Magento\Framework\Exception\LocalizedException
2222
*/
2323
public function save(Data\BlockInterface $block);
@@ -26,24 +26,24 @@ public function save(Data\BlockInterface $block);
2626
* Retrieve block.
2727
*
2828
* @param int $blockId
29-
* @return Data\BlockInterface
29+
* @return \Magento\Cms\Api\Data\BlockInterface
3030
* @throws \Magento\Framework\Exception\LocalizedException
3131
*/
3232
public function getById($blockId);
3333

3434
/**
3535
* Retrieve blocks matching the specified criteria.
3636
*
37-
* @param SearchCriteriaInterface $searchCriteria
38-
* @return \Magento\Framework\Api\SearchResultsInterface
37+
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
38+
* @return \Magento\Cms\Api\Data\BlockSearchResultsInterface
3939
* @throws \Magento\Framework\Exception\LocalizedException
4040
*/
41-
public function getList(SearchCriteriaInterface $searchCriteria);
41+
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria);
4242

4343
/**
4444
* Delete block.
4545
*
46-
* @param Data\BlockInterface $block
46+
* @param \Magento\Cms\Api\Data\BlockInterface $block
4747
* @return bool true on success
4848
* @throws \Magento\Framework\Exception\LocalizedException
4949
*/

app/code/Magento/Cms/Api/Data/BlockInterface.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ interface BlockInterface
2626
/**
2727
* Get ID
2828
*
29-
* @return int
29+
* @return int|null
3030
*/
3131
public function getId();
3232

@@ -40,35 +40,35 @@ public function getIdentifier();
4040
/**
4141
* Get title
4242
*
43-
* @return string
43+
* @return string|null
4444
*/
4545
public function getTitle();
4646

4747
/**
4848
* Get content
4949
*
50-
* @return string
50+
* @return string|null
5151
*/
5252
public function getContent();
5353

5454
/**
5555
* Get creation time
5656
*
57-
* @return string
57+
* @return string|null
5858
*/
5959
public function getCreationTime();
6060

6161
/**
6262
* Get update time
6363
*
64-
* @return string
64+
* @return string|null
6565
*/
6666
public function getUpdateTime();
6767

6868
/**
6969
* Is active
7070
*
71-
* @return bool
71+
* @return bool|null
7272
*/
7373
public function isActive();
7474

0 commit comments

Comments
 (0)