Created
March 26, 2012 00:59
-
-
Save underhilllabs/2201975 to your computer and use it in GitHub Desktop.
book.test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Tests that link to parent node not shown if user doesn't have access to parent. | |
*/ | |
function testParentAccess() { | |
// Create new book. | |
$nodes = $this->createBook(); | |
$book = $this->book; | |
// this $parent_nid is correct! (node: 2) | |
$parent_nid = $nodes[0]->nid; | |
// Login as web user and view printer-friendly version. | |
$this->drupalLogin($this->web_user); | |
$this->drupalGet('node/' . $this->book->nid); | |
// Check that parent link is available. | |
$this->checkBookNode($nodes[1], NULL, $nodes[0], $nodes[0], $nodes[2], array($book, $nodes[0])); | |
$this->drupalLogout(); | |
// Login as admin and unpublish book parent node. | |
$this->drupalLogin($this->admin_user); | |
// 'status' => FALSE unpublishes, 0 does not! | |
$this->drupalPost('node/' . $parent_nid . '/edit', array('status' => FALSE), 'Save'); | |
$this->drupalGet('node/' . $parent_nid . '/edit'); | |
$this->drupalLogout(); | |
// Login as web_user and check if link to unpublished parent node shows. | |
$this->drupalLogin($this->web_user); | |
$this->drupalGet('node/' . $nodes[1]->nid); | |
$this->assertNoLinkByHref('node/' . $parent_nid, t('Anonymous user is not shown link to unpublished parent.')); | |
// Click the "up" link and see the 403 page | |
$this->drupalGet('node/' . $nodes[1]->nid); | |
$this->clickLink('up'); | |
// | |
// This Test is Failing | |
// | |
$this->assertText('Access Denied', t('Web user not shown unpublished node.')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment