You are here

private function BookAccessTestCase::caseChildDefaultsDoNotAffectParentBook in Book access 7.2

1 call to BookAccessTestCase::caseChildDefaultsDoNotAffectParentBook()
BookAccessTestCase::testCases in ./book_access_test_case.test

File

./book_access_test_case.test, line 393

Class

BookAccessTestCase

Code

private function caseChildDefaultsDoNotAffectParentBook() {
  $originalDefaults = variable_get("book_access_default_author_access");
  $userBooks = array();
  $userNodes = array();
  $this
    ->createBook($userBooks, $userNodes, $this->author);
  $this
    ->assertTrue(BookAccess::checkGrant($userBooks[0]->nid, 'grant_delete', $this->author), t('Sanity checking that parent book does have grant_delete'));

  // now change our defaults for creating a child node
  $newDefaults = array(
    'grant_view',
  );
  variable_set("book_access_default_author_access", $newDefaults);
  $newNode = new stdClass();
  $newNode->title = "child node";
  $newNode->body = "dummy content";
  $newNode->uid = $this->author->uid;
  $newNode->type = 'page';
  $newNode->stats = 1;
  $newNode->book['bid'] = $userBooks[0]->nid;
  node_save($newNode);
  $this
    ->assertTrue(BookAccess::checkGrant($userBooks[0]->nid, 'grant_delete', $this->author), t('Parent must remain un-changed in its permissions'));
  variable_set("book_access_default_author_access", $originalDefaults);
}