public function SearchTest::testBuildLink in Freelinking 8.3
Same name and namespace in other branches
- 4.0.x tests/src/Unit/Plugin/freelinking/SearchTest.php \Drupal\Tests\freelinking\Unit\Plugin\freelinking\SearchTest::testBuildLink()
Asserts that buildLink is functional when search enabled.
File
- tests/
src/ Unit/ Plugin/ freelinking/ SearchTest.php, line 92
Class
- SearchTest
- Tests the search plugin.
Namespace
Drupal\Tests\freelinking\Unit\Plugin\freelinkingCode
public function testBuildLink() {
$expected = [
'#type' => 'link',
'#title' => 'Search Test',
'#url' => Url::fromUri('base:search/node', [
'language' => NULL,
'query' => [
'keys' => 'A+search+string',
],
]),
'#attributes' => [
'title' => new TranslatableMarkup('Search this site for content.', [], [], $this->translationInterfaceMock),
],
];
$target = [
'target' => 'search:A search string|Search Test',
'dest' => 'A search string',
'text' => 'Search Test',
'language' => NULL,
];
$this
->assertEquals($expected, $this->plugin
->buildLink($target));
}