22 private $indexSwitcher;
74 protected function setUp()
80 ltrim(Fulltext::class,
'\\') => [
83 'instance' => ltrim(IndexSwitcherMock::class,
'\\'),
92 \
Magento\Indexer\Model\Indexer::class
94 $this->indexer->load(
'catalogsearch_fulltext');
101 \
Magento\Search\Model\QueryFactory::class
105 \
Magento\Framework\Search\Request\Dimension::class,
106 [
'name' =>
'scope',
'value' =>
'1']
110 IndexSwitcherMock::class
113 $this->productApple = $this->getProductBySku(
'fulltext-1');
114 $this->productBanana = $this->getProductBySku(
'fulltext-2');
115 $this->productOrange = $this->getProductBySku(
'fulltext-3');
116 $this->productPapaya = $this->getProductBySku(
'fulltext-4');
117 $this->productCherry = $this->getProductBySku(
'fulltext-5');
123 public function testReindexAll()
125 $this->indexer->reindexAll();
129 IndexSwitcherMock::class
131 $this->assertTrue($indexSwitcher->isSwitched());
137 public function testReindexList()
139 $this->indexer->reindexList([$this->productApple->getId(), $this->productBanana->getId()]);
143 IndexSwitcherMock::class
145 $this->assertFalse($indexSwitcher->isSwitched());
151 public function testReindexRow()
153 $this->indexer->reindexRow($this->productPapaya->getId());
157 IndexSwitcherMock::class
159 $this->assertFalse($indexSwitcher->isSwitched());
170 $query = $this->queryFactory->get();
173 $query->saveIncrementalPopularity();
178 'searchRequestName' =>
'quick_search_container' 194 protected function getProductBySku($sku)
198 \
Magento\Catalog\Model\Product::class
200 return $product->loadByAttribute(
'sku', $sku);
static getObjectManager()