Skip to content

Commit 2713e1d

Browse files
author
Joan He
committed
Merge remote-tracking branch 'arcticfoxes/MC-19450' into 2.3-develop-pr
2 parents 5860041 + 66aafd9 commit 2713e1d

File tree

17 files changed

+119
-66
lines changed

17 files changed

+119
-66
lines changed

app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced/Collection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ private function getSearchResultApplier(SearchResultInterface $searchResult): Se
393393
/** This variable sets by serOrder method, but doesn't have a getter method. */
394394
'orders' => $this->_orders,
395395
'size' => $this->getPageSize(),
396+
'currentPage' => (int)$this->_curPage,
396397
]
397398
);
398399
}

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,6 @@ public function cleanIndex($storeId, $mappedIndexerId)
195195
{
196196
$this->checkIndex($storeId, $mappedIndexerId, true);
197197
$indexName = $this->indexNameResolver->getIndexName($storeId, $mappedIndexerId, $this->preparedIndex);
198-
if ($this->client->isEmptyIndex($indexName)) {
199-
// use existing index if empty
200-
return $this;
201-
}
202198

203199
// prepare new index name and increase version
204200
$indexPattern = $this->indexNameResolver->getIndexPattern($storeId, $mappedIndexerId);

dev/tests/integration/testsuite/Magento/Bundle/Model/Product/TypeTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,20 @@ protected function setUp()
4949

5050
/**
5151
* @magentoDataFixture Magento/Bundle/_files/product.php
52-
* @covers \Magento\Indexer\Model\Indexer::reindexAll
5352
* @covers \Magento\Bundle\Model\Product\Type::getSearchableData
5453
* @magentoDbIsolation disabled
5554
*/
56-
public function testPrepareProductIndexForBundleProduct()
55+
public function testGetSearchableData()
5756
{
58-
$this->indexer->reindexAll();
59-
60-
$select = $this->connectionMock->select()->from($this->resource->getTableName('catalogsearch_fulltext_scope1'))
61-
->where('`data_index` LIKE ?', '%' . 'Bundle Product Items' . '%');
57+
$productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
58+
/** @var \Magento\Catalog\Model\Product $bundleProduct */
59+
$bundleProduct = $productRepository->get('bundle-product');
60+
$bundleType = $bundleProduct->getTypeInstance();
61+
/** @var \Magento\Bundle\Model\Product\Type $bundleType */
62+
$searchableData = $bundleType->getSearchableData($bundleProduct);
6263

63-
$result = $this->connectionMock->fetchAll($select);
64-
$this->assertCount(1, $result);
64+
$this->assertCount(1, $searchableData);
65+
$this->assertEquals('Bundle Product Items', $searchableData[0]);
6566
}
6667

6768
/**

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ public function testDeleteCategory()
246246
*
247247
* @magentoConfigFixture current_store catalog/frontend/flat_catalog_category true
248248
* @magentoAppArea frontend
249+
* @magentoDbIsolation disabled
249250
*/
250251
public function testFlatAfterDeleted()
251252
{

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static function setUpBeforeClass()
3232

3333
protected function setUp()
3434
{
35-
$this->_processor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
35+
$this->_processor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
3636
\Magento\Catalog\Model\Indexer\Product\Eav\Processor::class
3737
);
3838
}
@@ -46,24 +46,24 @@ protected function setUp()
4646
public function testReindexAll()
4747
{
4848
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attr **/
49-
$attr = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Eav\Model\Config::class)
49+
$attr = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Eav\Model\Config::class)
5050
->getAttribute('catalog_product', 'weight');
5151
$attr->setIsFilterable(1)->save();
5252

5353
$this->assertTrue($attr->isIndexable());
5454

55-
$priceIndexerProcessor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
55+
$priceIndexerProcessor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
5656
\Magento\Catalog\Model\Indexer\Product\Price\Processor::class
5757
);
5858
$priceIndexerProcessor->reindexAll();
5959

6060
$this->_processor->reindexAll();
6161

62-
$categoryFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
62+
$categoryFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
6363
\Magento\Catalog\Model\CategoryFactory::class
6464
);
6565
/** @var \Magento\Catalog\Block\Product\ListProduct $listProduct */
66-
$listProduct = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
66+
$listProduct = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
6767
\Magento\Catalog\Block\Product\ListProduct::class
6868
);
6969

dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/DataProvider/PriceTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public function getRangeItemCountsDataProvider()
8181
/**
8282
* @magentoDataFixture Magento/Catalog/_files/categories.php
8383
* @magentoDbIsolation disabled
84+
* @magentoConfigFixture default/catalog/search/engine mysql
8485
* @dataProvider getRangeItemCountsDataProvider
8586
*/
8687
public function testGetRangeItemCounts($inputRange, $expectedItemCounts)

