public function ContactLinkTest::assertContactLinks in Drupal 9
Same name and namespace in other branches
- 8 core/modules/contact/tests/src/Functional/Views/ContactLinkTest.php \Drupal\Tests\contact\Functional\Views\ContactLinkTest::assertContactLinks()
- 10 core/modules/contact/tests/src/Functional/Views/ContactLinkTest.php \Drupal\Tests\contact\Functional\Views\ContactLinkTest::assertContactLinks()
Asserts whether certain users contact links appear on the page.
Parameters
array $accounts: All user objects used by the test.
array $names: Users which should have contact links.
1 call to ContactLinkTest::assertContactLinks()
- ContactLinkTest::testContactLink in core/
modules/ contact/ tests/ src/ Functional/ Views/ ContactLinkTest.php - Tests contact link.
File
- core/
modules/ contact/ tests/ src/ Functional/ Views/ ContactLinkTest.php, line 102
Class
- ContactLinkTest
- Tests the contact link field.
Namespace
Drupal\Tests\contact\Functional\ViewsCode
public function assertContactLinks(array $accounts, array $names) {
$this
->assertSession()
->elementsCount('xpath', '//div[contains(@class, "views-field-contact")]//a', count($names));
foreach ($names as $name) {
$account_url = $accounts[$name]
->toUrl('contact-form')
->toString();
$this
->assertSession()
->elementExists('xpath', "//div[contains(@class, 'views-field-contact')]//a[contains(@href, '{$account_url}')]");
}
}