From f5842a197ab9acbea7742f3a6466d6fa4d916b5c Mon Sep 17 00:00:00 2001 From: Paul Bearne Date: Mon, 13 Nov 2023 17:55:52 -0500 Subject: [PATCH] added test for wp_find_hierarchy_loop --- .../tests/functions/wpFindHierarchyLoop.php | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/phpunit/tests/functions/wpFindHierarchyLoop.php diff --git a/tests/phpunit/tests/functions/wpFindHierarchyLoop.php b/tests/phpunit/tests/functions/wpFindHierarchyLoop.php new file mode 100644 index 0000000000000..12621844b4609 --- /dev/null +++ b/tests/phpunit/tests/functions/wpFindHierarchyLoop.php @@ -0,0 +1,46 @@ + true, + 2 => true, + ); + $this->assertSame( $expected, $result ); + } + + /** + * @ticket 59901 + */ + public function test_wp_find_hierarchy_loop_null_parent() { + $result = wp_find_hierarchy_loop( + static function ( $id ) { + return 1; + }, + 1, + null + ); + $expected = array( + 1 => true, + ); + $this->assertSame( $expected, $result ); + } +}