diff --git a/tests/phpunit/tests/general/bloginfo.php b/tests/phpunit/tests/general/bloginfo.php new file mode 100644 index 0000000000000..4edfe27b54d2f --- /dev/null +++ b/tests/phpunit/tests/general/bloginfo.php @@ -0,0 +1,58 @@ +expectOutputString( 'Test Blog' ); + bloginfo(); + } + + /** + * Tests that bloginfo( 'url' ) displays the home URL. + * + * @ticket 65819 + */ + public function test_bloginfo_url() { + update_option( 'home', 'http://example.org' ); + + $this->expectOutputString( 'http://example.org' ); + bloginfo( 'url' ); + } + + /** + * 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' ); + } +}