2
2
3
3
namespace Algolia \AlgoliaSearch \Test \Integration \Indexing \Product ;
4
4
5
- use Algolia \AlgoliaSearch \Model \ Indexer \ Product ;
5
+ use Algolia \AlgoliaSearch \Service \ Product \ BatchQueueProcessor as ProductBatchQueueProcessor ;
6
6
use Algolia \AlgoliaSearch \Test \Integration \Indexing \MultiStoreTestCase ;
7
7
use Magento \Catalog \Api \Data \ProductInterface ;
8
8
use Magento \Catalog \Api \ProductRepositoryInterface ;
19
19
*/
20
20
class MultiStoreProductsTest extends MultiStoreTestCase
21
21
{
22
- /** @var Product */
23
- protected $ productsIndexer ;
22
+ /** @var ProductBatchQueueProcessor */
23
+ protected $ productBatchQueueProcessor ;
24
24
25
25
/** @var ProductRepositoryInterface */
26
26
protected $ productRepository ;
@@ -53,7 +53,7 @@ protected function setUp():void
53
53
{
54
54
parent ::setUp ();
55
55
56
- $ this ->productsIndexer = $ this ->objectManager ->get (Product ::class);
56
+ $ this ->productBatchQueueProcessor = $ this ->objectManager ->get (ProductBatchQueueProcessor ::class);
57
57
$ this ->productRepository = $ this ->objectManager ->get (ProductRepositoryInterface::class);
58
58
$ this ->productCollectionFactory = $ this ->objectManager ->get (CollectionFactory::class);
59
59
$ this ->websiteRepository = $ this ->objectManager ->get (WebsiteRepositoryInterface::class);
@@ -62,8 +62,7 @@ protected function setUp():void
62
62
$ this ->productPriceIndexer = $ this ->indexerRegistry ->get ('catalog_product_price ' );
63
63
$ this ->productPriceIndexer ->reindexAll ();
64
64
65
- $ this ->productsIndexer ->executeFull ();
66
- $ this ->algoliaHelper ->waitLastTask ();
65
+ $ this ->reindexToAllStores ($ this ->productBatchQueueProcessor );
67
66
}
68
67
69
68
public function testMultiStoreProductIndices ()
@@ -102,11 +101,7 @@ public function testMultiStoreProductIndices()
102
101
$ this ->assertEquals (self ::VOYAGE_YOGA_BAG_NAME , $ voyageYogaBag ->getName ());
103
102
$ this ->assertEquals (self ::VOYAGE_YOGA_BAG_NAME_ALT , $ voyageYogaBagAlt ->getName ());
104
103
105
- $ this ->productsIndexer ->execute ([self ::VOYAGE_YOGA_BAG_ID ]);
106
-
107
- $ this ->algoliaHelper ->waitLastTask ($ defaultStore ->getId ());
108
- $ this ->algoliaHelper ->waitLastTask ($ fixtureSecondStore ->getId ());
109
- $ this ->algoliaHelper ->waitLastTask ($ fixtureThirdStore ->getId ());
104
+ $ this ->reindexToAllStores ($ this ->productBatchQueueProcessor , [self ::VOYAGE_YOGA_BAG_ID ]);
110
105
111
106
$ this ->assertAlgoliaRecordValues (
112
107
$ this ->indexPrefix . 'default_products ' ,
@@ -131,11 +126,7 @@ public function testMultiStoreProductIndices()
131
126
$ this ->productRepository ->save ($ voyageYogaBag );
132
127
$ this ->productPriceIndexer ->reindexRow (self ::VOYAGE_YOGA_BAG_ID );
133
128
134
- $ this ->productsIndexer ->execute ([self ::VOYAGE_YOGA_BAG_ID ]);
135
-
136
- $ this ->algoliaHelper ->waitLastTask ($ defaultStore ->getId ());
137
- $ this ->algoliaHelper ->waitLastTask ($ fixtureSecondStore ->getId ());
138
- $ this ->algoliaHelper ->waitLastTask ($ fixtureThirdStore ->getId ());
129
+ $ this ->reindexToAllStores ($ this ->productBatchQueueProcessor , [self ::VOYAGE_YOGA_BAG_ID ]);
139
130
140
131
// default store should have the same number of products
141
132
$ this ->assertNbOfRecordsPerStore (
0 commit comments