mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-22 07:16:14 +01:00

[BUGFIX] Do not mock unavailable methods (#799)

This commit is contained in:
Daniel Siepmann 2023-04-06 14:32:05 +02:00 committed by GitHub
parent f1b4faa9eb
commit 4d2bbced74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,7 @@ use TTN\Tea\Controller\TeaController;
use TTN\Tea\Domain\Model\Product\Tea;
use TTN\Tea\Domain\Repository\Product\TeaRepository;
use TYPO3\CMS\Core\Http\HtmlResponse;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use TYPO3\CMS\Fluid\View\TemplateView;
@ -40,9 +41,13 @@ class TeaControllerTest extends UnitTestCase
parent::setUp();
// We need to create an accessible mock in order to be able to set the protected `view`.
$methodsToMock = ['redirectToUri', 'htmlResponse'];
if ((new Typo3Version())->getMajorVersion() <= 11) {
$methodsToMock = array_merge($methodsToMock, ['forward', 'redirect']);
}
$this->subject = $this->getAccessibleMock(
TeaController::class,
['forward', 'redirect', 'redirectToUri', 'htmlResponse']
$methodsToMock
);
$this->viewMock = $this->createMock(TemplateView::class);