You are here

function ContactPersonalTest::testAdminContact in Zircon Profile 8

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

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

File

core/modules/contact/src/Tests/ContactPersonalTest.php, line 261
Contains \Drupal\contact\Tests\ContactPersonalTest.

Class

ContactPersonalTest
Tests personal contact form functionality.

Namespace

Drupal\contact\Tests

Code

function testAdminContact() {
  user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array(
    '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);
}