function TaxonomyEdgeTreeTestCase::testTerm in Taxonomy Edge 6
Same name and namespace in other branches
- 8 tests/tree.test \TaxonomyEdgeTreeTestCase::testTerm()
- 7 tests/tree.test \TaxonomyEdgeTreeTestCase::testTerm()
File
- tests/
tree.test, line 55
Class
- TaxonomyEdgeTreeTestCase
- @file
Code
function testTerm() {
$terms =& $this->terms;
$term = $terms['sub3'];
unset($term['tid']);
$term['name'] = 'sub4';
$term['weight']--;
taxonomy_save_term($term);
$tree = $this
->formatTree();
$expect = "test1\n- test2\n-- test3\n- test4\n-- test5\nsub1\nsub2\nsub4\nsub3\n";
$match = $tree == $expect;
$message = "Add 'sub4' to tree" . ($match ? "" : "\n<pre>Assumed:\n{$expect}\nGot:\n{$tree}");
$this
->assertTRUE($match, $message);
taxonomy_del_term($terms['test1']['tid']);
$tree = $this
->formatTree();
$expect = "sub1\nsub2\nsub4\nsub3\n";
$match = $tree == $expect;
$message = "Remove 'sub1' from tree" . ($match ? "" : "\n<pre>Assumed:\n{$expect}\nGot:\n{$tree}");
$this
->assertTRUE($match, $message);
}