You are here

public function NodeTitleTest::testBuildLink in Freelinking 4.0.x

Same name and namespace in other branches
  1. 8.3 tests/src/Unit/Plugin/freelinking/NodeTitleTest.php \Drupal\Tests\freelinking\Unit\Plugin\freelinking\NodeTitleTest::testBuildLink()

Assert that build link will return a render array.

File

tests/src/Unit/Plugin/freelinking/NodeTitleTest.php, line 107

Class

NodeTitleTest
Tests the nodetitle plugin behavior.

Namespace

Drupal\Tests\freelinking\Unit\Plugin\freelinking

Code

public function testBuildLink() {
  $language = self::getDefaultLanguage();
  $expected = [
    '#type' => 'link',
    '#title' => 'Test Node',
    '#url' => Url::fromRoute('entity.node.canonical', [
      'node' => 1,
    ], [
      'language' => $language,
    ]),
    '#attributes' => [
      'title' => $this->plugin
        ->getTip(),
    ],
  ];
  $target = [
    'dest' => 'Test Node',
    'language' => $language,
  ];
  $this
    ->assertEquals($expected, $this->plugin
    ->buildLink($target));
}