35 private $productRepository;
45 private $storeManager;
65 private $searchIndexNameResolver;
73 $this->client = $connectionManager->getConnection();
76 $this->storeIds = array_keys($this->storeManager->getStores());
79 $this->entityType = $clientConfig->getEntityType();
82 $this->indexer->load(CatalogSearchFulltextIndexer::INDEXER_ID);
83 $this->indexer->reindexAll();
96 $productApple = $this->productRepository->get(
'fulltext-1');
97 foreach ($this->storeIds as
$storeId) {
100 $this->assertEquals($productApple->getId(),
$products[0][
'_id']);
115 $this->storeManager->setCurrentStore(
'admin');
116 $productApple = $this->productRepository->get(
'fulltext-1');
117 $productApple->setName(
'Simple Product Cucumber');
118 $this->productRepository->save($productApple);
120 foreach ($this->storeIds as
$storeId) {
126 $this->assertEquals($productApple->getId(),
$products[0][
'_id']);
138 public function testReindexRowAfterMassAction(): void
140 $productApple = $this->productRepository->get(
'fulltext-1');
141 $productBanana = $this->productRepository->get(
'fulltext-2');
143 $productApple->getId(),
144 $productBanana->getId(),
147 'name' =>
'Simple Product Common',
152 foreach ($this->storeIds as
$storeId) {
180 $productBanana = $this->productRepository->get(
'fulltext-2');
181 $this->productRepository->delete($productBanana);
183 foreach ($this->storeIds as
$storeId) {
200 public function testReindexRowAfterUpdateStockStatus(): void
202 foreach ($this->storeIds as
$storeId) {
206 $product = $this->productRepository->get(
'simple_10');
215 foreach ($this->storeIds as
$storeId) {
231 private function searchByName(
string $text,
int $storeId): array
233 $index = $this->searchIndexNameResolver->getIndexName(
$storeId, $this->indexer->getId());
236 'type' => $this->entityType,
240 'minimum_should_match' => 1,
252 $queryResult = $this->client->query($searchQuery);
253 $products = isset($queryResult[
'hits'][
'hits']) ? $queryResult[
'hits'][
'hits'] : [];
testReindexRowAfterDelete()
testReindexRowAfterEdit()
static getObjectManager()