diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index 8430ef4feadad5c6c501e1a3f3ee7c771cc945a2..d0e01ee35970ea53666803cdf0dd2e94d57135d0 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -59607,18 +59607,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php', ]; -$ignoreErrors[] = [ - // identifier: method.deprecated - 'message' => '#^Call to deprecated method getMockForAbstractClass\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\MockBuilder\\.$#', - 'count' => 3, - 'path' => __DIR__ . '/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php', -]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\Tests\\\\Core\\\\Entity\\\\Sql\\\\SqlContentEntityStorageTestEntityInterface\\:\\:postLoad\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\Tests\\\\Core\\\\EventSubscriber\\\\ActiveLinkResponseFilterTest\\:\\:providerTestSetLinkActiveClass\\(\\) has no return type specified\\.$#', diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php index fe60e94d80c2382dd3792c342d9f1673fd2d8e01..ac82ac94c5ff15542527f5ba546897705f233d1c 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php @@ -9,7 +9,6 @@ use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Entity\EntityFieldManager; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Entity\EntityTypeManager; use Drupal\Core\Entity\Query\QueryFactoryInterface; @@ -17,6 +16,7 @@ use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Language\Language; use Drupal\Tests\Core\Entity\ContentEntityBaseMockableClass; +use Drupal\Tests\Core\Entity\StubEntityBase; use Drupal\Tests\UnitTestCase; use Prophecy\Argument; @@ -1109,7 +1109,7 @@ public function testCreate(): void { ->method('id') ->willReturn('foo'); - $this->assertInstanceOf('Drupal\Core\Entity\EntityInterface', $entity); + $this->assertInstanceOf(EntityInterface::class, $entity); $this->assertSame('foo', $entity->id()); $this->assertTrue($entity->isNew()); } @@ -1191,8 +1191,10 @@ public function testLoadMultiplePersistentCached(): void { $key = 'values:' . $this->entityTypeId . ':1'; $id = 1; - $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTestEntityInterface') - ->getMockForAbstractClass(); + $entity = $this->getMockBuilder(StubEntityBase::class) + ->disableOriginalConstructor() + ->onlyMethods(['id']) + ->getMock(); $entity->expects($this->any()) ->method('id') ->willReturn($id); @@ -1226,8 +1228,10 @@ public function testLoadMultipleNoPersistentCache(): void { $this->setUpModuleHandlerNoImplementations(); $id = 1; - $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTestEntityInterface') - ->getMockForAbstractClass(); + $entity = $this->getMockBuilder(StubEntityBase::class) + ->disableOriginalConstructor() + ->onlyMethods(['id']) + ->getMock(); $entity->expects($this->any()) ->method('id') ->willReturn($id); @@ -1277,8 +1281,10 @@ public function testLoadMultiplePersistentCacheMiss(): void { $this->setUpModuleHandlerNoImplementations(); $id = 1; - $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTestEntityInterface') - ->getMockForAbstractClass(); + $entity = $this->getMockBuilder(StubEntityBase::class) + ->disableOriginalConstructor() + ->onlyMethods(['id']) + ->getMock(); $entity->expects($this->any()) ->method('id') ->willReturn($id); @@ -1460,16 +1466,3 @@ protected function setUpModuleHandlerNoImplementations(): void { } } - -/** - * Provides an entity with dummy implementations of static methods. - */ -abstract class SqlContentEntityStorageTestEntityInterface implements EntityInterface { - - /** - * {@inheritdoc} - */ - public static function postLoad(EntityStorageInterface $storage, array &$entities) { - } - -}