/**
  * @return mixed[]
  */
 public function toArray() : array
 {
     $fields = $this->facetFiltersToIncludeInResult->getFields();
     if (count($fields) === 0) {
         return [];
     }
     return ['facet' => 'on', 'facet.mincount' => 1, 'facet.limit' => -1, 'facet.sort' => 'index', 'facet.field' => $this->getFacetFields(...$fields), 'facet.query' => $this->getFacetQueries(...$fields), 'fq' => $this->getSelectedFacetQueries($this->filterSelection)];
 }
 public function testFacetFieldTransformationIsAppliedToFacetField()
 {
     $testRangedAttributeCode = 'foo';
     $testNormalAttributeCode = 'bar';
     $this->stubFacetFiltersToIncludeInResult->method('getFields')->willReturn([$this->createStubFacetFilterRequestField($testRangedAttributeCode), $this->createStubFacetFilterRequestField($testNormalAttributeCode)]);
     $testFilterSelection = [$testRangedAttributeCode => ['Value does not matter as it will be transformed.'], $testNormalAttributeCode => ['Does not matter either.']];
     $rangeFrom = 'baz';
     $rangeTo = 'qux';
     $stubFacetFilterRange = $this->createMock(FacetFilterRange::class);
     $stubFacetFilterRange->method('from')->willReturn($rangeFrom);
     $stubFacetFilterRange->method('to')->willReturn($rangeTo);
     $stubRangedTransformation = $this->createMock(FacetFieldTransformation::class);
     $stubRangedTransformation->method('decode')->willReturn($stubFacetFilterRange);
     $transformedValue = 'Transformed value';
     $stubNormalTransformation = $this->createMock(FacetFieldTransformation::class);
     $stubNormalTransformation->method('decode')->willReturn($transformedValue);
     $this->stubFacetFieldTransformationRegistry->method('hasTransformationForCode')->willReturn(true);
     $this->stubFacetFieldTransformationRegistry->method('getTransformationByCode')->willReturnMap([[$testRangedAttributeCode, $stubRangedTransformation], [$testNormalAttributeCode, $stubNormalTransformation]]);
     $solrFacetFilterRequest = new SolrFacetFilterRequest($this->stubFacetFiltersToIncludeInResult, $testFilterSelection, $this->stubFacetFieldTransformationRegistry);
     $expectedArray = ['facet' => 'on', 'facet.mincount' => 1, 'facet.limit' => -1, 'facet.sort' => 'index', 'facet.field' => [$testRangedAttributeCode, $testNormalAttributeCode], 'facet.query' => [], 'fq' => [sprintf('%s:([%s TO %s])', $testRangedAttributeCode, $rangeFrom, $rangeTo), sprintf('%s:("%s")', $testNormalAttributeCode, $transformedValue)]];
     $this->assertSame($expectedArray, $solrFacetFilterRequest->toArray());
 }