private function OptimizelyAccessTest::checkNoAccess in Optimizely 8
Same name and namespace in other branches
- 8.3 src/Tests/OptimizelyAccessTest.php \Drupal\optimizely\Tests\OptimizelyAccessTest::checkNoAccess()
- 8.0 src/Tests/OptimizelyAccessTest.php \Drupal\optimizely\Tests\OptimizelyAccessTest::checkNoAccess()
Check that a user does not have access to the Optimizely pages.
1 call to OptimizelyAccessTest::checkNoAccess()
- OptimizelyAccessTest::testUserNoPermission in src/
Tests/ OptimizelyAccessTest.php - Test access to module functionality by users without permission.
File
- src/
Tests/ OptimizelyAccessTest.php, line 102
Class
- OptimizelyAccessTest
- Create users with no, some, and optimizely permissions.
Namespace
Drupal\optimizely\TestsCode
private function checkNoAccess($user) {
$access_forbidden = '403';
$this
->drupalLogin($user);
$this
->drupalGet($this->listingPage);
$this
->assertResponse($access_forbidden, "<strong>User without {$this->optimizelyPermission} permission may not" . " access project listing page -> {$this->listingPage} </strong>", 'Optimizely');
$this
->drupalGet($this->addUpdatePage);
$this
->assertResponse($access_forbidden, "<strong>User without {$this->optimizelyPermission} permission may not" . " access project add/update page -> {$this->addUpdatePage} </strong>", 'Optimizely');
$this
->drupalGet($this->deletePage);
$this
->assertResponse($access_forbidden, "<strong>User without {$this->optimizelyPermission} permission may not" . " access project delete page -> {$this->deletePage} </strong>", 'Optimizely');
$this
->drupalGet($this->settingsPage);
$this
->assertResponse($access_forbidden, "<strong>User without {$this->optimizelyPermission} permission may not" . " access project settings page -> {$this->settingsPage} </strong>", 'Optimizely');
$this
->drupalGet($this->ajaxCallbackPage);
$this
->assertResponse($access_forbidden, "<strong>User without {$this->optimizelyPermission} permission may not" . " access AJAX callback URL -> {$this->ajaxCallbackPage} </strong>", 'Optimizely');
$this
->drupalLogout();
}