Skip to content

Commit 615902b

Browse files
committed
Merge branch '2.3-develop-phpunit9' of github.com:magento-commerce/magento2ce into merge-from-phpunit9
2 parents da1a424 + eb3a285 commit 615902b

File tree

3 files changed

+76
-11
lines changed

3 files changed

+76
-11
lines changed

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ abstract class AbstractProductExportImportTestCase extends \PHPUnit\Framework\Te
6868
*/
6969
private $writer;
7070

71+
/**
72+
* @var string
73+
*/
74+
private $csvFile;
75+
7176
/**
7277
* @inheritdoc
7378
*/
@@ -87,6 +92,11 @@ protected function setUp(): void
8792
protected function tearDown(): void
8893
{
8994
$this->executeFixtures($this->fixtures, true);
95+
96+
if ($this->csvFile !== null) {
97+
$directoryWrite = $this->fileSystem->getDirectoryWrite(DirectoryList::VAR_DIR);
98+
$directoryWrite->delete($this->csvFile);
99+
}
90100
}
91101

92102
/**
@@ -101,20 +111,53 @@ protected function tearDown(): void
101111
* @param string[] $skippedAttributes
102112
* @return void
103113
* @dataProvider exportImportDataProvider
114+
* @throws \Magento\Framework\Exception\NoSuchEntityException
104115
*/
105116
public function testImportExport(array $fixtures, array $skus, array $skippedAttributes = []): void
106117
{
118+
$this->csvFile = null;
107119
$this->fixtures = $fixtures;
108120
$this->executeFixtures($fixtures);
109121
$this->modifyData($skus);
110122
$skippedAttributes = array_merge(self::$skippedAttributes, $skippedAttributes);
111123
$csvFile = $this->executeExportTest($skus, $skippedAttributes);
112124

113125
$this->executeImportReplaceTest($skus, $skippedAttributes, false, $csvFile);
114-
$this->executeImportReplaceTest($skus, $skippedAttributes, true, $csvFile);
115126
$this->executeImportDeleteTest($skus, $csvFile);
116127
}
117128

129+
/**
130+
* Run import replace with pagination tests.
131+
*
132+
* @magentoAppArea adminhtml
133+
* @magentoDbIsolation disabled
134+
* @magentoAppIsolation enabled
135+
*
136+
* @param array $fixtures
137+
* @param string[] $skus
138+
* @param string[] $skippedAttributes
139+
* @dataProvider importReplaceDataProvider
140+
* @throws \Magento\Framework\Exception\NoSuchEntityException
141+
*/
142+
public function testImportReplaceWithPagination(array $fixtures, array $skus, array $skippedAttributes = []): void
143+
{
144+
$this->fixtures = $fixtures;
145+
$this->executeFixtures($fixtures);
146+
$this->modifyData($skus);
147+
$skippedAttributes = array_merge(self::$skippedAttributes, $skippedAttributes);
148+
$this->executeImportReplaceTest($skus, $skippedAttributes, true);
149+
}
150+
151+
/**
152+
* Data provider for import replaces tests.
153+
*
154+
* @return array
155+
*/
156+
public function importReplaceDataProvider()
157+
{
158+
return $this->exportImportDataProvider();
159+
}
160+
118161
/**
119162
* Provide data for import/export.
120163
*
@@ -209,7 +252,7 @@ private function assertEqualsOtherThanSkippedAttributes(
209252

210253
$this->assertEquals(
211254
$value,
212-
isset($actual[$key]) ? $actual[$key] : null,
255+
$actual[$key] ?? null,
213256
'Assert value at key - ' . $key . ' failed'
214257
);
215258
}
@@ -378,6 +421,7 @@ protected function executeImportReplaceTest(
378421
private function exportProducts(\Magento\CatalogImportExport\Model\Export\Product $exportProduct = null)
379422
{
380423
$csvfile = uniqid('importexport_') . '.csv';
424+
$this->csvFile = $csvfile;
381425

382426
$exportProduct = $exportProduct ?: $this->objectManager->create(
383427
\Magento\CatalogImportExport\Model\Export\Product::class

dev/tests/integration/testsuite/Magento/ConfigurableImportExport/Model/ConfigurableTest.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,19 @@ protected function assertEqualsSpecificAttributes(
100100
}
101101

102102
/**
103-
* @inheritdoc
103+
* @magentoAppArea adminhtml
104+
* @magentoDbIsolation disabled
105+
* @magentoAppIsolation enabled
106+
*
107+
* @param array $fixtures
108+
* @param string[] $skus
109+
* @param string[] $skippedAttributes
110+
* @dataProvider importReplaceDataProvider
111+
* @throws \Magento\Framework\Exception\NoSuchEntityException
104112
*/
105-
protected function executeImportReplaceTest(
106-
$skus,
107-
$skippedAttributes,
108-
$usePagination = false,
109-
string $csvfile = null
110-
) {
111-
$skippedAttributes = array_merge($skippedAttributes, ['_cache_instance_product_set_attributes']);
112-
parent::executeImportReplaceTest($skus, $skippedAttributes, $usePagination, $csvfile);
113+
public function testImportReplaceWithPagination(array $fixtures, array $skus, array $skippedAttributes = []): void
114+
{
115+
$skippedAttributesExtended = array_merge($skippedAttributes, ['_cache_instance_product_set_attributes']);
116+
parent::testImportReplaceWithPagination($fixtures, $skus, $skippedAttributesExtended);
113117
}
114118
}

dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,23 @@ public function testImportExport(array $fixtures, array $skus, array $skippedAtt
4949
parent::testImportExport($fixtures, $skus, $skippedAttributes);
5050
}
5151

52+
/**
53+
* @magentoAppArea adminhtml
54+
* @magentoDbIsolation enabled
55+
* @magentoAppIsolation enabled
56+
*
57+
* @param array $fixtures
58+
* @param string[] $skus
59+
* @param string[] $skippedAttributes
60+
* @dataProvider importReplaceDataProvider
61+
*
62+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
63+
*/
64+
public function testImportReplaceWithPagination(array $fixtures, array $skus, array $skippedAttributes = []) : void
65+
{
66+
$this->markTestSkipped('Uncomment after MAGETWO-38240 resolved');
67+
}
68+
5269
/**
5370
* @inheritdoc
5471
*/

0 commit comments

Comments
 (0)