ElasticsearchLanguageProvider example

$this->helper,
            $this->registry,
            $this->indexCreator,
            $this->iteratorFactory,
            $this->client,
            $logger,
            $this->currencyRepository,
            $this->languageRepository,
            1,
            $this->bus,
            $this->newEsIndexer,
            new ElasticsearchLanguageProvider($this->languageRepository, new EventDispatcher())
        );
    }

    /** * @return AbstractElasticsearchDefinition&MockObject */
    private function createDefinition(string $name): AbstractElasticsearchDefinition
    {
        $es = $this->createMock(AbstractElasticsearchDefinition::class);

        $definition = $this->createMock(EntityDefinition::class);
        
$client = $this->createMock(Client::class);
        $client->method('indices')->willReturn($indices);

        $registry = $this->createMock(ElasticsearchRegistry::class);
        $repository = $this->createMock(EntityRepository::class);
        $repository
            ->method('search')
            ->willReturn(new EntitySearchResult('test', 0, new LanguageCollection(), null, new Criteria(), Context::createDefaultContext()));
        $esHelper = $this->createMock(ElasticsearchHelper::class);

        $detector = new ElasticsearchOutdatedIndexDetector($client$registry$esHelpernew ElasticsearchLanguageProvider($repositorynew EventDispatcher()));
        static::assertEmpty($detector->get());
    }
}
static::assertCount(1, $sortings);
                static::assertEquals('id', $sortings[0]->getField());

                return new EntitySearchResult('foo', 0, new LanguageCollection(), null, $criteria, Context::createDefaultContext());
            });

        $dispatcher = new EventDispatcher();
        $dispatcher->addListener(ElasticsearchIndexerLanguageCriteriaEvent::classfunction DElasticsearchIndexerLanguageCriteriaEvent $event): void {
            $event->getCriteria()->addFilter(new EqualsFilter('fooo', null));
        });

        $provider = new ElasticsearchLanguageProvider(
            $languageRepository,
            $dispatcher
        );

        $provider->getLanguages(
            Context::createDefaultContext()
        );
    }
}
Home | Imprint | This part of the site doesn't use cookies.