dev/tests/integration/testsuite/Magento/Catalog/Model/Product/UrlTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public function testGetUrlInStore()
4949
* @magentoConfigFixture fixturestore_store web/unsecure/base_url http://sample-second.com/
5050
* @magentoConfigFixture fixturestore_store web/unsecure/base_link_url http://sample-second.com/
5151
* @magentoDataFixture Magento/Catalog/_files/product_simple_multistore.php
52+
* @magentoDbIsolation disabled
5253
* @dataProvider getUrlsWithSecondStoreProvider
5354
* @magentoAppArea adminhtml
5455
*/

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/**
99
* @magentoDbIsolation enabled
1010
* @magentoAppIsolation enabled
11+
* @magentoDataFixture Magento/CatalogSearch/_files/full_reindex.php
1112
*/
1213
class ResultTest extends \Magento\TestFramework\TestCase\AbstractController
1314
{

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public function testSearchProductByAttribute()
2828
$requestBuilder->setRequestName('quick_search_container');
2929
$queryRequest = $requestBuilder->create();
3030
/** @var \Magento\Framework\Search\Adapter\Mysql\Adapter $adapter */
31-
$adapter = $objectManager->create(\Magento\Framework\Search\Adapter\Mysql\Adapter::class);
31+
$adapterFactory = $objectManager->create(\Magento\Search\Model\AdapterFactory::class);
32+
$adapter = $adapterFactory->create();
3233
$queryResponse = $adapter->query($queryRequest);
3334
$actualIds = [];
3435
foreach ($queryResponse as $document) {

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,32 @@
1919
*/
2020
class FullTest extends \PHPUnit\Framework\TestCase
2121
{
22-
/**
23-
* @var \Magento\CatalogSearch\Model\Indexer\Fulltext\Action\Full
24-
*/
25-
protected $actionFull;
26-
27-
/**
28-
* @inheritdoc
29-
*/
30-
protected function setUp()
31-
{
32-
$this->actionFull = Bootstrap::getObjectManager()->create(
33-
\Magento\CatalogSearch\Model\Indexer\Fulltext\Action\Full::class
34-
);
35-
}
36-
3722
/**
3823
* Testing fulltext index rebuild
3924
*
4025
* @magentoDataFixture Magento/CatalogSearch/_files/products_for_index.php
4126
* @magentoDataFixture Magento/CatalogSearch/_files/product_configurable_not_available.php
4227
* @magentoDataFixture Magento/Framework/Search/_files/product_configurable.php
28+
* @magentoConfigFixture default/catalog/search/engine mysql
4329
*/
4430
public function testGetIndexData()
4531
{
32+
$engineProvider = Bootstrap::getObjectManager()->create(
33+
\Magento\CatalogSearch\Model\ResourceModel\EngineProvider::class
34+
);
35+
$dataProvider = Bootstrap::getObjectManager()->create(
36+
\Magento\CatalogSearch\Model\Indexer\Fulltext\Action\DataProvider::class,
37+
['engineProvider' => $engineProvider]
38+
);
39+
$actionFull = Bootstrap::getObjectManager()->create(
40+
\Magento\CatalogSearch\Model\Indexer\Fulltext\Action\Full::class,
41+
['dataProvider' => $dataProvider]
42+
);
4643
/** @var ProductRepositoryInterface $productRepository */
4744
$productRepository = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class);
4845
$allowedStatuses = Bootstrap::getObjectManager()->get(Status::class)->getVisibleStatusIds();
4946
$allowedVisibility = Bootstrap::getObjectManager()->get(Engine::class)->getAllowedVisibility();
50-
$result = iterator_to_array($this->actionFull->rebuildStoreIndex(Store::DISTRO_STORE_ID));
47+
$result = iterator_to_array($actionFull->rebuildStoreIndex(Store::DISTRO_STORE_ID));
5148
$this->assertNotEmpty($result);
5249

5350
$productsIds = array_keys($result);
@@ -132,6 +129,9 @@ private function getExpectedIndexData()
132129
*/
133130
public function testRebuildStoreIndexConfigurable()
134131
{
132+
$actionFull = Bootstrap::getObjectManager()->create(
133+
\Magento\CatalogSearch\Model\Indexer\Fulltext\Action\Full::class
134+
);
135135
$storeId = 1;
136136

137137
$simpleProductId = $this->getIdBySku('simple_10');
@@ -141,8 +141,8 @@ public function testRebuildStoreIndexConfigurable()
141141
$simpleProductId,
142142
$configProductId
143143
];
144-
$storeIndexDataSimple = $this->actionFull->rebuildStoreIndex($storeId, [$simpleProductId]);
145-
$storeIndexDataExpected = $this->actionFull->rebuildStoreIndex($storeId, $expected);
144+
$storeIndexDataSimple = $actionFull->rebuildStoreIndex($storeId, [$simpleProductId]);
145+
$storeIndexDataExpected = $actionFull->rebuildStoreIndex($storeId, $expected);
146146

147147
$this->assertEquals($storeIndexDataSimple, $storeIndexDataExpected);
148148
}

0 commit comments

Comments
 (0)