mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-12-22 18:26:11 +01:00

[CLEANUP] Make the TYPO3 version switches more consistent (#964)

Also reduce the cognitive load as these switches are between
V12 and pre-V12.
This commit is contained in:
Oliver Klee 2023-11-01 20:56:10 +01:00 committed by GitHub
parent 3d92e0cc98
commit a444e2266c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -52,7 +52,7 @@ final class FrontEndEditorControllerTest extends UnitTestCase
// We need to create an accessible mock in order to be able to set the protected `view`.
$methodsToMock = ['htmlResponse', 'redirect', 'redirectToUri'];
if ((new Typo3Version())->getMajorVersion() <= 11) {
if ((new Typo3Version())->getMajorVersion() < 12) {
$methodsToMock[] = 'forward';
}
$this->subject = $this->getAccessibleMock(
@ -211,7 +211,7 @@ final class FrontEndEditorControllerTest extends UnitTestCase
private function mockRedirect(string $actionName): void
{
if ((new Typo3Version())->getMajorVersion() <= 11) {
if ((new Typo3Version())->getMajorVersion() < 12) {
$this->subject->expects(self::once())->method('redirect')
->with($actionName)
// @phpstan-ignore-next-line This class does not exist in V12 anymore, but this branch is V11-only.
@ -227,7 +227,7 @@ final class FrontEndEditorControllerTest extends UnitTestCase
private function stubRedirect(string $actionName): void
{
if ((new Typo3Version())->getMajorVersion() <= 11) {
if ((new Typo3Version())->getMajorVersion() < 12) {
$this->subject->method('redirect')
// @phpstan-ignore-next-line This class does not exist in V12 anymore, but this branch is V11-only.
->willThrowException(new StopActionException('redirectToUri', 1476045828));

View file

@ -43,7 +43,7 @@ final class TeaControllerTest extends UnitTestCase
$this->teaRepositoryMock = $this->getMockBuilder(TeaRepository::class)->disableOriginalConstructor()->getMock();
// We need to create an accessible mock in order to be able to set the protected `view`.
$methodsToMock = ['htmlResponse', 'redirect', 'redirectToUri'];
if ((new Typo3Version())->getMajorVersion() <= 11) {
if ((new Typo3Version())->getMajorVersion() < 12) {
$methodsToMock[] = 'forward';
}
$this->subject = $this->getAccessibleMock(TeaController::class, $methodsToMock, [$this->teaRepositoryMock]);