From a444e2266cec8fc76195ab92ce21e67928d6c5aa Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Wed, 1 Nov 2023 20:56:10 +0100 Subject: [PATCH] [CLEANUP] Make the TYPO3 version switches more consistent (#964) Also reduce the cognitive load as these switches are between V12 and pre-V12. --- Tests/Unit/Controller/FrontEndEditorControllerTest.php | 6 +++--- Tests/Unit/Controller/TeaControllerTest.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tests/Unit/Controller/FrontEndEditorControllerTest.php b/Tests/Unit/Controller/FrontEndEditorControllerTest.php index bd54303..f017d51 100644 --- a/Tests/Unit/Controller/FrontEndEditorControllerTest.php +++ b/Tests/Unit/Controller/FrontEndEditorControllerTest.php @@ -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)); diff --git a/Tests/Unit/Controller/TeaControllerTest.php b/Tests/Unit/Controller/TeaControllerTest.php index 8525566..2613f6e 100644 --- a/Tests/Unit/Controller/TeaControllerTest.php +++ b/Tests/Unit/Controller/TeaControllerTest.php @@ -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]);