From 3169d48cbf8b918cdb957f3a26418d3965362c60 Mon Sep 17 00:00:00 2001 From: Muhibul Haque Date: Sun, 1 Nov 2026 16:39:17 +0600 Subject: [PATCH 1/3] Tests: Cover bloginfo(). See #65819. Props devmuhib009. --- tests/phpunit/tests/general/bloginfo.php | 76 ++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 tests/phpunit/tests/general/bloginfo.php diff --git a/tests/phpunit/tests/general/bloginfo.php b/tests/phpunit/tests/general/bloginfo.php new file mode 100644 index 0000000000000..c52a8addfd60b --- /dev/null +++ b/tests/phpunit/tests/general/bloginfo.php @@ -0,0 +1,76 @@ +expectOutputString( 'Test Blog' ); + bloginfo(); + } + + /** + * Tests that bloginfo( 'name' ) displays the site name. + * + * @ticket 65819 + */ + public function test_bloginfo_name() { + $this->expectOutputString( 'Test Blog' ); + bloginfo( 'name' ); + } + + /** + * Tests that bloginfo( 'url' ) displays the home URL. + * + * @ticket 65819 + */ + public function test_bloginfo_url() { + $this->expectOutputString( 'http://example.org' ); + bloginfo( 'url' ); + } + + /** + * Tests that bloginfo( 'description' ) displays the site description. + * + * @ticket 65819 + */ + public function test_bloginfo_description() { + update_option( 'blogdescription', 'Just another WordPress site' ); + + $this->expectOutputString( 'Just another WordPress site' ); + bloginfo( 'description' ); + } + + /** + * Tests that bloginfo() displays filtered value when the bloginfo filter is used. + * + * @ticket 65819 + */ + public function test_bloginfo_filter() { + add_filter( + 'bloginfo', + static function ( $output, $show ) { + if ( 'name' === $show ) { + return 'Filtered Site Title'; + } + return $output; + }, + 10, + 2 + ); + + $this->expectOutputString( 'Filtered Site Title' ); + bloginfo( 'name' ); + } +} From e8aacf709df50f87867eec623ac9082ae547f533 Mon Sep 17 00:00:00 2001 From: Muhibul Haque Date: Mon, 2 Nov 2026 15:19:11 +0600 Subject: [PATCH 2/3] Tests: Set explicit site title and home URL fixtures in bloginfo() tests. --- tests/phpunit/tests/general/bloginfo.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/phpunit/tests/general/bloginfo.php b/tests/phpunit/tests/general/bloginfo.php index c52a8addfd60b..9feba6c4af178 100644 --- a/tests/phpunit/tests/general/bloginfo.php +++ b/tests/phpunit/tests/general/bloginfo.php @@ -16,6 +16,8 @@ class Tests_General_Bloginfo extends WP_UnitTestCase { * @ticket 65819 */ public function test_bloginfo_default_displays_name() { + update_option( 'blogname', 'Test Blog' ); + $this->expectOutputString( 'Test Blog' ); bloginfo(); } @@ -26,6 +28,8 @@ public function test_bloginfo_default_displays_name() { * @ticket 65819 */ public function test_bloginfo_name() { + update_option( 'blogname', 'Test Blog' ); + $this->expectOutputString( 'Test Blog' ); bloginfo( 'name' ); } @@ -36,6 +40,8 @@ public function test_bloginfo_name() { * @ticket 65819 */ public function test_bloginfo_url() { + update_option( 'home', 'http://example.org' ); + $this->expectOutputString( 'http://example.org' ); bloginfo( 'url' ); } From 99fe4b2698e4dad520c10dd98e596b97db2cb2be Mon Sep 17 00:00:00 2001 From: Muhibul Haque Date: Tue, 3 Nov 2026 10:57:34 +0600 Subject: [PATCH 3/3] Tests: Remove redundant bloginfo test methods. See #65819. Props devmuhib009. --- tests/phpunit/tests/general/bloginfo.php | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/tests/phpunit/tests/general/bloginfo.php b/tests/phpunit/tests/general/bloginfo.php index 9feba6c4af178..4edfe27b54d2f 100644 --- a/tests/phpunit/tests/general/bloginfo.php +++ b/tests/phpunit/tests/general/bloginfo.php @@ -22,18 +22,6 @@ public function test_bloginfo_default_displays_name() { bloginfo(); } - /** - * Tests that bloginfo( 'name' ) displays the site name. - * - * @ticket 65819 - */ - public function test_bloginfo_name() { - update_option( 'blogname', 'Test Blog' ); - - $this->expectOutputString( 'Test Blog' ); - bloginfo( 'name' ); - } - /** * Tests that bloginfo( 'url' ) displays the home URL. * @@ -46,18 +34,6 @@ public function test_bloginfo_url() { bloginfo( 'url' ); } - /** - * Tests that bloginfo( 'description' ) displays the site description. - * - * @ticket 65819 - */ - public function test_bloginfo_description() { - update_option( 'blogdescription', 'Just another WordPress site' ); - - $this->expectOutputString( 'Just another WordPress site' ); - bloginfo( 'description' ); - } - /** * Tests that bloginfo() displays filtered value when the bloginfo filter is used. *