You are here

public function ConfigSelectorTest::testGetConfigEntityLinkToUrlCanonical in Configuration selector 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/ConfigSelectorTest.php \Drupal\Tests\config_selector\Unit\ConfigSelectorTest::testGetConfigEntityLinkToUrlCanonical()

@covers ::getConfigEntityLink

File

tests/src/Unit/ConfigSelectorTest.php, line 36

Class

ConfigSelectorTest
Tests the ConfigSelector.

Namespace

Drupal\Tests\config_selector\Unit

Code

public function testGetConfigEntityLinkToUrlCanonical() {
  $config_entity = $this
    ->prophesize(ConfigEntityInterface::class);
  $config_entity
    ->hasLinkTemplate('edit-form')
    ->willReturn(FALSE);
  $url = $this
    ->prophesize(Url::class);
  $url
    ->toString()
    ->willReturn('a/link/to/canonical');
  $config_entity
    ->toUrl()
    ->willReturn($url);
  $config_entity
    ->toUrl('edit-form')
    ->shouldNotBeCalled();
  $this
    ->assertEquals('a/link/to/canonical', ConfigSelector::getConfigEntityLink($config_entity
    ->reveal()));
}