Skip to content

Commit 9b078f3

Browse files
committed
Merge remote-tracking branch 'origin/MC-20660' into 2.3-develop-com-pr3
2 parents 71f9784 + 008a04c commit 9b078f3

File tree

2 files changed

+321
-18
lines changed

2 files changed

+321
-18
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/ReadHandlerTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Catalog\Api\Data\ProductInterfaceFactory;
1212
use Magento\Catalog\Api\ProductRepositoryInterface;
1313
use Magento\Catalog\Model\ResourceModel\Product as ProductResource;
14+
use Magento\Catalog\Model\ResourceModel\Product\Gallery;
1415
use Magento\Framework\EntityManager\MetadataPool;
1516
use Magento\Store\Api\StoreRepositoryInterface;
1617
use Magento\Store\Model\Store;
@@ -19,6 +20,8 @@
1920

2021
/**
2122
* Provide tests for loading gallery images on product load.
23+
*
24+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2225
*/
2326
class ReadHandlerTest extends \PHPUnit\Framework\TestCase
2427
{
@@ -47,6 +50,11 @@ class ReadHandlerTest extends \PHPUnit\Framework\TestCase
4750
*/
4851
private $productResource;
4952

53+
/**
54+
* @var Gallery
55+
*/
56+
private $galleryResource;
57+
5058
/**
5159
* @var StoreRepositoryInterface
5260
*/
@@ -67,6 +75,7 @@ protected function setUp()
6775
$this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
6876
$this->productFactory = $this->objectManager->get(ProductInterfaceFactory::class);
6977
$this->productResource = $this->objectManager->get(ProductResource::class);
78+
$this->galleryResource = $this->objectManager->create(Gallery::class);
7079
$this->storeRepository = $this->objectManager->create(StoreRepositoryInterface::class);
7180
$this->productLinkField = $this->objectManager->get(MetadataPool::class)
7281
->getMetadata(ProductInterface::class)
@@ -261,6 +270,20 @@ public function executeOnStoreViewDataProvider(): array
261270
];
262271
}
263272

273+
/**
274+
* @inheritdoc
275+
*/
276+
protected function tearDown()
277+
{
278+
parent::tearDown();
279+
$this->galleryResource->getConnection()
280+
->delete($this->galleryResource->getTable(Gallery::GALLERY_TABLE));
281+
$this->galleryResource->getConnection()
282+
->delete($this->galleryResource->getTable(Gallery::GALLERY_VALUE_TABLE));
283+
$this->galleryResource->getConnection()
284+
->delete($this->galleryResource->getTable(Gallery::GALLERY_VALUE_TO_ENTITY_TABLE));
285+
}
286+
264287
/**
265288
* Returns product for testing.
266289
*

0 commit comments

Comments
 (0)