You are here

function TaxonomyEdgeTreeTestCase::testParents in Taxonomy Edge 7

Same name and namespace in other branches
  1. 8 tests/tree.test \TaxonomyEdgeTreeTestCase::testParents()
  2. 6 tests/tree.test \TaxonomyEdgeTreeTestCase::testParents()

File

tests/tree.test, line 291
Web test cases for Taxonomy Edge.

Class

TaxonomyEdgeTreeTestCase
@file Web test cases for Taxonomy Edge.

Code

function testParents() {
  $terms =& $this->terms;
  $parents = taxonomy_edge_get_parents($terms['test5']->tid);
  $expect = array(
    1 => $terms['test4']->tid,
    2 => $terms['test1']->tid,
  );
  $match = $expect == $parents;
  $message = "Get parents for 'test5'" . ($match ? "" : "\n<pre>Assumed:\n" . print_r($expect, TRUE) . "\nGot:\n" . print_r($parents, TRUE));
  $this
    ->assertTRUE($match, $message);
  $tids = taxonomy_edge_get_top_tids($terms['test3']->tid);
  $expect = array(
    $terms['test1']->tid => $terms['test1']->tid,
  );
  $match = $expect == $tids;
  $message = "Get top tids for 'test5'" . ($match ? "" : "\n<pre>Assumed:\n" . print_r($expect, TRUE) . "\nGot:\n" . print_r($tids, TRUE));
  $this
    ->assertTRUE($match, $message);
  $tid = taxonomy_edge_get_top_tid($terms['test3']->tid);
  $expect = $terms['test1']->tid;
  $match = $expect == $tid;
  $message = "Get top tid for 'test3'" . ($match ? "" : "\n<pre>Assumed:\n" . print_r($expect, TRUE) . "\nGot:\n" . print_r($tids, TRUE));
  $this
    ->assertTRUE($match, $message);
}