From be413a98e90b9cf4c62d971d8eb0f36e338a8a36 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 11 Jun 2022 15:34:35 +0000 Subject: [PATCH] Tests: Re-initialize `WP_Rewrite` before running `wp_list_authors()` tests. This ensures that the expected results use the default permalink structure, not affected by other tests. Follow-up to [27550], [27684], [53487]. See #55652. git-svn-id: https://develop.svn.wordpress.org/trunk@53488 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/user/wpListAuthors.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/phpunit/tests/user/wpListAuthors.php b/tests/phpunit/tests/user/wpListAuthors.php index 78fb2fd33c..ebf557157a 100644 --- a/tests/phpunit/tests/user/wpListAuthors.php +++ b/tests/phpunit/tests/user/wpListAuthors.php @@ -27,6 +27,8 @@ class Tests_User_wpListAuthors extends WP_UnitTestCase { * 'html' => true, */ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { + global $wp_rewrite; + self::$user_ids[] = $factory->user->create( array( 'user_login' => 'zack', @@ -61,6 +63,12 @@ class Tests_User_wpListAuthors extends WP_UnitTestCase { ) ); + /* + * Re-initialize WP_Rewrite, so that get_author_posts_url() uses + * the default permalink structure, not affected by other tests. + */ + $wp_rewrite->init(); + $count = 0; foreach ( self::$user_ids as $userid ) { $count = $count + 1;