You are here

function SecureSiteTest::testGuestDisabled in Secure Site 6

Same name and namespace in other branches
  1. 5 tests/securesite.test \SecureSiteTest::testGuestDisabled()

Check that guest mode is correctly disabled when no username and password are set

File

tests/securesite.test, line 411
Secure Site module unit tests

Class

SecureSiteTest
Unit tests for the Secure Site module

Code

function testGuestDisabled() {
  $this
    ->drupalVariableSet('securesite_enabled', SECURESITE_AUTH);
  $this
    ->drupalVariableSet('securesite_filter_pages_type', SECURESITE_WHITELIST);
  $this
    ->drupalVariableSet('securesite_filter_pages', '');
  $this
    ->drupalVariableSet('securesite_guest_name', NULL);
  $this
    ->drupalVariableSet('securesite_guest_pass', NULL);
  $this
    ->drupalGet(url(NULL, array(
    'absolute' => TRUE,
  )));
  $this
    ->assertResponse('401', t('Guest Mode: Disabled') . ': %s');
  $this
    ->assertAuthentication('Basic');
  $this
    ->assertRealm(variable_get('securesite_realm', variable_get('site_name', 'Drupal')));
}