From c5e70f6a19376666fc4d919ab9fadbeb52b5749b Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Mon, 7 Aug 2023 18:37:41 +0200 Subject: [PATCH] [TASK] Mock interfaces instead of abstract classes 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 current best practices. This changes tackles the classes where we can mock an interface instead of an abstract class, allowing us to use `createMock` instead of `getMockForAbstractClass`. Resolves: #101609 Related: #101601 Releases: main, 12.4 Change-Id: I995f70d779a1bc6251bc4479c3dcb2ee548314f1 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80455 Tested-by: core-ci Tested-by: Christian Kuhn Reviewed-by: Christian Kuhn Reviewed-by: Stefan B�rk Tested-by: Stefan B�rk --- Tests/Unit/View/TemplatePathsTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/Unit/View/TemplatePathsTest.php b/Tests/Unit/View/TemplatePathsTest.php index 511d18a6..30c1b47b 100644 --- a/Tests/Unit/View/TemplatePathsTest.php +++ b/Tests/Unit/View/TemplatePathsTest.php @@ -102,7 +102,7 @@ public function pathSetterMethodSortsPathsByKeyDescending($method, array $paths, */ public function getContextSpecificViewConfigurationSortsTypoScriptConfiguredPathsCorrectlyInFrontendMode(): void { - $configurationManager = $this->getMockBuilder(ConfigurationManagerInterface::class)->getMockForAbstractClass(); + $configurationManager = $this->createMock(ConfigurationManagerInterface::class); $configurationManager->expects(self::once())->method('getConfiguration')->willReturn([ 'plugin.' => [ 'tx_test.' => [ @@ -159,7 +159,7 @@ public function getContextSpecificViewConfigurationSortsTypoScriptConfiguredPath */ public function getContextSpecificViewConfigurationSortsTypoScriptConfiguredPathsCorrectlyInBackendMode(): void { - $configurationManager = $this->getMockBuilder(ConfigurationManagerInterface::class)->getMockForAbstractClass(); + $configurationManager = $this->createMock(ConfigurationManagerInterface::class); $configurationManager->expects(self::once())->method('getConfiguration')->willReturn([ 'module.' => [ 'tx_test.' => [ @@ -216,7 +216,7 @@ public function getContextSpecificViewConfigurationSortsTypoScriptConfiguredPath */ public function getContextSpecificViewConfigurationDoesNotResolveFromTypoScriptAndDoesNotSortInUnspecifiedMode(): void { - $configurationManager = $this->getMockBuilder(ConfigurationManagerInterface::class)->getMockForAbstractClass(); + $configurationManager = $this->createMock(ConfigurationManagerInterface::class); $configurationManager->expects(self::once())->method('getConfiguration')->willReturn([ 'plugin.' => [ 'tx_test.' => [