You are here

public function UserTest::buildLinkProvider in Freelinking 8.3

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

Provide test parameters for ::testBuildLink.

Return value

array An array of test parameters.

File

tests/src/Unit/Plugin/freelinking/UserTest.php, line 159

Class

UserTest
Tests the user plugin.

Namespace

Drupal\Tests\freelinking\Unit\Plugin\freelinking

Code

public function buildLinkProvider() {
  $failoverTarget = [
    'target' => 'uid:2',
    'dest' => '2',
    'language' => NULL,
  ];
  $failoverExpected = [
    '#theme' => 'freelink_error',
    '#plugin' => 'user',
    '#message' => 'User %user not found',
  ];
  $successTarget = [
    'target' => 'uid:1',
    'dest' => '1',
    'language' => NULL,
  ];
  $successExpected = [
    '#type' => 'link',
    '#title' => 'admin',
    '#attributes' => [
      'title' => 'Click to view user profile.',
    ],
  ];
  $userNameTarget = [
    'target' => 'user:admin',
    'dest' => 'admin',
    'language' => NULL,
  ];
  $userNameExpected = [
    '#type' => 'link',
    '#title' => 'admin',
    '#attributes' => [
      'title' => 'Click to view user profile.',
    ],
  ];
  return [
    [
      $failoverTarget,
      $failoverExpected,
      TRUE,
    ],
    [
      $successTarget,
      $successExpected,
      FALSE,
    ],
    [
      $userNameTarget,
      $userNameExpected,
      FALSE,
    ],
  ];
}