You are here

public function TermstatusAccessTestCase::testGuestAccessToUnpublishedTerms in Taxonomy Term Status 7

Test that access to unpublished terms is denied for guest users.

File

./termstatus.test, line 277
Tests for termstatus.module

Class

TermstatusAccessTestCase
Tests the access control features.

Code

public function testGuestAccessToUnpublishedTerms() {
  $this
    ->drupalGet('taxonomy/term/' . $this->publishedTerm->tid);
  $this
    ->assertResponse(200, 'Anonymous user can access published term');
  $this
    ->drupalGet('taxonomy/term/' . $this->unpublishedTerm->tid);
  $this
    ->assertResponse(404, 'Anonymous user cannot access unpublished term');
  $this
    ->drupalGet('termstatus-test-term-list/' . $this->vocabulary->vid);
  $this
    ->assertLinkByHref('taxonomy/term/' . $this->publishedTerm->tid, 0, 'Published term is in term listing for anonymous user');
  $this
    ->assertNoLinkByHref('taxonomy/term/' . $this->unpublishedTerm->tid, 0, 'Unpublished term is not in term listing for anonymous user');
}