From e22cc21ebbb6c7b1f82d07ccf6365e34fd078d93 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Fri, 22 Nov 2024 14:17:04 +0000 Subject: [PATCH] Issue #3483577 by mondrake: Method getMockForAbstractClass() is deprecated - replace in class EntityFormTest --- core/.phpstan-baseline.php | 6 ------ core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php | 5 ++++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index f6db2c3eb58..c62f3ab5c5d 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -61353,12 +61353,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php', ]; -$ignoreErrors[] = [ - // identifier: method.deprecated - 'message' => '#^Call to deprecated method getMockForAbstractClass\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/Drupal/Tests/Core/Entity/EntityFormTest.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\Tests\\\\Core\\\\Entity\\\\EntityFormTest\\:\\:providerTestFormIds\\(\\) has no return type specified\\.$#', diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php index b16345420dd..d91d6334150 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php @@ -54,7 +54,10 @@ class EntityFormTest extends UnitTestCase { public function testFormId($expected, $definition): void { $this->entityType->set('entity_keys', ['bundle' => $definition['bundle']]); - $entity = $this->getMockForAbstractClass('Drupal\Core\Entity\EntityBase', [[], $definition['entity_type']], '', TRUE, TRUE, TRUE, ['getEntityType', 'bundle']); + $entity = $this->getMockBuilder(StubEntityBase::class) + ->setConstructorArgs([[], $definition['entity_type']]) + ->onlyMethods(['getEntityType', 'bundle']) + ->getMock(); $entity->expects($this->any()) ->method('getEntityType')