Testing

Trait WebsiteSearchExtensionTrait сontains methods which help reindex data in test if required.

Example of usage:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
 /**
  * @dbIsolationPerTest
  */
 class ReindexRequiredTest extends FrontendWebTestCase
 {
     use WebsiteSearchExtensionTrait;

      /** {@inheritdoc} */
         protected function setUp(): void
         {
             ...

             $this->reindexProductData(); // if we need re-index product data in every test
         }

         public function testExampleReindexData()
         {
             $this->reindexProductData(); // if we need re-index product data in specific test
             ...
         }
 }