Skip to content

Commit

Permalink
[CLEANUP] Make the TYPO3 version switches more consistent
Browse files Browse the repository at this point in the history
Also reduce the cognitive load as these switches are between
V12 and pre-V12.
  • Loading branch information
oliverklee committed Nov 1, 2023
1 parent edbb534 commit 9cca6cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Tests/Unit/Controller/FrontEndEditorControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected function setUp(): void

// 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(
Expand Down Expand Up @@ -211,7 +211,7 @@ public function updateActionWithOwnTeaPersistsProvidedTea(): void

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.
Expand All @@ -227,7 +227,7 @@ private function mockRedirect(string $actionName): void

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));
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Controller/TeaControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected function setUp(): void
$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]);
Expand Down

0 comments on commit 9cca6cb

Please sign in to comment.