function ContactPersonalTest::testAdminContact

Same name in other branches
  1. 9 core/modules/contact/tests/src/Functional/ContactPersonalTest.php \Drupal\Tests\contact\Functional\ContactPersonalTest::testAdminContact()
  2. 8.9.x core/modules/contact/tests/src/Functional/ContactPersonalTest.php \Drupal\Tests\contact\Functional\ContactPersonalTest::testAdminContact()
  3. 10 core/modules/contact/tests/src/Functional/ContactPersonalTest.php \Drupal\Tests\contact\Functional\ContactPersonalTest::testAdminContact()

Tests the personal contact form based access when an admin adds users.

File

core/modules/contact/tests/src/Functional/ContactPersonalTest.php, line 284

Class

ContactPersonalTest
Tests personal contact form functionality.

Namespace

Drupal\Tests\contact\Functional

Code

public function testAdminContact() : void {
    user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, [
        'access user contact forms',
    ]);
    $this->checkContactAccess(200);
    $this->checkContactAccess(403, FALSE);
    $config = $this->config('contact.settings');
    $config->set('user_default_enabled', FALSE);
    $config->save();
    $this->checkContactAccess(403);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.