From 324b2799b391fc6dc1e49502a72d2041d6de4a15 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 6 Feb 2014 03:39:22 +0000 Subject: [PATCH] Add the unit test from #25711. The patch was unnecessary due to [27102], but the test is useful. Props dd32. See #25711. git-svn-id: https://develop.svn.wordpress.org/trunk@27103 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/term/cache.php | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/phpunit/tests/term/cache.php diff --git a/tests/phpunit/tests/term/cache.php b/tests/phpunit/tests/term/cache.php new file mode 100644 index 0000000000..d62b53bc4b --- /dev/null +++ b/tests/phpunit/tests/term/cache.php @@ -0,0 +1,32 @@ + Child + $term_id1 = $this->factory->category->create(); + $term_id1_child = $this->factory->category->create( array( 'parent' => $term_id1 ) ); + $hierarchy = _get_term_hierarchy( 'category' ); + + $this->assertEquals( array( $term_id1 => array( $term_id1_child ) ), $hierarchy ); + + // Add another Parent => Child + $term_id2 = $this->factory->category->create(); + $term_id2_child = $this->factory->category->create( array( 'parent' => $term_id2 ) ); + $hierarchy = _get_term_hierarchy( 'category' ); + + $this->assertEquals( array( $term_id1 => array( $term_id1_child ), $term_id2 => array( $term_id2_child ) ), $hierarchy ); + + } +} \ No newline at end of file