EntityDefinitionQueryHelper example

->method('search')
            ->willThrowException(new NoNodesAvailableException());

        $helper = $this->createMock(ElasticsearchHelper::class);
        $helper->expects(static::once())->method('logAndThrowException');
        $helper->method('allowSearch')->willReturn(true);

        $searcher = new ElasticsearchEntitySearcher(
            $client,
            $this->createMock(EntitySearcherInterface::class),
            $helper,
            new CriteriaParser(new EntityDefinitionQueryHelper()$this->createMock(CustomFieldService::class)$this->createMock(AbstractKeyValueStorage::class)),
            $this->createMock(AbstractElasticsearchSearchHydrator::class),
            new EventDispatcher(),
        );

        $context = Context::createDefaultContext();
        $criteria->addState(Criteria::STATE_ELASTICSEARCH_AWARE);

        $result = $searcher->search(
            new ProductDefinition(),
            $criteria,
            $context
        );

    private const SECOND_LANGUAGE = 'd5da80fc94874ea988eac8abdea44e0a';

    public function testAggregationWithSorting(): void
    {
        $aggs = new TermsAggregation('foo', 'test', null, new FieldSorting('abc', FieldSorting::ASCENDING)new TermsAggregation('foo', 'foo2'));

        $definition = $this->getDefinition();

        /** @var CompositeAggregation $esAgg */
        $esAgg = (new CriteriaParser(
            new EntityDefinitionQueryHelper(),
            $this->createMock(CustomFieldService::class),
            $this->createMock(AbstractKeyValueStorage::class)
        ))->parseAggregation($aggs$definition, Context::createDefaultContext());

        static::assertInstanceOf(CompositeAggregation::class$esAgg);
        static::assertSame([
            'composite' => [
                'sources' => [
                    [
                        'foo.sorting' => [
                            'terms' => [
                                
/** * @internal * * @covers \Shopware\Elasticsearch\Product\ProductSearchQueryBuilder */
class ProductSearchQueryBuilderTest extends TestCase
{
    public function testDecoration(): void
    {
        $builder = new ProductSearchQueryBuilder(
            $this->createMock(Connection::class),
            new EntityDefinitionQueryHelper(),
            $this->getDefinition(),
            $this->createMock(TokenFilter::class),
            new Tokenizer(2),
            $this->createMock(ElasticsearchHelper::class)
        );

        static::expectException(DecorationPatternException::class);
        $builder->getDecorated();
    }

    public function testBuildQueryAndSearch(): void
    {
Home | Imprint | This part of the site doesn't use cookies.