diff --git a/app/code/Magento/Catalog/Plugin/Model/AttributeSetRepository/RemoveProducts.php b/app/code/Magento/Catalog/Plugin/Model/AttributeSetRepository/RemoveProducts.php index bc6de17f90cfede8926865e821652beb00ffb62d..342b703ded0a50d409fbed14868af74aa80130a7 100644 --- a/app/code/Magento/Catalog/Plugin/Model/AttributeSetRepository/RemoveProducts.php +++ b/app/code/Magento/Catalog/Plugin/Model/AttributeSetRepository/RemoveProducts.php @@ -37,21 +37,20 @@ class RemoveProducts * Delete related to specific attribute set products, if attribute set was removed successfully. * * @param AttributeSetRepositoryInterface $subject - * @param \Closure $proceed + * @param bool $result * @param AttributeSetInterface $attributeSet * @return bool * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundDelete( + public function afterDelete( AttributeSetRepositoryInterface $subject, - \Closure $proceed, + bool $result, AttributeSetInterface $attributeSet ) { /** @var Collection $productCollection */ $productCollection = $this->collectionFactory->create(); $productCollection->addFieldToFilter('attribute_set_id', ['eq' => $attributeSet->getId()]); - $result = $proceed($attributeSet); $productCollection->delete(); return $result; diff --git a/app/code/Magento/Catalog/Test/Unit/Plugin/Model/AttributeSetRepository/RemoveProductsTest.php b/app/code/Magento/Catalog/Test/Unit/Plugin/Model/AttributeSetRepository/RemoveProductsTest.php index a8eb757646e7421f5ae913e3b8f61afbacc2e883..712aeba59dffe47dbf58defffcf489519d55e3b6 100644 --- a/app/code/Magento/Catalog/Test/Unit/Plugin/Model/AttributeSetRepository/RemoveProductsTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Plugin/Model/AttributeSetRepository/RemoveProductsTest.php @@ -50,7 +50,7 @@ class RemoveProductsTest extends TestCase /** * Test plugin will delete all related products for given attribute set. */ - public function testAroundDelete() + public function testAfterDelete() { $attributeSetId = '1'; @@ -73,10 +73,6 @@ class RemoveProductsTest extends TestCase ->disableOriginalConstructor() ->getMockForAbstractClass(); - $proceed = function () { - return true; - }; - /** @var AttributeSetInterface|\PHPUnit_Framework_MockObject_MockObject $attributeSet */ $attributeSet = $this->getMockBuilder(AttributeSetInterface::class) ->setMethods(['getId']) @@ -86,6 +82,6 @@ class RemoveProductsTest extends TestCase ->method('getId') ->willReturn($attributeSetId); - $this->testSubject->aroundDelete($attributeSetRepository, $proceed, $attributeSet); + self::assertTrue($this->testSubject->afterDelete($attributeSetRepository, true, $attributeSet)); } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Plugin/Model/AttributeSetRepository/RemoveProductsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Plugin/Model/AttributeSetRepository/RemoveProductsTest.php index 2896716a01a04943c0acbe505c1e788265369338..4e8eaf70824db513958f25e29947dc8ad0907912 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Plugin/Model/AttributeSetRepository/RemoveProductsTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Plugin/Model/AttributeSetRepository/RemoveProductsTest.php @@ -36,7 +36,7 @@ class RemoveProductsTest extends TestCase * * @magentoDataFixture Magento/Catalog/_files/attribute_set_with_product.php */ - public function testAroundDelete() + public function testAfterDelete() { $attributeSet = Bootstrap::getObjectManager()->get(Set::class); $attributeSet->load('empty_attribute_set', 'attribute_set_name');