Skip to content

Commit f911050

Browse files
author
Valeriy Nayda
committed
MAGETWO-40177: Prepare pull request
-- fix static tests, fix unit tests
1 parent a05b1fb commit f911050

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

app/code/Magento/Catalog/Model/Plugin/PageCache/Product/Action.php renamed to app/code/Magento/Catalog/Plugin/Model/Product/Action/UpdateAttributesFlushCache.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
* Copyright © 2015 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
namespace Magento\Catalog\Model\Plugin\PageCache\Product;
6+
namespace Magento\Catalog\Plugin\Model\Product\Action;
87

98
use Magento\Catalog\Model\Product;
9+
use Magento\Catalog\Model\Product\Action;
1010
use Magento\Indexer\Model\CacheContext;
1111
use Magento\Framework\Event\ManagerInterface as EventManager;
1212

13-
class Action
13+
class UpdateAttributesFlushCache
1414
{
1515
/**
1616
* @var CacheContext
@@ -35,17 +35,17 @@ public function __construct(
3535
}
3636

3737
/**
38-
* @param Product\Action $subject
38+
* @param Action $subject
3939
* @param \Closure $proceed
4040
* @param array $productIds
4141
* @param array $attrData
4242
* @param int $storeId
43-
* @return Product\Action
43+
* @return Action
4444
*
4545
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4646
*/
4747
public function aroundUpdateAttributes(
48-
Product\Action $subject,
48+
Action $subject,
4949
\Closure $proceed,
5050
$productIds,
5151
$attrData,

app/code/Magento/Catalog/Test/Unit/Model/Plugin/PageCache/Product/ActionTest.php renamed to app/code/Magento/Catalog/Test/Unit/Plugin/Model/Product/Action/UpdateAttributesFlushCacheTest.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* Copyright © 2015 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
namespace Magento\Catalog\Test\Unit\Model\Plugin\PageCache\Product;
6+
namespace Magento\Catalog\Test\Unit\Plugin\Model\Product\Action;
77

88
use Magento\Catalog\Model\Product;
99

10-
class ActionTest extends \PHPUnit_Framework_TestCase
10+
class UpdateAttributesFlushCacheTest extends \PHPUnit_Framework_TestCase
1111
{
1212
public function testAroundUpdateAttributes()
1313
{
@@ -23,12 +23,19 @@ public function testAroundUpdateAttributes()
2323
->with(Product::CACHE_TAG, $productIds);
2424

2525

26-
$eventManagerMock = $this->getMock('Magento\Framework\Event\ManagerInterface', [], [], '', false);
26+
$eventManagerMock = $this->getMock('Magento\Framework\Event\ManagerInterface');
2727
$eventManagerMock->expects($this->once())
2828
->method('dispatch')
2929
->with('clean_cache_by_tags', ['object' => $cacheContextMock]);
3030

31-
$model = new \Magento\Catalog\Model\Plugin\PageCache\Product\Action($cacheContextMock, $eventManagerMock);
31+
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
32+
$model = $objectManager->getObject(
33+
'Magento\Catalog\Plugin\Model\Product\Action\UpdateAttributesFlushCache',
34+
[
35+
'cacheContext' => $cacheContextMock,
36+
'eventManager' => $eventManagerMock,
37+
]
38+
);
3239

3340
$closureMock = function () use ($productActionMock) {
3441
return $productActionMock;

app/code/Magento/Catalog/etc/adminhtml/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@
7777
</arguments>
7878
</type>
7979
<type name="Magento\Catalog\Model\Product\Action">
80-
<plugin name="invalidate_pagecache_after_update_product_attributes" type="Magento\Catalog\Model\Plugin\PageCache\Product\Action" />
80+
<plugin name="invalidate_pagecache_after_update_product_attributes" type="Magento\Catalog\Plugin\Model\Product\Action\UpdateAttributesFlushCache"/>
8181
</type>
8282
</config>

0 commit comments

Comments
 (0)