From f5a912574d39963baf8c976848196c5572c75355 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Tue, 16 May 2023 13:17:02 +0200 Subject: [PATCH] [TASK] Adapt expectations for backend link viewhelpers --- .../Link/Be/AuthorViewHelperTest.php | 21 ++++++++++++------- .../Link/Be/CategoryViewHelperTest.php | 21 ++++++++++++------- .../Link/Be/CommentViewHelperTest.php | 21 ++++++++++++------- .../Link/Be/PostViewHelperTest.php | 9 +++++++- .../ViewHelpers/Link/Be/TagViewHelperTest.php | 21 ++++++++++++------- 5 files changed, 64 insertions(+), 29 deletions(-) diff --git a/Tests/Functional/ViewHelpers/Link/Be/AuthorViewHelperTest.php b/Tests/Functional/ViewHelpers/Link/Be/AuthorViewHelperTest.php index 31884583..cb6e6bf9 100644 --- a/Tests/Functional/ViewHelpers/Link/Be/AuthorViewHelperTest.php +++ b/Tests/Functional/ViewHelpers/Link/Be/AuthorViewHelperTest.php @@ -15,6 +15,8 @@ use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Information\Typo3Version; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextFactory; use TYPO3\CMS\Fluid\View\TemplateView; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -55,34 +57,39 @@ public function render(string $template, string $expected): void public static function renderDataProvider(): array { + $expectedReturnUrl = '/'; + if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { + $expectedReturnUrl = '%2F'; + } + return [ 'simple' => [ '', - 'Info', + 'Info', ], 'target' => [ '', - 'Info', + 'Info', ], 'itemprop' => [ '', - 'Info', + 'Info', ], 'rel' => [ '', - 'Info', + 'Info', ], 'returnUri' => [ '', - '/typo3/record/edit?token=dummyToken&edit%5Btx_blog_domain_model_author%5D%5B123%5D=edit&returnUrl=%2F', + '/typo3/record/edit?token=dummyToken&edit%5Btx_blog_domain_model_author%5D%5B123%5D=edit&returnUrl=' . $expectedReturnUrl, ], 'content' => [ 'Hello', - 'Hello', + 'Hello', ], 'class' => [ '', - 'Info', + 'Info', ], ]; } diff --git a/Tests/Functional/ViewHelpers/Link/Be/CategoryViewHelperTest.php b/Tests/Functional/ViewHelpers/Link/Be/CategoryViewHelperTest.php index 3ec9a058..aae85b54 100644 --- a/Tests/Functional/ViewHelpers/Link/Be/CategoryViewHelperTest.php +++ b/Tests/Functional/ViewHelpers/Link/Be/CategoryViewHelperTest.php @@ -15,6 +15,8 @@ use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Information\Typo3Version; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextFactory; use TYPO3\CMS\Fluid\View\TemplateView; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -54,34 +56,39 @@ public function render(string $template, string $expected): void public static function renderDataProvider(): array { + $expectedReturnUrl = '/'; + if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { + $expectedReturnUrl = '%2F'; + } + return [ 'simple' => [ '', - 'Demo', + 'Demo', ], 'target' => [ '', - 'Demo', + 'Demo', ], 'itemprop' => [ '', - 'Demo', + 'Demo', ], 'rel' => [ '', - 'Demo', + 'Demo', ], 'returnUri' => [ '', - '/typo3/record/edit?token=dummyToken&edit%5Bsys_category%5D%5B123%5D=edit&returnUrl=%2F', + '/typo3/record/edit?token=dummyToken&edit%5Bsys_category%5D%5B123%5D=edit&returnUrl=' . $expectedReturnUrl . '', ], 'content' => [ 'Hello', - 'Hello', + 'Hello', ], 'class' => [ '', - 'Demo', + 'Demo', ], ]; } diff --git a/Tests/Functional/ViewHelpers/Link/Be/CommentViewHelperTest.php b/Tests/Functional/ViewHelpers/Link/Be/CommentViewHelperTest.php index 9ae07127..d5f56a17 100644 --- a/Tests/Functional/ViewHelpers/Link/Be/CommentViewHelperTest.php +++ b/Tests/Functional/ViewHelpers/Link/Be/CommentViewHelperTest.php @@ -15,6 +15,8 @@ use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Information\Typo3Version; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextFactory; use TYPO3\CMS\Fluid\View\TemplateView; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -54,34 +56,39 @@ public function render(string $template, string $expected): void public static function renderDataProvider(): array { + $expectedReturnUrl = '/'; + if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { + $expectedReturnUrl = '%2F'; + } + return [ 'simple' => [ '', - 'Lipsum', + 'Lipsum', ], 'target' => [ '', - 'Lipsum', + 'Lipsum', ], 'itemprop' => [ '', - 'Lipsum', + 'Lipsum', ], 'rel' => [ '', - 'Lipsum', + 'Lipsum', ], 'returnUri' => [ '', - '/typo3/record/edit?token=dummyToken&edit%5Btx_blog_domain_model_comment%5D%5B123%5D=edit&returnUrl=%2F', + '/typo3/record/edit?token=dummyToken&edit%5Btx_blog_domain_model_comment%5D%5B123%5D=edit&returnUrl=' . $expectedReturnUrl . '', ], 'content' => [ 'Hello', - 'Hello', + 'Hello', ], 'class' => [ '', - 'Lipsum', + 'Lipsum', ], ]; } diff --git a/Tests/Functional/ViewHelpers/Link/Be/PostViewHelperTest.php b/Tests/Functional/ViewHelpers/Link/Be/PostViewHelperTest.php index 76380a6d..7742ce59 100644 --- a/Tests/Functional/ViewHelpers/Link/Be/PostViewHelperTest.php +++ b/Tests/Functional/ViewHelpers/Link/Be/PostViewHelperTest.php @@ -15,6 +15,8 @@ use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Information\Typo3Version; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextFactory; use TYPO3\CMS\Fluid\View\TemplateView; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -54,6 +56,11 @@ public function render(string $template, string $expected): void public static function renderDataProvider(): array { + $expectedReturnUrl = '/'; + if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { + $expectedReturnUrl = '%2F'; + } + return [ 'simple' => [ '', @@ -61,7 +68,7 @@ public static function renderDataProvider(): array ], 'action edit' => [ '', - 'Demo', + 'Demo', ], 'target' => [ '', diff --git a/Tests/Functional/ViewHelpers/Link/Be/TagViewHelperTest.php b/Tests/Functional/ViewHelpers/Link/Be/TagViewHelperTest.php index bdad1d1a..2f5af745 100644 --- a/Tests/Functional/ViewHelpers/Link/Be/TagViewHelperTest.php +++ b/Tests/Functional/ViewHelpers/Link/Be/TagViewHelperTest.php @@ -15,6 +15,8 @@ use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Information\Typo3Version; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextFactory; use TYPO3\CMS\Fluid\View\TemplateView; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -54,34 +56,39 @@ public function render(string $template, string $expected): void public static function renderDataProvider(): array { + $expectedReturnUrl = '/'; + if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { + $expectedReturnUrl = '%2F'; + } + return [ 'simple' => [ '', - 'Demo', + 'Demo', ], 'target' => [ '', - 'Demo', + 'Demo', ], 'itemprop' => [ '', - 'Demo', + 'Demo', ], 'rel' => [ '', - 'Demo', + 'Demo', ], 'returnUri' => [ '', - '/typo3/record/edit?token=dummyToken&edit%5Btx_blog_domain_model_tag%5D%5B123%5D=edit&returnUrl=%2F', + '/typo3/record/edit?token=dummyToken&edit%5Btx_blog_domain_model_tag%5D%5B123%5D=edit&returnUrl=' . $expectedReturnUrl . '', ], 'content' => [ 'Hello', - 'Hello', + 'Hello', ], 'class' => [ '', - 'Demo', + 'Demo', ], ]; }