You are here

public function NodeTest::buildLinkProvider in Freelinking 8.3

Same name and namespace in other branches
  1. 4.0.x tests/src/Unit/Plugin/freelinking/NodeTest.php \Drupal\Tests\freelinking\Unit\Plugin\freelinking\NodeTest::buildLinkProvider()

Provide test parameters for ::testBuildLink.

Return value

array An array of test parameters.

File

tests/src/Unit/Plugin/freelinking/NodeTest.php, line 158

Class

NodeTest
Tests the nid plugin.

Namespace

Drupal\Tests\freelinking\Unit\Plugin\freelinking

Code

public function buildLinkProvider() {
  $language = self::getDefaultLanguage();
  $failoverTarget = [
    'target' => 'nid:2',
    'dest' => '2',
    'language' => $language,
  ];
  $failoverExpected = [
    '#theme' => 'freelink_error',
    '#plugin' => 'nid',
    '#message' => 'Invalid node ID @nid',
  ];
  $successTarget = [
    'target' => 'nid:1',
    'dest' => '1',
    'language' => $language,
  ];
  $successExpected = [
    '#type' => 'link',
    '#title' => 'Test Node',
    '#attributes' => [
      'title' => 'Click to view a local node',
    ],
  ];
  return [
    [
      $failoverTarget,
      $failoverExpected,
      TRUE,
    ],
    [
      $successTarget,
      $successExpected,
      FALSE,
    ],
  ];
}