Changeset 35224
- Timestamp:
- 10/16/2015 07:51:32 PM (9 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/auth.php
r35186 r35224 28 28 29 29 public static function wpTearDownAfterClass() { 30 if ( is_multisite() ) { 31 wpmu_delete_user( self::$user_id ); 32 } else { 33 wp_delete_user( self::$user_id ); 34 } 30 self::delete_user( self::$user_id ); 35 31 } 36 32 -
trunk/tests/phpunit/tests/comment.php
r35186 r35224 18 18 wp_delete_post( self::$post_id ); 19 19 20 if ( is_multisite() ) { 21 wpmu_delete_user( self::$user_id ); 22 } else { 23 wp_delete_user( self::$user_id ); 24 } 20 self::delete_user( self::$user_id ); 25 21 } 26 22 -
trunk/tests/phpunit/tests/feed/rss2.php
r35186 r35224 10 10 */ 11 11 class Tests_Feed_RSS2 extends WP_UnitTestCase { 12 static $user ;12 static $user_id; 13 13 static $posts; 14 14 15 15 public static function wpSetUpBeforeClass( $factory ) { 16 self::$user = $factory->user->create();16 self::$user_id = $factory->user->create(); 17 17 self::$posts = $factory->post->create_many( 5, array( 18 'post_author' => self::$user ,18 'post_author' => self::$user_id, 19 19 ) ); 20 20 } 21 21 22 22 public static function wpTearDownAfterClass() { 23 if ( is_multisite() ) { 24 wpmu_delete_user( self::$user ); 25 } else { 26 wp_delete_user( self::$user ); 27 } 23 self::delete_user( self::$user_id ); 28 24 29 25 foreach ( self::$posts as $post ) { -
trunk/tests/phpunit/tests/post.php
r35186 r35224 26 26 $ids = array( self::$editor_id, self::$grammarian_id ); 27 27 foreach ( $ids as $id ) { 28 if ( is_multisite() ) { 29 wpmu_delete_user( $id ); 30 } else { 31 wp_delete_user( $id ); 32 } 28 self::delete_user( $id ); 33 29 } 34 30 } -
trunk/tests/phpunit/tests/post/revisions.php
r35193 r35224 19 19 $ids = array( self::$admin_user_id, self::$editor_user_id, self::$author_user_id ); 20 20 foreach ( $ids as $id ) { 21 if ( is_multisite() ) { 22 wpmu_delete_user( $id ); 23 } else { 24 wp_delete_user( $id ); 25 } 21 self::delete_user( $id ); 26 22 } 27 23 } -
trunk/tests/phpunit/tests/query/postStatus.php
r35186 r35224 5 5 */ 6 6 class Tests_Query_PostStatus extends WP_UnitTestCase { 7 public static $editor_user ;8 public static $author_user ;7 public static $editor_user_id; 8 public static $author_user_id; 9 9 public static $editor_private_post; 10 10 public static $author_private_post; … … 13 13 14 14 public static function wpSetUpBeforeClass( $factory ) { 15 self::$editor_user = $factory->user->create( array( 'role' => 'editor' ) );16 self::$author_user = $factory->user->create( array( 'role' => 'author' ) );17 18 self::$editor_private_post = $factory->post->create( array( 'post_author' => self::$editor_user , 'post_status' => 'private' ) );19 self::$author_private_post = $factory->post->create( array( 'post_author' => self::$author_user , 'post_status' => 'private' ) );15 self::$editor_user_id = $factory->user->create( array( 'role' => 'editor' ) ); 16 self::$author_user_id = $factory->user->create( array( 'role' => 'author' ) ); 17 18 self::$editor_private_post = $factory->post->create( array( 'post_author' => self::$editor_user_id, 'post_status' => 'private' ) ); 19 self::$author_private_post = $factory->post->create( array( 'post_author' => self::$author_user_id, 'post_status' => 'private' ) ); 20 20 21 21 // Custom status with private=true. 22 22 register_post_status( 'privatefoo', array( 'private' => true ) ); 23 self::$editor_privatefoo_post = $factory->post->create( array( 'post_author' => self::$editor_user , 'post_status' => 'privatefoo' ) );24 self::$author_privatefoo_post = $factory->post->create( array( 'post_author' => self::$author_user , 'post_status' => 'privatefoo' ) );23 self::$editor_privatefoo_post = $factory->post->create( array( 'post_author' => self::$editor_user_id, 'post_status' => 'privatefoo' ) ); 24 self::$author_privatefoo_post = $factory->post->create( array( 'post_author' => self::$author_user_id, 'post_status' => 'privatefoo' ) ); 25 25 _unregister_post_status( 'privatefoo' ); 26 26 } 27 27 28 28 public static function wpTearDownAfterClass() { 29 if ( is_multisite() ) { 30 wpmu_delete_user( self::$editor_user ); 31 wpmu_delete_user( self::$author_user ); 32 } else { 33 wp_delete_user( self::$editor_user ); 34 wp_delete_user( self::$author_user ); 29 $ids = array( self::$editor_user_id, self::$author_user_id ); 30 foreach ( $ids as $id ) { 31 self::delete_user( $id ); 35 32 } 36 33 … … 87 84 88 85 public function test_private_should_be_included_only_for_current_user_if_perm_is_readable_and_user_cannot_read_others_posts() { 89 wp_set_current_user( self::$author_user );86 wp_set_current_user( self::$author_user_id ); 90 87 91 88 $q = new WP_Query( array( … … 102 99 103 100 public function test_private_should_be_included_for_all_users_if_perm_is_readable_and_user_can_read_others_posts() { 104 wp_set_current_user( self::$editor_user );101 wp_set_current_user( self::$editor_user_id ); 105 102 106 103 $q = new WP_Query( array( … … 118 115 119 116 public function test_private_should_be_included_only_for_current_user_if_perm_is_editable_and_user_cannot_read_others_posts() { 120 wp_set_current_user( self::$author_user );117 wp_set_current_user( self::$author_user_id ); 121 118 122 119 $q = new WP_Query( array( … … 133 130 134 131 public function test_private_should_be_included_for_all_users_if_perm_is_editable_and_user_can_read_others_posts() { 135 wp_set_current_user( self::$editor_user );132 wp_set_current_user( self::$editor_user_id ); 136 133 137 134 $q = new WP_Query( array( … … 183 180 184 181 public function test_private_statuses_should_be_included_when_current_user_can_read_private_posts() { 185 wp_set_current_user( self::$editor_user );182 wp_set_current_user( self::$editor_user_id ); 186 183 187 184 register_post_status( 'privatefoo', array( 'private' => true ) ); … … 196 193 197 194 public function test_private_statuses_should_not_be_included_when_current_user_cannot_read_private_posts() { 198 wp_set_current_user( self::$author_user );195 wp_set_current_user( self::$author_user_id ); 199 196 200 197 register_post_status( 'privatefoo', array( 'private' => true ) ); … … 227 224 register_post_type( 'foo_pt' ); 228 225 register_post_status( 'foo_ps', array( 'public' => false, 'protected' => true ) ); 229 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$editor_user ) );230 231 wp_set_current_user( self::$author_user );226 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$editor_user_id ) ); 227 228 wp_set_current_user( self::$author_user_id ); 232 229 233 230 $q = new WP_Query( array( … … 241 238 register_post_type( 'foo_pt' ); 242 239 register_post_status( 'foo_ps', array( 'public' => false, 'protected' => true ) ); 243 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user ) );244 245 wp_set_current_user( self::$editor_user );240 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user_id ) ); 241 242 wp_set_current_user( self::$editor_user_id ); 246 243 247 244 $q = new WP_Query( array( … … 255 252 register_post_type( 'foo_pt' ); 256 253 register_post_status( 'foo_ps', array( 'public' => false, 'private' => true ) ); 257 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$editor_user ) );258 259 wp_set_current_user( self::$author_user );254 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$editor_user_id ) ); 255 256 wp_set_current_user( self::$author_user_id ); 260 257 261 258 $q = new WP_Query( array( … … 269 266 register_post_type( 'foo_pt' ); 270 267 register_post_status( 'foo_ps', array( 'public' => false, 'private' => true ) ); 271 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user ) );272 273 wp_set_current_user( self::$editor_user );268 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user_id ) ); 269 270 wp_set_current_user( self::$editor_user_id ); 274 271 275 272 $q = new WP_Query( array( … … 283 280 register_post_type( 'foo_pt' ); 284 281 register_post_status( 'foo_ps', array( 'public' => false ) ); 285 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user ) );286 287 wp_set_current_user( self::$editor_user );282 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user_id ) ); 283 284 wp_set_current_user( self::$editor_user_id ); 288 285 289 286 $q = new WP_Query( array( -
trunk/tests/phpunit/tests/user.php
r35189 r35224 30 30 $ids = array( self::$test_id, self::$author_id ); 31 31 foreach ( $ids as $id ) { 32 if ( is_multisite() ) { 33 wpmu_delete_user( $id ); 34 } else { 35 wp_delete_user( $id ); 36 } 32 self::delete_user( $id ); 37 33 } 38 34 } … … 596 592 'user_email' => 'blackburn@battlefield4.com', 597 593 ) ); 598 594 599 595 if ( ! defined( 'WP_IMPORTING' ) ) { 600 596 $this->assertWPError( $return ); … … 653 649 654 650 function _illegal_user_logins() { 655 return array( 'testuser' ); 651 return array( 'testuser' ); 656 652 } 657 653 -
trunk/tests/phpunit/tests/user/countUserPosts.php
r35186 r35224 35 35 36 36 public static function wpTearDownAfterClass() { 37 if ( is_multisite() ) { 38 wpmu_delete_user( self::$user_id ); 39 } else { 40 wp_delete_user( self::$user_id ); 41 } 37 self::delete_user( self::$user_id ); 42 38 43 39 foreach ( self::$post_ids as $post_id ) { -
trunk/tests/phpunit/tests/user/listAuthors.php
r35186 r35224 43 43 public static function wpTearDownAfterClass() { 44 44 foreach ( array_merge( self::$users, array( self::$fred_id ) ) as $user_id ) { 45 if ( is_multisite() ) { 46 wpmu_delete_user( $user_id ); 47 } else { 48 wp_delete_user( $user_id ); 49 } 45 self::delete_user( $user_id ); 50 46 } 51 47 -
trunk/tests/phpunit/tests/user/query.php
r35206 r35224 47 47 foreach ( $sets as $set ) { 48 48 foreach ( $set as $id ) { 49 if ( is_multisite() ) { 50 wpmu_delete_user( $id ); 51 } else { 52 wp_delete_user( $id ); 53 } 49 self::delete_user( $id ); 54 50 } 55 51 } -
trunk/tests/phpunit/tests/user/wpDeleteUser.php
r34034 r35224 20 20 21 21 // Non-existent users don't have blogs. 22 if ( is_multisite() ) 23 wpmu_delete_user( $user_id ); 24 else 25 wp_delete_user( $user_id ); 22 self::delete_user( $user_id ); 26 23 27 24 $user = new WP_User( $user_id );
Note: See TracChangeset
for help on using the changeset viewer.