You are here

public function OptimizelyAccessTest::testUserWithPermission in Optimizely 8

Same name and namespace in other branches
  1. 8.3 src/Tests/OptimizelyAccessTest.php \Drupal\optimizely\Tests\OptimizelyAccessTest::testUserWithPermission()
  2. 8.0 src/Tests/OptimizelyAccessTest.php \Drupal\optimizely\Tests\OptimizelyAccessTest::testUserWithPermission()

Test access allowed to module functionality by user with permission.

File

src/Tests/OptimizelyAccessTest.php, line 145

Class

OptimizelyAccessTest
Create users with no, some, and optimizely permissions.

Namespace

Drupal\optimizely\Tests

Code

public function testUserWithPermission() {
  $access_ok = '200';
  $this
    ->drupalLogin($this->privilegedUser);
  $this
    ->drupalGet($this->listingPage);
  $this
    ->assertResponse($access_ok, "<strong>User with {$this->optimizelyPermission} permission may" . " access project listing page -> {$this->listingPage} </strong>", 'Optimizely');
  $this
    ->drupalGet($this->addUpdatePage);
  $this
    ->assertResponse($access_ok, "<strong>User with {$this->optimizelyPermission} permission may" . " access project add/update page -> {$this->addUpdatePage} </strong>", 'Optimizely');
  $this
    ->drupalGet($this->deletePage);
  $this
    ->assertResponse($access_ok, "<strong>User with {$this->optimizelyPermission} permission may" . " access project delete page -> {$this->deletePage} </strong>", 'Optimizely');
  $this
    ->drupalGet($this->settingsPage);
  $this
    ->assertResponse($access_ok, "<strong>User with {$this->optimizelyPermission} permission may" . " access project settings page -> {$this->settingsPage} </strong>", 'Optimizely');
  $this
    ->drupalLogout();
}