Skip to content

Commit 403ffb5

Browse files
author
Oleksandr Iegorov
committed
MAGETWO-56702: Around plugins refactoring: refactoring and unit test fixing/coverage
1 parent 32890b4 commit 403ffb5

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/StorageTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
use Magento\CatalogUrlRewrite\Model\Category\Product;
1515
use Magento\CatalogUrlRewrite\Model\ResourceModel\Category\Product as ProductResourceModel;
1616

17+
/**
18+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
19+
*/
1720
class StorageTest extends \PHPUnit_Framework_TestCase
1821
{
1922
/**

app/code/Magento/ConfigurableProduct/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/Option/Plugin/ConfigurableProductTest.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\ConfigurableProduct\Test\Unit\Model\Quote\Item\QuantityValidator\Initializer\Option\Plugin;
77

8+
use \Magento\ConfigurableProduct\Model\Quote\Item\QuantityValidator\Initializer\Option\Plugin\ConfigurableProduct
9+
as InitializerOptionPlugin;
10+
811
class ConfigurableProductTest extends \PHPUnit_Framework_TestCase
912
{
1013
/**
@@ -22,24 +25,36 @@ public function testAfterGetStockItem(array $data)
2225
);
2326

2427
$quoteItemMock = $this->getMock(
25-
\Magento\Quote\Model\Quote\Item::class, ['getProductType', '__wakeup'], [], '', false
28+
\Magento\Quote\Model\Quote\Item::class,
29+
['getProductType', '__wakeup'],
30+
[],
31+
'',
32+
false
2633
);
2734
$quoteItemMock->expects($this->once())
2835
->method('getProductType')
2936
->will($this->returnValue($data['product_type']));
3037

3138
$stockItemMock = $this->getMock(
32-
\Magento\CatalogInventory\Model\Stock\Item::class, ['setProductName', '__wakeup'], [], '', false
39+
\Magento\CatalogInventory\Model\Stock\Item::class,
40+
['setProductName', '__wakeup'],
41+
[],
42+
'',
43+
false
3344
);
3445
$matcherMethod = $data['matcher_method'];
3546
$stockItemMock->expects($this->$matcherMethod())
3647
->method('setProductName');
3748

3849
$optionMock = $this->getMock(
39-
\Magento\Quote\Model\Quote\Item\Option::class, ['getProduct', '__wakeup'], [], '', false
50+
\Magento\Quote\Model\Quote\Item\Option::class,
51+
['getProduct', '__wakeup'],
52+
[],
53+
'',
54+
false
4055
);
4156

42-
$model = new \Magento\ConfigurableProduct\Model\Quote\Item\QuantityValidator\Initializer\Option\Plugin\ConfigurableProduct();
57+
$model = new InitializerOptionPlugin();
4358
$model->afterGetStockItem($subjectMock, $stockItemMock, $optionMock, $quoteItemMock, 0);
4459
}
4560

0 commit comments

Comments
 (0)