You are here

public function RegcodeTestCase::testUserAccess in Registration codes 7.2

Tests module permissions / access to configuration page.

File

tests/regcode.test, line 56
Tests suite for the Registration codes module.

Class

RegcodeTestCase
Tests operations of the regcode module.

Code

public function testUserAccess() {

  // Test as anonymous user.
  $this
    ->drupalGet('admin/config/people/regcode/settings');
  $this
    ->assertResponse(403);
  $this
    ->assertText(t('Access denied'));
  $this
    ->assertText(t('You are not authorized to access this page.'));

  // Test as authenticated but unprivileged user.
  $this
    ->drupalLogin($this->unprivUser);
  $this
    ->drupalGet('admin/config/people/regcode/settings');
  $this
    ->assertResponse(403);
  $this
    ->drupalLogout();

  // As admin user.
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/config/people/regcode/settings');
  $this
    ->assertResponse(200);
  $this
    ->assertText(t('Configure the registration code module.'));
  $this
    ->drupalLogout();
}