You are here

function ContactAuthenticatedUserTest::testContactSiteWideTextfieldsLoggedInTestCase in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/contact/src/Tests/ContactAuthenticatedUserTest.php \Drupal\contact\Tests\ContactAuthenticatedUserTest::testContactSiteWideTextfieldsLoggedInTestCase()

Tests that name and email fields are not present for authenticated users.

File

core/modules/contact/src/Tests/ContactAuthenticatedUserTest.php, line 29
Contains \Drupal\contact\Tests\ContactAuthenticatedUserTest.

Class

ContactAuthenticatedUserTest
Tests contact form textfields are present if authenticated.

Namespace

Drupal\contact\Tests

Code

function testContactSiteWideTextfieldsLoggedInTestCase() {
  $this
    ->drupalLogin($this
    ->drupalCreateUser(array(
    'access site-wide contact form',
  )));
  $this
    ->drupalGet('contact');

  // Ensure that there is no textfield for name.
  $this
    ->assertFalse($this
    ->xpath('//input[@name=:name]', array(
    ':name' => 'name',
  )));

  // Ensure that there is no textfield for email.
  $this
    ->assertFalse($this
    ->xpath('//input[@name=:name]', array(
    ':name' => 'mail',
  )));
}