You are here

public function BiblioKeywordWebTestCase::testBiblioUpdateKeywords in Bibliography Module 7

File

tests/BiblioKeywordWebTestCase.test, line 98

Class

BiblioKeywordWebTestCase
Biblio keyword web tests.

Code

public function testBiblioUpdateKeywords() {
  $term1 = $this
    ->createKeyword();
  $node = $this
    ->createNode();
  $node->biblio_keywords = array(
    $term1['word'],
  );
  $old_vid = $node->vid;
  $node->biblio_keywords[0] .= 'xxx';
  $node->revision = TRUE;
  node_save($node);
  $node = node_load($node->nid, NULL, TRUE);
  foreach ($node->biblio_keywords as $kid => $value) {
    $this
      ->assertEqual($value, $term1['word'] . 'xxx', 'Loaded updated keyword');

    // Add the new kids to the global array so we can delete them on teardown.
    $this->kids[] = $kid;
  }
  $node = node_load($node->nid, $old_vid, TRUE);
  foreach ($node->biblio_keywords as $kid => $value) {
    $this
      ->assertEqual($value, 'biblio_keywords', 'Loaded previous revision prior to update');

    // Add the new kids to the global array so we can delete them on teardown.
    $this->kids[] = $kid;
  }
  biblio_delete_keywords($node);
  $node = node_load($node->nid, NULL, TRUE);
  $this
    ->assertFalse(count($node->biblio_keywords), "Loaded node which no longer has any keywords");
}