IndexingDto example

$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 ElasticsearchIndexingMessage(new IndexingDto([Uuid::randomHex()], 'foo', 'not_existing'), null, Context::createDefaultContext()));
    }

    public function testHandleIndexingInvalidDefinition(): void
    {
        $message = new ElasticsearchIndexingMessage(
            new IndexingDto([Uuid::randomHex()], 'foo', 'not_existing'),
            null,
            Context::createDefaultContext()
        );

        $this->indices
            


    /** * @param array<string> $ids */
    private function generateMessage(EntityDefinition $definition, array $ids): ElasticsearchIndexingMessage
    {
        $context = Context::createDefaultContext();

        $alias = $this->helper->getIndexName($definition);

        $indexing = new IndexingDto($ids$alias$definition->getEntityName());

        return new ElasticsearchIndexingMessage($indexing, null, $context);
    }

    private function createIndexingMessage(IndexerOffset $offset): ?ElasticsearchIndexingMessage
    {
        $definition = $this->registry->get((string) $offset->getDefinition());

        if (!$definition) {
            throw ElasticsearchIndexingException::definitionNotFound((string) $offset->getDefinition());
        }

        

    private function generateMessages(EntityDefinition $definition, array $ids): array
    {
        $languages = $this->languageProvider->getLanguages(Context::createDefaultContext());

        $messages = [];
        foreach ($languages as $language) {
            $context = $this->createLanguageContext($language);

            $alias = $this->helper->getIndexName($definition$language->getId());

            $indexing = new IndexingDto($ids$alias$definition->getEntityName());

            $message = new ElasticsearchIndexingMessage($indexing, null, $context);

            $messages[] = $message;
        }

        return $messages;
    }

    private function createIndexingMessage(IndexerOffset $offset, Context $context): ?ElasticsearchIndexingMessage
    {
        
->expects(static::once())
            ->method('createIndex');

        $indexer = $this->getIndexer();

        $indexer($message);
    }

    public function testHandleIndexingInvalidDefinition(): void
    {
        $message = new ElasticsearchIndexingMessage(
            new IndexingDto([Uuid::randomHex()], 'foo', 'not_existing'),
            null,
            Context::createDefaultContext()
        );

        $this->indices
            ->expects(static::once())
            ->method('exists')->willReturn(true);

        $indexer = $this->getIndexer();

        static::expectException(\RuntimeException::class);
        
Home | Imprint | This part of the site doesn't use cookies.