IndexingController example

$productIndexer->method('iterate')->willReturn(null);
        } else {
            $productIndexer->method('iterate')->willReturn(new ProductIndexingMessage(
                [
                    Uuid::randomHex(),
                ],
                ['offset' => $offset + 50]
            ));
        }
        $registry = $this->getMockBuilder(EntityIndexerRegistry::class)->disableOriginalConstructor()->getMock();
        $registry->method('getIndexer')->willReturn($productIndexer);
        $indexer = new IndexingController($registry$this->getContainer()->get('messenger.bus.shopware'));

        $response = $indexer->iterate('product.indexer', new Request([]['offset' => $offset]));
        $response = json_decode($response->getContent(), true, 512, \JSON_THROW_ON_ERROR);

        if ($offset === 100) {
            static::assertTrue($response['finish']);
        } else {
            static::assertFalse($response['finish']);
            static::assertEquals(['offset' => $offset + 50]$response['offset']);
        }
    }

    
Home | Imprint | This part of the site doesn't use cookies.