protected function BookAccessTestCase::createBook in Book access 7.2
9 calls to BookAccessTestCase::createBook()
- BookAccessTestCase::caseAdministerOwnBookAccess in ./
book_access_test_case.test - BookAccessTestCase::caseAuthorDefaultsPropagateToNewNode in ./
book_access_test_case.test - BookAccessTestCase::caseAuthorVsAdminDefaults in ./
book_access_test_case.test - BookAccessTestCase::caseChildDefaultsDoNotAffectParentBook in ./
book_access_test_case.test - BookAccessTestCase::caseDeletingBookDoesNotDeleteGrants in ./
book_access_test_case.test
File
- ./
book_access_test_case.test, line 51
Class
Code
protected function createBook(&$books, &$nodes, $author, $pages = 2) {
static $mlid = 1;
static $counter = 1;
$firstNode = NULL;
while ($pages--) {
$node = new stdClass();
$node->title = "top-level book page #{$counter}";
$node->body = "dummy content {$counter}";
$node->uid = $author->uid;
$node->type = 'page';
$node->status = 1;
if ($firstNode === NULL) {
$node->book['bid'] = 'new';
}
else {
$node->book['bid'] = $firstNode;
}
node_save($node);
if ($firstNode === NULL) {
$books[] = $node;
$firstNode = $node->nid;
}
$nodes[] = $node;
++$counter;
}
}