function BiblioKeywordUnitTest::testBiblioUpdateKeywords in Bibliography Module 7.2
Same name and namespace in other branches
- 6.2 tests/keyword.test \BiblioKeywordUnitTest::testBiblioUpdateKeywords()
File
- tests/
keyword.test, line 86 - Tests for keyword functions.
Class
- BiblioKeywordUnitTest
- Unit tests for keyword functions.
Code
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');
$this->kids[] = $kid;
// add the new kids to the global array so we can delete them on tear down.
}
$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');
$this->kids[] = $kid;
// add the new kids to the global array so we can delete them on tear down.
}
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");
}