function EntityTypeManagerTest::testGetDefinitionInvalidException

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetDefinitionInvalidException()
  2. 10 core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetDefinitionInvalidException()
  3. 9 core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetDefinitionInvalidException()

Tests the getDefinition() method with an invalid definition.

@covers ::getDefinition

File

core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php, line 380

Class

EntityTypeManagerTest
@coversDefaultClass \Drupal\Core\Entity\EntityTypeManager[[api-linebreak]] @group Entity

Namespace

Drupal\Tests\Core\Entity

Code

public function testGetDefinitionInvalidException() {
  $this->setUpEntityTypeDefinitions();
  $this->expectException(PluginNotFoundException::class);
  $this->expectExceptionMessage('The "pear" entity type does not exist.');
  $this->entityTypeManager
    ->getDefinition('pear', TRUE);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.