public function TermstatusAccessTestCase::testVisibilityOfMenuLinksForGuest in Taxonomy Term Status 7
Test visibility of unpublished terms in menu.
File
- ./
termstatus.test, line 377 - Tests for termstatus.module
Class
- TermstatusAccessTestCase
- Tests the access control features.
Code
public function testVisibilityOfMenuLinksForGuest() {
$published_menu_link = array(
'link_path' => 'taxonomy/term/' . $this->publishedTerm->tid,
'link_title' => $this->publishedTerm->name,
'menu_name' => 'main-menu',
);
$unpublished_menu_link = array(
'link_path' => 'taxonomy/term/' . $this->unpublishedTerm->tid,
'link_title' => $this->unpublishedTerm->name,
'menu_name' => 'main-menu',
);
menu_link_save($published_menu_link);
menu_link_save($unpublished_menu_link);
$this
->drupalGet('node');
$this
->assertLinkByHref('taxonomy/term/' . $this->publishedTerm->tid, 0, 'Menu link for published term is visible');
$this
->assertNoLinkByHref('taxonomy/term/' . $this->unpublishedTerm->tid, 0, 'Menu link for unpublished term is not visible');
}