You are here

public function RestLinkManagerTest::testRestLinkManagersSetLinkDomain in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/rest/src/Tests/RestLinkManagerTest.php \Drupal\rest\Tests\RestLinkManagerTest::testRestLinkManagersSetLinkDomain()

Tests \Drupal\rest\LinkManager\LinkManager::setLinkDomain().

File

core/modules/rest/src/Tests/RestLinkManagerTest.php, line 80
Contains \Drupal\rest\Tests\RestLinkManagerTest.

Class

RestLinkManagerTest
Tests that REST type and relation link managers work as expected @group rest

Namespace

Drupal\rest\Tests

Code

public function testRestLinkManagersSetLinkDomain() {

  /* @var \Drupal\rest\LinkManager\LinkManager $link_manager */
  $link_manager = \Drupal::service('rest.link_manager');
  $link_manager
    ->setLinkDomain('http://example.com/');
  $link = $link_manager
    ->getTypeUri('node', 'page');
  $this
    ->assertEqual($link, 'http://example.com/rest/type/node/page');
  $link = $link_manager
    ->getRelationUri('node', 'page', 'field_ref');
  $this
    ->assertEqual($link, 'http://example.com/rest/relation/node/page/field_ref');
}