You are here

public function Profile2RegpathAccessTest::testAccess in Profile2 Registration Path 7

Same name and namespace in other branches
  1. 7.2 tests/Profile2RegpathAccessTest.test \Profile2RegpathAccessTest::testAccess()

Test access to core and profile2_regpath registration pages.

File

tests/Profile2RegpathAccessTest.test, line 61
Contains Profile2RegpathAccessTest.

Class

Profile2RegpathAccessTest
@file Contains Profile2RegpathAccessTest.

Code

public function testAccess() {

  // Test the option to allow users to create their own accounts.
  variable_set('user_register', USER_REGISTER_VISITORS);
  $this
    ->resetAll();
  $this
    ->drupalGet('user');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('user/login');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('user/password');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('user/register');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('reg-path');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('reg-path/login');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('reg-path/password');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('reg-path/register');
  $this
    ->assertResponse(200);

  // Test the option where admin approval is required for account creation.
  variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
  $this
    ->resetAll();
  $this
    ->drupalGet('user');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('user/login');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('user/password');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('user/register');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('reg-path');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('reg-path/login');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('reg-path/password');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('reg-path/register');
  $this
    ->assertResponse(200);

  // Test the option where only admins may create accounts.
  variable_set('user_register', USER_REGISTER_ADMINISTRATORS_ONLY);
  $this
    ->resetAll();
  $this
    ->drupalGet('user');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('user/login');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('user/password');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('user/register');
  $this
    ->assertResponse(403);
  $this
    ->drupalGet('reg-path');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('reg-path/login');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('reg-path/password');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('reg-path/register');
  $this
    ->assertResponse(403);
}