From 9488a4279a54d6c9f19e5eac097919ce108e626d Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Sun, 8 Oct 2023 11:35:42 +0200 Subject: [PATCH] [TASK] Migrate getAccessibleMockForAbstractClass for EXT:form controller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `getMockForAbstractClass` has been (soft-)deprecated in PHPUnit 10.1: https://github.com/sebastianbergmann/phpunit/issues/5241 Hence, we should replace its usages to follow best practices and avoid deprecation warnings later with PHPUnit 11. We do this by creating dedicated fixture subclasses of the affected abstract classes. This change also cleans up the affected test to better match the setup/execute/verify structure. Resolves: #102117 Related: #101601 Releases: main, 12.4 Change-Id: Iaa6cee9893d41cb95e20cda80e03f044d52d82cd Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81350 Reviewed-by: Stefan Bürk Tested-by: Stefan Bürk Tested-by: core-ci --- .../AbstractBackendControllerTest.php | 23 +++++--------- .../Controller/Fixtures/TestingController.php | 31 +++++++++++++++++++ 2 files changed, 38 insertions(+), 16 deletions(-) create mode 100644 Tests/Unit/Controller/Fixtures/TestingController.php diff --git a/Tests/Unit/Controller/AbstractBackendControllerTest.php b/Tests/Unit/Controller/AbstractBackendControllerTest.php index e332a3cda..1b992068c 100644 --- a/Tests/Unit/Controller/AbstractBackendControllerTest.php +++ b/Tests/Unit/Controller/AbstractBackendControllerTest.php @@ -17,7 +17,7 @@ namespace TYPO3\CMS\Form\Tests\Unit\Controller; -use TYPO3\CMS\Form\Controller\AbstractBackendController; +use TYPO3\CMS\Form\Tests\Unit\Controller\Fixtures\TestingController; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; final class AbstractBackendControllerTest extends UnitTestCase @@ -25,23 +25,14 @@ final class AbstractBackendControllerTest extends UnitTestCase /** * @test */ - public function resolveResourcePathsExpectResolve(): void + public function resolveResourcePathsResolvesExtNotation(): void { - $mockController = $this->getAccessibleMockForAbstractClass( - AbstractBackendController::class, - [], - '', - false - ); + $subject = new TestingController(); + $input = [0 => 'EXT:form/Resources/Public/Css/form.css']; - $input = [ - 0 => 'EXT:form/Resources/Public/Css/form.css', - ]; + $result = $subject->resolveResourcePaths($input); - $expected = [ - 0 => 'typo3/sysext/form/Resources/Public/Css/form.css', - ]; - - self::assertSame($expected, $mockController->_call('resolveResourcePaths', $input)); + $expected = [0 => 'typo3/sysext/form/Resources/Public/Css/form.css']; + self::assertSame($expected, $result); } } diff --git a/Tests/Unit/Controller/Fixtures/TestingController.php b/Tests/Unit/Controller/Fixtures/TestingController.php new file mode 100644 index 000000000..0b744945b --- /dev/null +++ b/Tests/Unit/Controller/Fixtures/TestingController.php @@ -0,0 +1,31 @@ +