Skip to content

Commit 6431680

Browse files
author
Joan He
committed
Merge remote-tracking branch 'arcticfoxes/MC-19450' into 2.3-develop-pr
2 parents 58cd291 + 8fad1eb commit 6431680

File tree

8 files changed

+59
-80
lines changed

8 files changed

+59
-80
lines changed

app/code/Magento/Elasticsearch/Model/Adapter/Elasticsearch.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public function cleanIndex($storeId, $mappedIndexerId)
199199
// prepare new index name and increase version
200200
$indexPattern = $this->indexNameResolver->getIndexPattern($storeId, $mappedIndexerId);
201201
$version = (int)(str_replace($indexPattern, '', $indexName));
202-
$newIndexName = $indexPattern . ++$version;
202+
$newIndexName = $indexPattern . (++$version);
203203

204204
// remove index if already exists
205205
if ($this->client->indexExists($newIndexName)) {
@@ -350,12 +350,14 @@ protected function prepareIndex($storeId, $indexName, $mappedIndexerId)
350350
{
351351
$this->indexBuilder->setStoreId($storeId);
352352
$settings = $this->indexBuilder->build();
353-
$allAttributeTypes = $this->fieldMapper->getAllAttributesTypes([
354-
'entityType' => $mappedIndexerId,
355-
// Use store id instead of website id from context for save existing fields mapping.
356-
// In future websiteId will be eliminated due to index stored per store
357-
'websiteId' => $storeId
358-
]);
353+
$allAttributeTypes = $this->fieldMapper->getAllAttributesTypes(
354+
[
355+
'entityType' => $mappedIndexerId,
356+
// Use store id instead of website id from context for save existing fields mapping.
357+
// In future websiteId will be eliminated due to index stored per store
358+
'websiteId' => $storeId
359+
]
360+
);
359361
$settings['index']['mapping']['total_fields']['limit'] = $this->getMappingTotalFieldsLimit($allAttributeTypes);
360362
$this->client->createIndex($indexName, ['settings' => $settings]);
361363
$this->client->addFieldsMapping(

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/ElasticsearchTest.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,6 @@ public function testCleanIndex()
283283
->with(1, 'product', [])
284284
->willReturn('indexName_product_1_v');
285285

286-
$this->client->expects($this->once())
287-
->method('isEmptyIndex')
288-
->with('indexName_product_1_v')
289-
->willReturn(false);
290286
$this->client->expects($this->atLeastOnce())
291287
->method('indexExists')
292288
->willReturn(true);
@@ -299,26 +295,6 @@ public function testCleanIndex()
299295
);
300296
}
301297

302-
/**
303-
* Test cleanIndex() method isEmptyIndex is true
304-
*/
305-
public function testCleanIndexTrue()
306-
{
307-
$this->indexNameResolver->expects($this->any())
308-
->method('getIndexName')
309-
->willReturn('indexName_product_1_v');
310-
311-
$this->client->expects($this->once())
312-
->method('isEmptyIndex')
313-
->with('indexName_product_1_v')
314-
->willReturn(true);
315-
316-
$this->assertSame(
317-
$this->model,
318-
$this->model->cleanIndex(1, 'product')
319-
);
320-
}
321-
322298
/**
323299
* Test deleteDocs() method
324300
*/

dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/FlatTest.php

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -349,19 +349,21 @@ private function instantiateCategoryModel()
349349
*/
350350
private function createSubCategoriesInDefaultCategory()
351351
{
352-
$this->executeWithFlatEnabledInAdminArea(function () {
353-
$category = $this->getLoadedDefaultCategory();
354-
355-
$categoryOne = $this->instantiateCategoryModel();
356-
$categoryOne->setName('Category One')->setPath($category->getPath())->setIsActive(true);
357-
$category->getResource()->save($categoryOne);
358-
self::$categoryOne = $categoryOne->getId();
359-
360-
$categoryTwo = $this->instantiateCategoryModel();
361-
$categoryTwo->setName('Category Two')->setPath($categoryOne->getPath())->setIsActive(true);
362-
$category->getResource()->save($categoryTwo);
363-
self::$categoryTwo = $categoryTwo->getId();
364-
});
352+
$this->executeWithFlatEnabledInAdminArea(
353+
function () {
354+
$category = $this->getLoadedDefaultCategory();
355+
356+
$categoryOne = $this->instantiateCategoryModel();
357+
$categoryOne->setName('Category One')->setPath($category->getPath())->setIsActive(true);
358+
$category->getResource()->save($categoryOne);
359+
self::$categoryOne = $categoryOne->getId();
360+
361+
$categoryTwo = $this->instantiateCategoryModel();
362+
$categoryTwo->setName('Category Two')->setPath($categoryOne->getPath())->setIsActive(true);
363+
$category->getResource()->save($categoryTwo);
364+
self::$categoryTwo = $categoryTwo->getId();
365+
}
366+
);
365367
}
366368

367369
/**
@@ -372,11 +374,13 @@ private function createSubCategoriesInDefaultCategory()
372374
*/
373375
private function moveSubCategoriesInDefaultCategory()
374376
{
375-
$this->executeWithFlatEnabledInAdminArea(function () {
376-
$this->createSubCategoriesInDefaultCategory();
377-
$categoryTwo = $this->getLoadedCategory(self::$categoryTwo);
378-
$categoryTwo->move(self::$defaultCategoryId, self::$categoryOne);
379-
});
377+
$this->executeWithFlatEnabledInAdminArea(
378+
function () {
379+
$this->createSubCategoriesInDefaultCategory();
380+
$categoryTwo = $this->getLoadedCategory(self::$categoryTwo);
381+
$categoryTwo->move(self::$defaultCategoryId, self::$categoryOne);
382+
}
383+
);
380384
}
381385

382386
/**
@@ -387,10 +391,12 @@ private function moveSubCategoriesInDefaultCategory()
387391
*/
388392
private function deleteSubCategoriesInDefaultCategory()
389393
{
390-
$this->executeWithFlatEnabledInAdminArea(function () {
391-
$this->createSubCategoriesInDefaultCategory();
392-
$this->removeSubCategoriesInDefaultCategory();
393-
});
394+
$this->executeWithFlatEnabledInAdminArea(
395+
function () {
396+
$this->createSubCategoriesInDefaultCategory();
397+
$this->removeSubCategoriesInDefaultCategory();
398+
}
399+
);
394400
}
395401

396402
/**
@@ -399,13 +405,15 @@ private function deleteSubCategoriesInDefaultCategory()
399405
*/
400406
private function removeSubCategoriesInDefaultCategory()
401407
{
402-
$this->executeWithFlatEnabledInAdminArea(function () {
403-
$category = $this->instantiateCategoryModel();
404-
$category->load(self::$categoryTwo);
405-
$category->delete();
406-
$category->load(self::$categoryOne);
407-
$category->delete();
408-
});
408+
$this->executeWithFlatEnabledInAdminArea(
409+
function () {
410+
$category = $this->instantiateCategoryModel();
411+
$category->load(self::$categoryTwo);
412+
$category->delete();
413+
$category->load(self::$categoryOne);
414+
$category->delete();
415+
}
416+
);
409417
}
410418

411419
/**
@@ -469,12 +477,4 @@ private function getActiveConfigInstance()
469477
\Magento\Framework\App\Config\MutableScopeConfigInterface::class
470478
);
471479
}
472-
473-
/**
474-
* teardown
475-
*/
476-
public function tearDown()
477-
{
478-
parent::tearDown();
479-
}
480480
}

dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Eav/Action/FullTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,4 @@ public function testReindexAll()
8282
$this->assertEquals(1, $product->getWeight());
8383
}
8484
}
85-
86-
/**
87-
* teardown
88-
*/
89-
public function tearDown()
90-
{
91-
parent::tearDown();
92-
}
9385
}

dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/ResultTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public function testIndexActionTranslation()
3232
$this->assertContains('Den gesamten Shop durchsuchen...', $responseBody);
3333
}
3434

35+
/**
36+
* @magentoDbIsolation disabled
37+
*/
3538
public function testIndexActionXSSQueryVerification()
3639
{
3740
$escaper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()

dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/FullTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
/**
1818
* Class for testing fulltext index rebuild
19+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1920
*/
2021
class FullTest extends \PHPUnit\Framework\TestCase
2122
{

dev/tests/integration/testsuite/Magento/Elasticsearch/Controller/Adminhtml/Category/SaveTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,12 @@ private function getProductIdList(array $skuList): array
152152
$items = $repository->getList($searchCriteria)
153153
->getItems();
154154

155-
$idList = array_map(function (ProductInterface $item) {
156-
return $item->getId();
157-
}, $items);
155+
$idList = array_map(
156+
function (ProductInterface $item) {
157+
return $item->getId();
158+
},
159+
$items
160+
);
158161

159162
return $idList;
160163
}

dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite_rollback.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
$registry->register('isSecureArea', true);
1313

1414
/** @var Magento\Cms\Api\PageRepositoryInterface $pageRepository */
15-
$pageRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(Magento\Cms\Api\PageRepositoryInterface::class);
15+
$pageRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
16+
Magento\Cms\Api\PageRepositoryInterface::class
17+
);
1618

1719
$pageRepository->deleteById('page-a');
1820
$pageRepository->deleteById('page-b');

0 commit comments

Comments
 (0)