Changeset 42343 for trunk/tests/phpunit/tests/user/wpDeleteUser.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/user/wpDeleteUser.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/wpDeleteUser.php
r40564 r42343 16 16 17 17 $user_id = self::factory()->user->create( array( 'role' => 'subscriber' ) ); 18 $blogs = get_blogs_of_user( $user_id );18 $blogs = get_blogs_of_user( $user_id ); 19 19 $this->assertEquals( array( 1 ), array_keys( $blogs ) ); 20 20 … … 56 56 function test_delete_user() { 57 57 $user_id = self::factory()->user->create( array( 'role' => 'author' ) ); 58 $user = new WP_User( $user_id );58 $user = new WP_User( $user_id ); 59 59 60 60 $post = array( 61 'post_author' => $user_id,62 'post_status' => 'publish',61 'post_author' => $user_id, 62 'post_status' => 'publish', 63 63 'post_content' => 'Post content', 64 'post_title' => 'Post Title',65 'post_type' => 'post',64 'post_title' => 'Post Title', 65 'post_type' => 'post', 66 66 ); 67 67 68 68 // insert a post and make sure the ID is ok 69 $post_id = wp_insert_post( $post);70 $this->assertTrue( is_numeric($post_id));71 $this->assertTrue( $post_id > 0);69 $post_id = wp_insert_post( $post ); 70 $this->assertTrue( is_numeric( $post_id ) ); 71 $this->assertTrue( $post_id > 0 ); 72 72 73 73 $post = get_post( $post_id ); … … 75 75 76 76 $post = array( 77 'post_author' => $user_id,78 'post_status' => 'publish',77 'post_author' => $user_id, 78 'post_status' => 'publish', 79 79 'post_content' => 'Post content', 80 'post_title' => 'Post Title',81 'post_type' => 'nav_menu_item',80 'post_title' => 'Post Title', 81 'post_type' => 'nav_menu_item', 82 82 ); 83 83 84 84 // insert a post and make sure the ID is ok 85 $nav_id = wp_insert_post( $post);86 $this->assertTrue( is_numeric($nav_id));87 $this->assertTrue( $nav_id > 0);85 $nav_id = wp_insert_post( $post ); 86 $this->assertTrue( is_numeric( $nav_id ) ); 87 $this->assertTrue( $nav_id > 0 ); 88 88 89 89 $post = get_post( $nav_id ); … … 92 92 wp_delete_user( $user_id ); 93 93 $user = new WP_User( $user_id ); 94 if ( is_multisite() ) 94 if ( is_multisite() ) { 95 95 $this->assertTrue( $user->exists() ); 96 else96 } else { 97 97 $this->assertFalse( $user->exists() ); 98 } 98 99 99 100 $this->assertNotNull( get_post( $post_id ) ); … … 112 113 */ 113 114 function test_wp_delete_user_reassignment_clears_post_caches() { 114 $user_id = self::factory()->user->create();115 $reassign = self::factory()->user->create();116 $post_id = self::factory()->post->create( array( 'post_author' => $user_id ) );115 $user_id = self::factory()->user->create(); 116 $reassign = self::factory()->user->create(); 117 $post_id = self::factory()->post->create( array( 'post_author' => $user_id ) ); 117 118 118 119 get_post( $post_id ); // Ensure this post is in the cache.
Note: See TracChangeset
for help on using the changeset viewer.