From 33368fc8c5ed24142f7a4aff84d266b001906e5a Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 13 Aug 2022 22:44:10 +0000 Subject: [PATCH] Taxonomy: Add a test file that was missed in [53893]. See #56215 git-svn-id: https://develop.svn.wordpress.org/trunk@53894 602fd350-edb4-49c9-b593-d223f7449a82 --- .../tests/term/isTermPubliclyViewable.php | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 tests/phpunit/tests/term/isTermPubliclyViewable.php diff --git a/tests/phpunit/tests/term/isTermPubliclyViewable.php b/tests/phpunit/tests/term/isTermPubliclyViewable.php new file mode 100644 index 0000000000..a174b8eec5 --- /dev/null +++ b/tests/phpunit/tests/term/isTermPubliclyViewable.php @@ -0,0 +1,56 @@ +assertFalse( is_term_publicly_viewable( 123 ) ); + } + + /** + * Unit tests for is_term_publicly_viewable(). + * + * @dataProvider data_is_term_publicly_viewable + * @ticket 56215 + * + * @param string $taxonomy The taxonomy name. + * @param bool $expected The expected result of the function call. + */ + public function test_is_term_publicly_viewable( $taxonomy, $expected ) { + $term_id = $this->factory()->term->create( + array( + 'taxonomy' => $taxonomy, + ) + ); + + $this->assertSame( $expected, is_term_publicly_viewable( $term_id ) ); + } + + /** + * Data provider for test_is_term_publicly_viewable(). + * + * return array[] { + * @type string $taxonomy The taxonomy. + * @type bool $expected The expected result of the function call. + * } + */ + public function data_is_term_publicly_viewable() { + return array( + array( 'category', true ), + array( 'post_tag', true ), + array( 'post_format', true ), + + array( 'nav_menu', false ), + array( 'wp_theme', false ), + array( 'wp_template_part_area', false ), + ); + } +}