You are here

private function BookAccessTestCase::caseAuthorDefaultsPropagateToUpdatedNode in Book access 7.2

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

File

./book_access_test_case.test, line 424

Class

BookAccessTestCase

Code

private function caseAuthorDefaultsPropagateToUpdatedNode() {
  $newNode = new stdClass();
  $newNode->title = "un-booked node";
  $newNode->body = "dummy content";
  $newNode->uid = $this->author->uid;
  $newNode->type = 'page';
  $newNode->stats = 1;
  node_save($newNode);
  $query = db_select('book_access_author', 'book_access_author')
    ->condition('nid', $newNode, '=')
    ->condition('uid', $this->author->uid)
    ->fields('book_access_author');
  $resultSet = $query
    ->execute();
  $this
    ->assertEqual(0, $resultSet
    ->rowCount(), t('There should not be any entry in the book_access_author table'));

  // upgrade the node to a book
  $newNode->book['bid'] = 'new';
  node_save($newNode);
  $query = db_select('book_access_author', 'book_access_author')
    ->condition('nid', $newNode->book['bid'], '=')
    ->condition('uid', $this->author->uid, '=')
    ->fields('book_access_author');
  $resultSet = $query
    ->execute();
  $this
    ->assertEqual(1, $resultSet
    ->rowCount(), t('There should be an entry in the book_access_author table post-update'));
}