You are here

public function EntityViewsDataTest::testEntityLinks in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/tests/src/Unit/EntityViewsDataTest.php \Drupal\Tests\views\Unit\EntityViewsDataTest::testEntityLinks()

Tests add link types.

File

core/modules/views/tests/src/Unit/EntityViewsDataTest.php, line 773
Contains \Drupal\Tests\views\Unit\EntityViewsDataTest.

Class

EntityViewsDataTest
@coversDefaultClass \Drupal\views\EntityViewsData @group Views

Namespace

Drupal\Tests\views\Unit

Code

public function testEntityLinks() {
  $this->baseEntityType
    ->setLinkTemplate('canonical', '/entity_test/{entity_test}');
  $this->baseEntityType
    ->setLinkTemplate('edit-form', '/entity_test/{entity_test}/edit');
  $this->baseEntityType
    ->setLinkTemplate('delete-form', '/entity_test/{entity_test}/delete');
  $data = $this->viewsData
    ->getViewsData();
  $this
    ->assertEquals('entity_link', $data['entity_test']['view_entity_test']['field']['id']);
  $this
    ->assertEquals('entity_link_edit', $data['entity_test']['edit_entity_test']['field']['id']);
  $this
    ->assertEquals('entity_link_delete', $data['entity_test']['delete_entity_test']['field']['id']);
}