You are here

public function OptimizelyTestUserRoleTestCase::testOptimizelyTestUserRolePublicAccess in Optimizely 7.3

Same name and namespace in other branches
  1. 7.2 optimizely.test \OptimizelyTestUserRoleTestCase::testOptimizelyTestUserRolePublicAccess()

OptimizelyTestAdminRoleCase testOptimizelyTestUserRolePublicAccess()

File

./optimizely.test, line 62
Optimizely Tests

Class

OptimizelyTestUserRoleTestCase
OptimizelyTestUserRoleTestCase: Create anonymous, authenticated and privileged user to test access to module related pages.

Code

public function testOptimizelyTestUserRolePublicAccess() {
  for ($i = 1; $i <= 2; $i++) {
    if ($i == 1) {
      $target = $i . '. <strong>Anonymous</strong>';
      $this
        ->drupalLogin($this->anonymous_user);
    }
    else {
      $target = $i . '. <strong>Authenticated</strong>';
      $this
        ->drupalLogin($this->authenticated_user);
    }

    // Tests
    $this
      ->drupalGet('admin/config/system/optimizely');
    $this
      ->assertNoRaw('<h1 class="page-title">Optimizely</h1>', $target . ' user *<strong>can not</strong>* access project listing page -> admin/config/system/optimizely');
    $this
      ->drupalGet('admin/config/system/optimizely/default');
    $this
      ->assertNoRaw('<h1 class="page-title">Optimizely</h1>', $target . ' user *<strong>can not</strong>* access project listing page -> admin/config/system/optimizely/default');
    $this
      ->drupalGet('admin/config/system/optimizely/add_update');
    $this
      ->assertNoRaw('<h1 class="page-title">Optimizely</h1>', $target . ' user *<strong>can not</strong>* access project add form page -> admin/config/system/optimizely/add_update');
    $this
      ->drupalGet('admin/config/system/optimizely/settings');
    $this
      ->assertNoRaw('<h1 class="page-title">Optimizely</h1>', $target . ' user *<strong>can not</strong>* access settings page -> admin/config/system/optimizely/settings');
    $this
      ->drupalGet('admin/config/system/optimizely/ajax');
    $this
      ->assertNoRaw('<h1 class="page-title">Optimizely</h1>', $target . ' user *<strong>can not</strong>* access AJAX callback URL -> /admin/config/system/optimizely/ajax');
    $this
      ->drupalLogout();
  }
}