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
This commit is contained in:
Sergey Biryukov 2022-06-11 15:34:35 +00:00
parent 3308ae7e4f
commit be413a98e9

View File

@ -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;