Changeset 47013
- Timestamp:
- 12/25/2019 09:39:46 PM (5 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/factory/class-wp-unittest-factory-for-blog.php
r47011 r47013 34 34 global $wpdb; 35 35 36 // Map some arguments for backward compatibility with wpmu_create_blog() previously used here. 37 if ( ! isset( $args['public'] ) ) { 38 // Default to public, unless an options array was provided. 39 $args['public'] = ! isset( $args['meta'] ) ? 1 : 0; 40 } 41 42 if ( ! isset( $args['user_id'] ) ) { 43 $args['user_id'] = get_current_user_id(); 44 } 45 46 if ( isset( $args['site_id'] ) ) { 36 // Map some arguments for backward compatibility with `wpmu_create_blog()` previously used here. 37 if ( ! isset( $args['network_id'] ) && isset( $args['site_id'] ) ) { 47 38 $args['network_id'] = $args['site_id']; 48 39 unset( $args['site_id'] ); -
trunk/tests/phpunit/tests/multisite.php
r46586 r47013 44 44 'public' => self::factory()->blog->create_many( 45 45 random_int( 0, 5 ), 46 array( 'meta' => array( 'public' => 1 ) ) 46 array( 47 'public' => 1, 48 ) 47 49 ), 48 50 'archived' => self::factory()->blog->create_many( 49 51 random_int( 0, 5 ), 50 array( 'meta' => array( 'archived' => 1 ) ) 52 array( 53 'public' => 0, 54 'archived' => 1, 55 ) 51 56 ), 52 57 'mature' => self::factory()->blog->create_many( 53 58 random_int( 0, 5 ), 54 array( 'meta' => array( 'mature' => 1 ) ) 59 array( 60 'public' => 0, 61 'mature' => 1, 62 ) 55 63 ), 56 64 'spam' => self::factory()->blog->create_many( 57 65 random_int( 0, 5 ), 58 array( 'meta' => array( 'spam' => 1 ) ) 66 array( 67 'public' => 0, 68 'spam' => 1, 69 ) 59 70 ), 60 71 'deleted' => self::factory()->blog->create_many( 61 72 random_int( 0, 5 ), 62 array( 'meta' => array( 'deleted' => 1 ) ) 73 array( 74 'public' => 0, 75 'deleted' => 1, 76 ) 63 77 ), 64 78 ); -
trunk/tests/phpunit/tests/multisite/bootstrap.php
r47012 r47013 56 56 self::$site_ids = array( 57 57 'wordpress.org/' => array( 58 'domain' => 'wordpress.org',59 'path' => '/',60 ' site_id' => self::$network_ids['wordpress.org/'],58 'domain' => 'wordpress.org', 59 'path' => '/', 60 'network_id' => self::$network_ids['wordpress.org/'], 61 61 ), 62 62 'wordpress.org/foo/' => array( 63 'domain' => 'wordpress.org',64 'path' => '/foo/',65 ' site_id' => self::$network_ids['wordpress.org/'],63 'domain' => 'wordpress.org', 64 'path' => '/foo/', 65 'network_id' => self::$network_ids['wordpress.org/'], 66 66 ), 67 67 'wordpress.org/foo/bar/' => array( 68 'domain' => 'wordpress.org',69 'path' => '/foo/bar/',70 ' site_id' => self::$network_ids['wordpress.org/'],68 'domain' => 'wordpress.org', 69 'path' => '/foo/bar/', 70 'network_id' => self::$network_ids['wordpress.org/'], 71 71 ), 72 72 'make.wordpress.org/' => array( 73 'domain' => 'make.wordpress.org',74 'path' => '/',75 ' site_id' => self::$network_ids['make.wordpress.org/'],73 'domain' => 'make.wordpress.org', 74 'path' => '/', 75 'network_id' => self::$network_ids['make.wordpress.org/'], 76 76 ), 77 77 'make.wordpress.org/foo/' => array( 78 'domain' => 'make.wordpress.org',79 'path' => '/foo/',80 ' site_id' => self::$network_ids['make.wordpress.org/'],78 'domain' => 'make.wordpress.org', 79 'path' => '/foo/', 80 'network_id' => self::$network_ids['make.wordpress.org/'], 81 81 ), 82 82 'www.w.org/' => array( -
trunk/tests/phpunit/tests/multisite/getIdFromBlogname.php
r47012 r47013 32 32 self::$site_ids = array( 33 33 'wordpress.org/' => array( 34 'domain' => 'wordpress.org',35 'path' => '/',36 ' site_id' => self::$network_ids['wordpress.org/'],34 'domain' => 'wordpress.org', 35 'path' => '/', 36 'network_id' => self::$network_ids['wordpress.org/'], 37 37 ), 38 38 'foo.wordpress.org/' => array( 39 'domain' => 'foo.wordpress.org',40 'path' => '/',41 ' site_id' => self::$network_ids['wordpress.org/'],39 'domain' => 'foo.wordpress.org', 40 'path' => '/', 41 'network_id' => self::$network_ids['wordpress.org/'], 42 42 ), 43 43 'wordpress.org/foo/' => array( 44 'domain' => 'wordpress.org',45 'path' => '/foo/',46 ' site_id' => self::$network_ids['wordpress.org/'],44 'domain' => 'wordpress.org', 45 'path' => '/foo/', 46 'network_id' => self::$network_ids['wordpress.org/'], 47 47 ), 48 48 'www.wordpress.net/' => array( 49 'domain' => 'www.wordpress.net',50 'path' => '/',51 ' site_id' => self::$network_ids['www.wordpress.net/'],49 'domain' => 'www.wordpress.net', 50 'path' => '/', 51 'network_id' => self::$network_ids['www.wordpress.net/'], 52 52 ), 53 53 'foo.wordpress.net/' => array( 54 'domain' => 'foo.wordpress.net',55 'path' => '/',56 ' site_id' => self::$network_ids['www.wordpress.net/'],54 'domain' => 'foo.wordpress.net', 55 'path' => '/', 56 'network_id' => self::$network_ids['www.wordpress.net/'], 57 57 ), 58 58 'www.wordpress.net/foo/' => array( 59 'domain' => 'www.wordpress.net',60 'path' => '/foo/',61 ' site_id' => self::$network_ids['www.wordpress.net/'],59 'domain' => 'www.wordpress.net', 60 'path' => '/foo/', 61 'network_id' => self::$network_ids['www.wordpress.net/'], 62 62 ), 63 63 ); -
trunk/tests/phpunit/tests/multisite/getMainSiteId.php
r47012 r47013 36 36 ), 37 37 'wordpress.org/' => array( 38 'domain' => 'wordpress.org',39 'path' => '/',40 ' site_id' => self::$network_ids['wordpress.org/'],38 'domain' => 'wordpress.org', 39 'path' => '/', 40 'network_id' => self::$network_ids['wordpress.org/'], 41 41 ), 42 42 'wordpress.org/foo/' => array( 43 'domain' => 'wordpress.org',44 'path' => '/foo/',45 ' site_id' => self::$network_ids['wordpress.org/'],43 'domain' => 'wordpress.org', 44 'path' => '/foo/', 45 'network_id' => self::$network_ids['wordpress.org/'], 46 46 ), 47 47 ); -
trunk/tests/phpunit/tests/multisite/network.php
r47012 r47013 39 39 $sites = array( 40 40 array( 41 'domain' => 'wordpress.org',42 'path' => '/',43 ' site_id' => self::$different_network_id,41 'domain' => 'wordpress.org', 42 'path' => '/', 43 'network_id' => self::$different_network_id, 44 44 ), 45 45 array( 46 'domain' => 'wordpress.org',47 'path' => '/foo/',48 ' site_id' => self::$different_network_id,46 'domain' => 'wordpress.org', 47 'path' => '/foo/', 48 'network_id' => self::$different_network_id, 49 49 ), 50 50 array( 51 'domain' => 'wordpress.org',52 'path' => '/bar/',53 ' site_id' => self::$different_network_id,51 'domain' => 'wordpress.org', 52 'path' => '/bar/', 53 'network_id' => self::$different_network_id, 54 54 ), 55 55 ); -
trunk/tests/phpunit/tests/multisite/site.php
r47012 r47013 45 45 self::$site_ids = array( 46 46 'make.wordpress.org/' => array( 47 'domain' => 'make.wordpress.org',48 'path' => '/',49 ' site_id' => self::$network_ids['make.wordpress.org/'],47 'domain' => 'make.wordpress.org', 48 'path' => '/', 49 'network_id' => self::$network_ids['make.wordpress.org/'], 50 50 ), 51 51 'make.wordpress.org/foo/' => array( 52 'domain' => 'make.wordpress.org',53 'path' => '/foo/',54 ' site_id' => self::$network_ids['make.wordpress.org/'],52 'domain' => 'make.wordpress.org', 53 'path' => '/foo/', 54 'network_id' => self::$network_ids['make.wordpress.org/'], 55 55 ), 56 56 ); … … 64 64 self::$uninitialized_site_id = wp_insert_site( 65 65 array( 66 'domain' => 'uninitialized.org',67 'path' => '/',68 ' site_id' => self::$network_ids['make.wordpress.org/'],66 'domain' => 'uninitialized.org', 67 'path' => '/', 68 'network_id' => self::$network_ids['make.wordpress.org/'], 69 69 ) 70 70 ); -
trunk/tests/phpunit/tests/multisite/siteQuery.php
r47012 r47013 50 50 self::$site_ids = array( 51 51 'wordpress.org/' => array( 52 'domain' => 'wordpress.org',53 'path' => '/',54 ' site_id' => self::$network_ids['wordpress.org/'],52 'domain' => 'wordpress.org', 53 'path' => '/', 54 'network_id' => self::$network_ids['wordpress.org/'], 55 55 ), 56 56 'wordpress.org/foo/' => array( 57 'domain' => 'wordpress.org',58 'path' => '/foo/',59 ' site_id' => self::$network_ids['wordpress.org/'],57 'domain' => 'wordpress.org', 58 'path' => '/foo/', 59 'network_id' => self::$network_ids['wordpress.org/'], 60 60 ), 61 61 'wordpress.org/foo/bar/' => array( 62 'domain' => 'wordpress.org',63 'path' => '/foo/bar/',64 ' site_id' => self::$network_ids['wordpress.org/'],62 'domain' => 'wordpress.org', 63 'path' => '/foo/bar/', 64 'network_id' => self::$network_ids['wordpress.org/'], 65 65 ), 66 66 'make.wordpress.org/' => array( 67 'domain' => 'make.wordpress.org',68 'path' => '/',69 ' site_id' => self::$network_ids['make.wordpress.org/'],67 'domain' => 'make.wordpress.org', 68 'path' => '/', 69 'network_id' => self::$network_ids['make.wordpress.org/'], 70 70 ), 71 71 'make.wordpress.org/foo/' => array( 72 'domain' => 'make.wordpress.org',73 'path' => '/foo/',74 ' site_id' => self::$network_ids['make.wordpress.org/'],72 'domain' => 'make.wordpress.org', 73 'path' => '/foo/', 74 'network_id' => self::$network_ids['make.wordpress.org/'], 75 75 ), 76 76 'www.w.org/' => array( … … 87 87 ), 88 88 'www.w.org/make/' => array( 89 'domain' => 'www.w.org', 90 'path' => '/make/', 91 'meta' => array( 92 'public' => 1, 93 'lang_id' => 1, 94 ), 89 'domain' => 'www.w.org', 90 'path' => '/make/', 91 'public' => 1, 92 'lang_id' => 1, 95 93 ), 96 94 ); -
trunk/tests/phpunit/tests/multisite/wpGetSites.php
r47012 r47013 14 14 self::$site_ids = array( 15 15 'w.org/' => array( 16 'domain' => 'w.org',17 'path' => '/',18 ' site_id' => 2,16 'domain' => 'w.org', 17 'path' => '/', 18 'network_id' => 2, 19 19 ), 20 20 'wp.org/' => array( 21 'domain' => 'wp.org',22 'path' => '/',23 ' site_id' => 2,24 ' meta' => array( 'public' => 0 ),21 'domain' => 'wp.org', 22 'path' => '/', 23 'network_id' => 2, 24 'public' => 0, 25 25 ), 26 26 'wp.org/foo/' => array( 27 'domain' => 'wp.org',28 'path' => '/foo/',29 ' site_id' => 1,30 ' meta' => array( 'public' => 0 ),27 'domain' => 'wp.org', 28 'path' => '/foo/', 29 'network_id' => 1, 30 'public' => 0, 31 31 ), 32 32 'wp.org/oof/' => array( -
trunk/tests/phpunit/tests/multisite/wpmuValidateBlogSignup.php
r47012 r47013 35 35 self::$existing_blog_id = $factory->blog->create( 36 36 array( 37 'domain' => $domain,38 'path' => $path,39 ' site_id' => $network->id,37 'domain' => $domain, 38 'path' => $path, 39 'network_id' => $network->id, 40 40 ) 41 41 ); -
trunk/tests/phpunit/tests/option/multisite.php
r46586 r47013 105 105 array( 106 106 'user_id' => $user_id, 107 'meta' => array( 108 'public' => 1, 109 ), 107 'public' => 1, 110 108 ) 111 109 ); -
trunk/tests/phpunit/tests/user/getActiveBlogForUser.php
r47012 r47013 84 84 array( 85 85 'user_id' => self::$user_id, 86 ' meta' => array( 'spam' => 1 ),86 'spam' => 1, 87 87 ) 88 88 ); -
trunk/tests/phpunit/tests/user/multisite.php
r47012 r47013 123 123 $this->assertTrue( is_blog_user( get_current_blog_id() ) ); 124 124 125 $blog_ids = array(); 126 127 $blog_ids = self::factory()->blog->create_many( 1 ); 128 foreach ( $blog_ids as $blog_id ) { 129 $this->assertInternalType( 'int', $blog_id ); 130 $this->assertTrue( is_blog_user( $blog_id ) ); 131 $this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) ); 132 $this->assertFalse( is_blog_user( $blog_id ) ); 133 } 125 $blog_id = self::factory()->blog->create( array( 'user_id' => get_current_user_id() ) ); 126 127 $this->assertInternalType( 'int', $blog_id ); 128 $this->assertTrue( is_blog_user( $blog_id ) ); 129 $this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) ); 130 $this->assertFalse( is_blog_user( $blog_id ) ); 134 131 135 132 wp_set_current_user( $old_current ); … … 158 155 $this->assertTrue( is_user_member_of_blog( $user1_id, $site_id ) ); 159 156 160 $blog_ids = self::factory()->blog->create_many( 1 ); 161 foreach ( $blog_ids as $blog_id ) { 162 $this->assertInternalType( 'int', $blog_id ); 163 164 // Current user gets added to new blogs 165 $this->assertTrue( is_user_member_of_blog( $user1_id, $blog_id ) ); 166 // Other users should not 167 $this->assertFalse( is_user_member_of_blog( $user2_id, $blog_id ) ); 168 169 switch_to_blog( $blog_id ); 170 171 $this->assertTrue( is_user_member_of_blog( $user1_id ) ); 172 $this->assertFalse( is_user_member_of_blog( $user2_id ) ); 173 174 // Remove user 1 from blog 175 $this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) ); 176 177 // Add user 2 to blog 178 $this->assertTrue( add_user_to_blog( $blog_id, $user2_id, 'subscriber' ) ); 179 180 $this->assertFalse( is_user_member_of_blog( $user1_id ) ); 181 $this->assertTrue( is_user_member_of_blog( $user2_id ) ); 182 183 restore_current_blog(); 184 185 $this->assertFalse( is_user_member_of_blog( $user1_id, $blog_id ) ); 186 $this->assertTrue( is_user_member_of_blog( $user2_id, $blog_id ) ); 187 } 157 $blog_id = self::factory()->blog->create( array( 'user_id' => get_current_user_id() ) ); 158 159 $this->assertInternalType( 'int', $blog_id ); 160 161 // Current user gets added to new blogs 162 $this->assertTrue( is_user_member_of_blog( $user1_id, $blog_id ) ); 163 // Other users should not 164 $this->assertFalse( is_user_member_of_blog( $user2_id, $blog_id ) ); 165 166 switch_to_blog( $blog_id ); 167 168 $this->assertTrue( is_user_member_of_blog( $user1_id ) ); 169 $this->assertFalse( is_user_member_of_blog( $user2_id ) ); 170 171 // Remove user 1 from blog 172 $this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) ); 173 174 // Add user 2 to blog 175 $this->assertTrue( add_user_to_blog( $blog_id, $user2_id, 'subscriber' ) ); 176 177 $this->assertFalse( is_user_member_of_blog( $user1_id ) ); 178 $this->assertTrue( is_user_member_of_blog( $user2_id ) ); 179 180 restore_current_blog(); 181 182 $this->assertFalse( is_user_member_of_blog( $user1_id, $blog_id ) ); 183 $this->assertTrue( is_user_member_of_blog( $user2_id, $blog_id ) ); 188 184 189 185 wpmu_delete_user( $user1_id );
Note: See TracChangeset
for help on using the changeset viewer.