Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Unit tests missing mock of EventDispatcher for AfterSuggestQueryHasBeenPreparedEvent #3910

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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