attributeDriver = new \ArrayIterator([$attributesTypeTextQueryBuilder->getWrappedObject()]); $this->beConstructedWith($localeContext, $productAttributeRepository, $this->attributeDriver); } function it_is_initializable(): void { $this->shouldHaveType(HasAttributesQueryBuilder::class); } function it_implements_query_builder_interface(): void { $this->shouldHaveType(QueryBuilderInterface::class); } function it_builds_query( LocaleContextInterface $localeContext, ProductAttributeRepository $productAttributeRepository, AttributesTypeTextQueryBuilder $attributesTypeTextQueryBuilder, BoolQuery $boolQuery ): void { $attributeName = 'Size'; $data = [ 'attribute_values' => ['XL', 'L'], 'attribute' => $attributeName, ]; $queryAttributeName = str_replace('attribute_', '', $data['attribute']); $productAttributeRepository->getAttributeTypeByName($queryAttributeName) ->willReturn('select'); $attributesTypeTextQueryBuilder->supports('select') ->willReturn(true); $localeContext->getLocaleCode()->willReturn('en'); $attributesTypeTextQueryBuilder->buildQuery($data, 'en') ->willReturn($boolQuery); $this->buildQuery($data) ->shouldBeAnInstanceOf(BoolQuery::class); } }