public function testSearchEngineResponseContainsFacetFields()
 {
     $attributeCode = 'foo';
     $attributeValue = 'bar';
     $attributeValueCount = 1;
     $this->mockHttpClient->method('select')->willReturn(['facet_counts' => ['facet_fields' => [$attributeCode => [$attributeValue, $attributeValueCount]]]]);
     $searchCriteria = new SearchCriterionAnything();
     $filterSelection = [$attributeCode => [$attributeValue]];
     $response = $this->searchEngine->query($searchCriteria, $this->createStubQueryOptions($filterSelection));
     $expectedFacetFieldCollection = new FacetFieldCollection(new FacetField(AttributeCode::fromString($attributeCode), new FacetFieldValue($attributeValue, $attributeValueCount)));
     $this->assertEquals($expectedFacetFieldCollection, $response->getFacetFieldCollection());
 }
 public function testExceptionIsThrownIfSolrIsNotAccessible()
 {
     $fieldCode = 'foo';
     $fieldValue = 'bar';
     $testSolrConnectionPath = 'http://localhost:8983/solr/nonexistingcore/';
     $client = new CurlSolrHttpClient($testSolrConnectionPath);
     $facetFieldTransformationRegistry = new FacetFieldTransformationRegistry();
     $searchCriteria = new SearchCriterionEqual($fieldCode, $fieldValue);
     $searchEngine = new SolrSearchEngine($client, $searchCriteria, $facetFieldTransformationRegistry);
     $this->expectException(SolrConnectionException::class);
     $this->expectExceptionMessage('Error 404 Not Found');
     $searchCriteria = new SearchCriterionEqual($fieldCode, $fieldValue);
     $sortOrderConfig = $this->createTestSortOrderConfig($fieldCode, SortDirection::ASC);
     $searchEngine->query($searchCriteria, $this->createTestQueryOptions($sortOrderConfig));
 }