diff --git a/core/lib/Drupal/Core/Entity/EntityStorageBase.php b/core/lib/Drupal/Core/Entity/EntityStorageBase.php index aa3b3a0b9b27b2b1a93cad8d38681c43a9f25721..25d2f603609ee56259daabe7360697c0e77b9f48 100644 --- a/core/lib/Drupal/Core/Entity/EntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageBase.php @@ -246,7 +246,7 @@ protected function doCreate(array $values) { * {@inheritdoc} */ public function load($id) { - assert(!is_null($id), 'Cannot load a NULL ID.'); + assert(!is_null($id), sprintf('Cannot load the "%s" entity with NULL ID.', $this->entityTypeId)); $entities = $this->loadMultiple([$id]); return isset($entities[$id]) ? $entities[$id] : NULL; } diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php index 7ea179766f339b76c1e781b00700a84f0185b1cd..04d370151018bd50418ee901a96b8eeac3239994 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php @@ -564,7 +564,7 @@ public function testLoad() { $this->assertSame('foo', $entity->id()); $this->expectException(\AssertionError::class); - $this->expectExceptionMessage('Cannot load a NULL ID.'); + $this->expectExceptionMessage(sprintf('Cannot load the "%s" entity with NULL ID.', $this->entityTypeId)); $this->entityStorage->load(NULL); }