function EntityTypeManagerTest::testProcessDefinition

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

Tests the processDefinition() method.

@covers ::processDefinition

File

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

Class

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

Namespace

Drupal\Tests\Core\Entity

Code

public function testProcessDefinition() : void {
  $apple = $this->prophesize(EntityTypeInterface::class);
  $this->setUpEntityTypeDefinitions([
    'apple' => $apple,
  ]);
  $apple->getLinkTemplates()
    ->willReturn([
    'canonical' => 'path/to/apple',
  ]);
  $definition = $apple->reveal();
  $this->expectException(InvalidLinkTemplateException::class);
  $this->expectExceptionMessage("Link template 'canonical' for entity type 'apple' must start with a leading slash, the current link template is 'path/to/apple'");
  $this->entityTypeManager
    ->processDefinition($definition, 'apple');
}

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