You are here

public function ConfigSelectorTest::testGetConfigEntityLinkToUrlEditForm 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::testGetConfigEntityLinkToUrlEditForm()

@covers ::getConfigEntityLink

File

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

Class

ConfigSelectorTest
Tests the ConfigSelector.

Namespace

Drupal\Tests\config_selector\Unit

Code

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