public function TaxonomyAccessConfigTest::testSetUpCheck in Taxonomy Access Control 7
Tests the initial state of the test environment.
Verifies that:
- Access to all nodes is denied for anonymous users.
- The main admin page provides the correct configuration links.
File
- ./
taxonomy_access.test, line 521 - Automated tests for the Taxonomy Access Control module.
Class
- TaxonomyAccessConfigTest
- Tests the module's configuration forms.
Code
public function testSetUpCheck() {
// Visit all nodes as anonymous and verify that access is denied.
foreach ($this->articles as $key => $article) {
$this
->drupalGet('node/' . $article->nid);
$this
->assertResponse(403, t("Access to %name article (nid %nid) is denied.", array(
'%name' => $key,
'%nid' => $article->nid,
)));
}
foreach ($this->pages as $key => $page) {
$this
->drupalGet('node/' . $page->nid);
$this
->assertResponse(403, t("Access to %name page (nid %nid) is denied.", array(
'%name' => $key,
'%nid' => $page->nid,
)));
}
// Log in as the regular_user.
$this
->drupalLogin($this->users['regular_user']);
// Visit all nodes and verify that access is denied.
foreach ($this->articles as $key => $article) {
$this
->drupalGet('node/' . $article->nid);
$this
->assertResponse(403, t("Access to %name article (nid %nid) is denied.", array(
'%name' => $key,
'%nid' => $article->nid,
)));
}
foreach ($this->pages as $key => $page) {
$this
->drupalGet('node/' . $page->nid);
$this
->assertResponse(403, t("Access to %name page (nid %nid) is denied.", array(
'%name' => $key,
'%nid' => $page->nid,
)));
}
// Log in as the administrator.
$this
->drupalLogin($this->users['site_admin']);
// Confirm that only edit links are available for anon. and auth.
$this
->checkRoleConfig(array(
DRUPAL_ANONYMOUS_RID => TRUE,
DRUPAL_AUTHENTICATED_RID => TRUE,
));
}