Skip to content

Commit f668959

Browse files
committed
Tests: Log out after creating privileged class fixtures.
Restore the logged-out user before the test harness saves the sanitization filters for subsequent tests. Developed in: #16185 Props mayankmajeji. See #66755. git-svn-id: https://develop.svn.wordpress.org/trunk@65746 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 9669668 commit f668959

5 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎tests/phpunit/tests/ajax/wpAjaxHeartbeat.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
3939

4040
self::$post_id = $factory->post->create( array( 'post_status' => 'draft' ) );
4141
self::$post = get_post( self::$post_id );
42+
wp_set_current_user( 0 );
4243
}
4344

4445
/**

‎tests/phpunit/tests/post/wpGetAutoSave.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
3737

3838
wp_set_current_user( self::$admin_id );
3939
self::$post_id = $factory->post->create( array( 'post_status' => 'publish' ) );
40+
wp_set_current_user( 0 );
4041
}
4142

4243
/**

‎tests/phpunit/tests/rest-api/rest-autosaves-controller.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
108108
'post_author' => self::$editor_id,
109109
)
110110
);
111+
wp_set_current_user( 0 );
111112
}
112113

113114
public static function wpTearDownAfterClass() {

‎tests/phpunit/tests/rest-api/wpRestTemplateAutosavesController.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
131131
);
132132
wp_set_post_terms( self::$template_part_post->ID, self::TEST_THEME, 'wp_theme' );
133133
wp_set_post_terms( self::$template_part_post->ID, WP_TEMPLATE_PART_AREA_HEADER, 'wp_template_part_area' );
134+
wp_set_current_user( 0 );
134135
}
135136

136137
/**

‎tests/phpunit/tests/rest-api/wpRestTemplateRevisionsController.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
222222
);
223223
wp_set_post_terms( self::$template_part_post_2->ID, self::TEST_THEME, 'wp_theme' );
224224
wp_set_post_terms( self::$template_part_post_2->ID, WP_TEMPLATE_PART_AREA_HEADER, 'wp_template_part_area' );
225+
wp_set_current_user( 0 );
225226
}
226227

227228
/**

0 commit comments

Comments
 (0)