|
16 | 16 |
|
17 | 17 | use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Grouping\Group; |
18 | 18 | use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Result\Parser\ResultParserRegistry; |
| 19 | +use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\SearchResultSet; |
19 | 20 | use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\SearchResultSetService; |
20 | 21 | use ApacheSolrForTypo3\Solr\Domain\Search\SearchRequest; |
21 | 22 | use ApacheSolrForTypo3\Solr\Search; |
|
24 | 25 | use ApacheSolrForTypo3\Solr\Tests\Unit\UnitTest; |
25 | 26 | use ApacheSolrForTypo3\Solrfluidgrouping\Domain\Search\ResultSet\Grouping\Parser\GroupedResultParser; |
26 | 27 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
| 28 | +use TYPO3\CMS\Extbase\Object\ObjectManager; |
| 29 | +use TYPO3\CMS\Extbase\Object\ObjectManagerInterface; |
27 | 30 |
|
28 | 31 | /** |
29 | 32 | * This processor is used to transform the solr response into a |
@@ -81,12 +84,20 @@ public function canCreateGroups() |
81 | 84 |
|
82 | 85 | /** @var $searchResultSetService SearchResultSetService */ |
83 | 86 | $searchResultSetService = $this->getMockBuilder(SearchResultSetService::class)->setMethods(['doASearch'])->setConstructorArgs([$typoScriptConfiguration, $searchMock])->getMock(); |
| 87 | + $objectManagerMock = $this->getDumbMock(ObjectManagerInterface::class); |
| 88 | + |
| 89 | + $searchResultSet = new SearchResultSet(); |
| 90 | + $objectManagerMock->expects($this->once())->method('get')->willReturn($searchResultSet); |
| 91 | + |
| 92 | + $searchResultSetService->injectObjectManager($objectManagerMock); |
84 | 93 | $searchResultSetService->expects($this->once())->method('doASearch')->will($this->returnValue($fakeResponse)); |
85 | 94 |
|
86 | 95 | $fakeRequest = $this->getDumbMock(SearchRequest::class); |
87 | 96 | $fakeRequest->expects($this->any())->method('getResultsPerPage')->willReturn(10); |
88 | 97 | $fakeRequest->expects($this->any())->method('getContextTypoScriptConfiguration')->will($this->returnValue($typoScriptConfiguration)); |
89 | 98 | $fakeRequest->expects($this->any())->method('getAdditionalFilters')->willReturn([]); |
| 99 | + $searchResultSet->setUsedSearchRequest($fakeRequest); |
| 100 | + |
90 | 101 | $searchResultSet = $searchResultSetService->search($fakeRequest); |
91 | 102 |
|
92 | 103 | $this->assertSame(1, $searchResultSet->getSearchResults()->getGroups()->getCount(), 'There should be 1 Groups of search results'); |
|
0 commit comments