Tests: Don't create unused users in Tests_Ajax_DeleteComment.

Fixes #36616.

git-svn-id: https://develop.svn.wordpress.org/trunk@37404 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2016-05-09 19:16:35 +00:00
parent c298cefcd4
commit 41cfd4d826

View File

@ -21,28 +21,20 @@ class Tests_Ajax_DeleteComment extends WP_Ajax_UnitTestCase {
*/ */
protected static $comments = array(); protected static $comments = array();
protected static $admin_id = 0; /**
protected static $editor_id = 0; * ID of a post.
protected static $post; * @var int
*/
protected static $post_id; protected static $post_id;
protected static $user_ids = array();
public static function wpSetUpBeforeClass( $factory ) { public static function wpSetUpBeforeClass( $factory ) {
self::$user_ids[] = self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) );
self::$user_ids[] = self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) );
self::$post_id = $factory->post->create(); self::$post_id = $factory->post->create();
self::$post = get_post( self::$post_id );
$comment_ids = $factory->comment->create_post_comments( self::$post_id, 8 ); $comment_ids = $factory->comment->create_post_comments( self::$post_id, 8 );
self::$comments = array_map( 'get_comment', $comment_ids ); self::$comments = array_map( 'get_comment', $comment_ids );
} }
public static function wpTearDownAfterClass() { public static function wpTearDownAfterClass() {
foreach ( self::$user_ids as $user_id ) {
self::delete_user( $user_id );
}
wp_delete_post( self::$post_id, true ); wp_delete_post( self::$post_id, true );
foreach ( self::$comments as $c ) { foreach ( self::$comments as $c ) {