ElasticsearchLanguageIndexIteratorMessage example

/** * @internal * * @covers \Shopware\Elasticsearch\Framework\Indexing\ElasticsearchLanguageIndexIteratorMessage */
class ElasticsearchLanguageIndexIteratorMessageTest extends TestCase
{
    public function testMessage(): void
    {
        Feature::skipTestIfActive('ES_MULTILINGUAL_INDEX', $this);

        $msg = new ElasticsearchLanguageIndexIteratorMessage('1');

        static::assertSame('1', $msg->getLanguageId());
    }
}
$indexer->updateIds($this->createMock(EntityDefinition::class)['1', '2']);
    }

    public function testHandleESDisabled(): void
    {
        $this->helper = $this->createMock(ElasticsearchHelper::class);

        $this->connection->expects(static::never())->method('executeStatement');

        $indexer = $this->getIndexer();

        $indexer(new ElasticsearchLanguageIndexIteratorMessage('1'));
    }

    public function testHandleLanguageInvalidLanguage(): void
    {
        $this->languageRepository = $this->createMock(EntityRepository::class);
        $this->languageRepository
            ->method('search')
            ->willReturn(new EntitySearchResult('language', 0, new LanguageCollection(), null, new Criteria(), Context::createDefaultContext()));

        $this->connection->expects(static::never())->method('executeStatement');

        


            $languageId = $writeResult->getProperty('languageId');

            $esIndex = $this->elasticsearchHelper->getIndexName($this->productDefinition, $languageId);

            // index exists, don't need to do anything             if ($this->client->indices()->exists(['index' => $esIndex])) {
                continue;
            }

            $this->bus->dispatch(new ElasticsearchLanguageIndexIteratorMessage($languageId));
        }
    }

    public function onLanguageWritten(EntityWrittenEvent $event): void
    {
        if (!$this->elasticsearchHelper->allowIndexing()) {
            return;
        }

        $context = $event->getContext();

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