function ContactLinkTest::assertContactLinks
Same name in other branches
- 9 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.
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) {
$result = $this->xpath('//div[contains(@class, "views-field-contact")]//a');
$this->assertEqual(count($result), count($names));
foreach ($names as $name) {
$account = $accounts[$name];
$result = $this->xpath('//div[contains(@class, "views-field-contact")]//a[contains(@href, :url)]', [
':url' => $account->toUrl('contact-form')
->toString(),
]);
$this->assertGreaterThan(0, count($result));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.