You are here

function TaxonomyEdgeTreeUnitTestCase::testParents in Taxonomy Edge 7

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

File

tests/unit.test, line 20

Class

TaxonomyEdgeTreeUnitTestCase
@file

Code

function testParents() {
  $parents = array(
    0,
    1,
    2,
  );
  $result = _taxonomy_edge_unify_parents($parents);
  $expect = array(
    0,
    1,
    2,
  );
  $match = $expect == $result;
  $message = "Unify parents" . ($match ? "" : "\n<pre>Assumed:\n" . print_r($expect, TRUE) . "\nGot:\n" . print_r($result, TRUE));
  $this
    ->assertTRUE($match, $message);
  $parents = array(
    0,
    array(
      1,
      2,
    ),
  );
  $result = _taxonomy_edge_unify_parents($parents);
  $expect = array(
    0,
    1,
    2,
  );
  $match = $expect == $result;
  $message = "Unify parents" . ($match ? "" : "\n<pre>Assumed:\n" . print_r($expect, TRUE) . "\nGot:\n" . print_r($result, TRUE));
  $this
    ->assertTRUE($match, $message);
}