public function UserUnauthorizedTest::testBuildLink in Freelinking 8.3
Same name and namespace in other branches
- 4.0.x tests/src/Unit/Plugin/freelinking/UserUnauthorizedTest.php \Drupal\Tests\freelinking\Unit\Plugin\freelinking\UserUnauthorizedTest::testBuildLink()
Assert the buildLink method returns correct render array.
File
- tests/
src/ Unit/ Plugin/ freelinking/ UserUnauthorizedTest.php, line 69
Class
- UserUnauthorizedTest
- Tests the user plugin when the current user does not have access.
Namespace
Drupal\Tests\freelinking\Unit\Plugin\freelinkingCode
public function testBuildLink() {
$expected = [
'#theme' => 'freelink_error',
'#plugin' => 'user',
'#message' => new TranslatableMarkup('Unauthorized to view user profile.', [], [], $this->translationInterfaceMock),
];
$target = [
'target' => 'uid:2|Some user',
'dest' => '2',
'language' => NULL,
];
$this
->assertEquals($expected, $this->plugin
->buildLink($target));
}