public function LinkitAutocompleteTest::testAutocompletionEmail in Linkit 8.5
Tests the autocomplete with an email address.
File
- tests/
src/ Kernel/ LinkitAutocompleteTest.php, line 105
Class
- LinkitAutocompleteTest
- Tests the linkit autocomplete functionality.
Namespace
Drupal\Tests\linkit\KernelCode
public function testAutocompletionEmail() {
/** @var \Drupal\linkit\MatcherInterface $plugin */
$plugin = $this->matcherManager
->createInstance('email');
$this->linkitProfile
->addMatcher($plugin
->getConfiguration());
$this->linkitProfile
->save();
$email = 'drupal@example.com';
$data = $this
->getAutocompleteResult($email);
$this
->assertSame((string) new FormattableMarkup('E-mail @email', [
'@email' => $email,
]), $data[0]['label'], 'Autocomplete returned email suggestion.');
$this
->assertSame('mailto:' . $email, $data[0]['path'], 'Autocomplete returned email suggestion with an mailto href.');
}