You are here

public function ContactPersonalTest::testAdminContact in Drupal 8

Same name and namespace in other branches
  1. 9 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() {
  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);
}