Skip to content

Commit e260ac9

Browse files
committed
MAGETWO-56702: Around plugins refactoring: refactoring and unit test fixing/coverage
1 parent 913e6f5 commit e260ac9

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

app/code/Magento/ConfigurableProduct/Model/Plugin/ProductRepositorySave.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
1515
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
1616

17-
/**
18-
* Class ProductRepositorySave
19-
*/
2017
class ProductRepositorySave
2118
{
2219
/**

app/code/Magento/ConfigurableProduct/Test/Unit/Model/Plugin/ProductRepositorySaveTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\ConfigurableProduct\Model\Plugin\ProductRepositorySave;
1515
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
1616
use Magento\ConfigurableProduct\Test\Unit\Model\Product\ProductExtensionAttributes;
17+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1718
use PHPUnit_Framework_MockObject_MockObject as MockObject;
1819

1920
/**
@@ -97,9 +98,12 @@ protected function setUp()
9798

9899
$this->option = $this->getMockForAbstractClass(OptionInterface::class);
99100

100-
$this->plugin = new ProductRepositorySave(
101-
$this->productAttributeRepository,
102-
$this->productFactory
101+
$this->plugin = (new ObjectManager($this))->getObject(
102+
ProductRepositorySave::class,
103+
[
104+
'productAttributeRepository' => $this->productAttributeRepository,
105+
'productFactory' => $this->productFactory
106+
]
103107
);
104108
}
105109

app/code/Magento/ConfigurableProduct/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
</arguments>
6060
</type>
6161
<type name="Magento\Catalog\Api\ProductRepositoryInterface">
62-
<plugin name="configurableProductSaveOptions" sortOrder="10" type="\Magento\ConfigurableProduct\Model\Plugin\ProductRepositorySave"/>
62+
<plugin name="configurableProductSaveOptions" sortOrder="10" type="Magento\ConfigurableProduct\Model\Plugin\ProductRepositorySave"/>
6363
</type>
6464
<type name="Magento\Catalog\Model\Product">
6565
<plugin name="configurable_identity" type="Magento\ConfigurableProduct\Plugin\Model\Product" />

0 commit comments

Comments
 (0)