mirror of
https://github.com/FriendsOfTYPO3/tea.git
synced 2024-11-10 04:16:13 +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:
parent
3d92e0cc98
commit
a444e2266c
2 changed files with 4 additions and 4 deletions
|
@ -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`.
|
// We need to create an accessible mock in order to be able to set the protected `view`.
|
||||||
$methodsToMock = ['htmlResponse', 'redirect', 'redirectToUri'];
|
$methodsToMock = ['htmlResponse', 'redirect', 'redirectToUri'];
|
||||||
if ((new Typo3Version())->getMajorVersion() <= 11) {
|
if ((new Typo3Version())->getMajorVersion() < 12) {
|
||||||
$methodsToMock[] = 'forward';
|
$methodsToMock[] = 'forward';
|
||||||
}
|
}
|
||||||
$this->subject = $this->getAccessibleMock(
|
$this->subject = $this->getAccessibleMock(
|
||||||
|
@ -211,7 +211,7 @@ final class FrontEndEditorControllerTest extends UnitTestCase
|
||||||
|
|
||||||
private function mockRedirect(string $actionName): void
|
private function mockRedirect(string $actionName): void
|
||||||
{
|
{
|
||||||
if ((new Typo3Version())->getMajorVersion() <= 11) {
|
if ((new Typo3Version())->getMajorVersion() < 12) {
|
||||||
$this->subject->expects(self::once())->method('redirect')
|
$this->subject->expects(self::once())->method('redirect')
|
||||||
->with($actionName)
|
->with($actionName)
|
||||||
// @phpstan-ignore-next-line This class does not exist in V12 anymore, but this branch is V11-only.
|
// @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
|
private function stubRedirect(string $actionName): void
|
||||||
{
|
{
|
||||||
if ((new Typo3Version())->getMajorVersion() <= 11) {
|
if ((new Typo3Version())->getMajorVersion() < 12) {
|
||||||
$this->subject->method('redirect')
|
$this->subject->method('redirect')
|
||||||
// @phpstan-ignore-next-line This class does not exist in V12 anymore, but this branch is V11-only.
|
// @phpstan-ignore-next-line This class does not exist in V12 anymore, but this branch is V11-only.
|
||||||
->willThrowException(new StopActionException('redirectToUri', 1476045828));
|
->willThrowException(new StopActionException('redirectToUri', 1476045828));
|
||||||
|
|
|
@ -43,7 +43,7 @@ final class TeaControllerTest extends UnitTestCase
|
||||||
$this->teaRepositoryMock = $this->getMockBuilder(TeaRepository::class)->disableOriginalConstructor()->getMock();
|
$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`.
|
// We need to create an accessible mock in order to be able to set the protected `view`.
|
||||||
$methodsToMock = ['htmlResponse', 'redirect', 'redirectToUri'];
|
$methodsToMock = ['htmlResponse', 'redirect', 'redirectToUri'];
|
||||||
if ((new Typo3Version())->getMajorVersion() <= 11) {
|
if ((new Typo3Version())->getMajorVersion() < 12) {
|
||||||
$methodsToMock[] = 'forward';
|
$methodsToMock[] = 'forward';
|
||||||
}
|
}
|
||||||
$this->subject = $this->getAccessibleMock(TeaController::class, $methodsToMock, [$this->teaRepositoryMock]);
|
$this->subject = $this->getAccessibleMock(TeaController::class, $methodsToMock, [$this->teaRepositoryMock]);
|
||||||
|
|
Loading…
Reference in a new issue