public function IntegrationTest::testOverviewPermissions in Facets 8
Tests permissions.
File
- tests/
src/ Functional/ IntegrationTest.php, line 42
Class
- IntegrationTest
- Tests the overall functionality of the Facets admin UI.
Namespace
Drupal\Tests\facets\FunctionalCode
public function testOverviewPermissions() {
$facet_overview = '/admin/config/search/facets';
// Login with a user that is not authorized to administer facets and test
// that we're correctly getting a 403 HTTP response code.
$this
->drupalLogin($this->unauthorizedUser);
$this
->drupalGet($facet_overview);
$this
->assertSession()
->statusCodeEquals(403);
$this
->assertSession()
->pageTextContains('You are not authorized to access this page');
// Login with a user that has the correct permissions and test for the
// correct HTTP response code.
$this
->drupalLogin($this->adminUser);
$this
->drupalGet($facet_overview);
$this
->assertSession()
->statusCodeEquals(200);
}