Skip to content

Commit

Permalink
[TASK] Mock interfaces instead of abstract classes
Browse files Browse the repository at this point in the history
`getMockForAbstractClass` has been (soft-)deprecated in PHPUnit 10.1:
sebastianbergmann/phpunit#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/+/80458
Reviewed-by: Christian Kuhn <[email protected]>
Tested-by: core-ci <[email protected]>
Tested-by: Christian Kuhn <[email protected]>
  • Loading branch information
oliverklee authored and lolli42 committed Aug 8, 2023
1 parent 7a2c828 commit 3a7b903
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Tests/Unit/View/TemplatePathsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.' => [
Expand Down Expand Up @@ -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.' => [
Expand Down Expand Up @@ -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.' => [
Expand Down

0 comments on commit 3a7b903

Please sign in to comment.