function ContactLinkTest::assertContactLinks
Same name in other branches
- 8.9.x 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()
- 11.x 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.
@internal
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 101
Class
- ContactLinkTest
- Tests the contact link field.
Namespace
Drupal\Tests\contact\Functional\ViewsCode
public function assertContactLinks(array $accounts, array $names) : void {
$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}')]");
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.