public function ContactLinkTest::assertContactLinks in Drupal 8
Same name and namespace 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()
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));
}
}