Skip to content

Commit

Permalink
[BUGFIX] Unit tests missing mock of EventDispatcher for AfterSuggestQ…
Browse files Browse the repository at this point in the history
…ueryHasBeenPreparedEvent

Relates: #3902, #3903
  • Loading branch information
dkd-kaehm committed Dec 5, 2023
1 parent ee100a8 commit 9d5165a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Tests/Unit/Domain/Search/Suggest/SuggestServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
use ApacheSolrForTypo3\Solr\System\Solr\SolrConnection;
use ApacheSolrForTypo3\Solr\Tests\Unit\SetUpUnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\EventDispatcher\ListenerProviderInterface;
use TYPO3\CMS\Core\EventDispatcher\EventDispatcher;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
Expand Down Expand Up @@ -114,6 +117,8 @@ public function canHandleInvalidSyntaxInAdditionalFilters(): void
$connectionManagerMock->expects(self::any())->method('getConnectionByPageId')->willReturn($solrConnectionMock);
GeneralUtility::setSingletonInstance(ConnectionManager::class, $connectionManagerMock);

GeneralUtility::setSingletonInstance(EventDispatcherInterface::class, new EventDispatcher($this->createMock(ListenerProviderInterface::class)));

$searchStub = new class ($this->createMock(SolrConnection::class)) extends Search implements SingletonInterface {
public static SuggestServiceTest $suggestServiceTest;
public function search(Query $query, $offset = 0, $limit = 10): ?ResponseAdapter
Expand Down

0 comments on commit 9d5165a

Please sign in to comment.