Changeset 41883 for trunk/tests/phpunit/tests/multisite/site.php
- Timestamp:
- 10/16/2017 10:28:52 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/multisite/site.php
r41719 r41883 119 119 $details = get_blog_details( $blog_id, false ); 120 120 121 $cached_details = wp_cache_get( $blog_id, 'sites' ); 122 $this->assertNotFalse( $cached_details ); 123 $this->assertEqualSets( get_object_vars( $details ), get_object_vars( $cached_details ) ); 121 // Combine domain and path for a site specific cache key. 122 $key = md5( $details->domain . $details->path ); 123 124 $this->assertEquals( $details, wp_cache_get( $blog_id . 'short', 'blog-details' ) ); 124 125 125 126 // get_blogaddress_by_name() 126 127 $this->assertEquals( 'http://' . $details->domain . $details->path, get_blogaddress_by_name( trim( $details->path, '/' ) ) ); 127 128 128 // This is empty until get_blog_details() is called with $get_all = true 129 $this->assertEquals( false, wp_cache_get( $blog_id, 'site-details' ) ); 129 // These are empty until get_blog_details() is called with $get_all = true 130 $this->assertEquals( false, wp_cache_get( $blog_id, 'blog-details' ) ); 131 $this->assertEquals( false, wp_cache_get( $key, 'blog-lookup' ) ); 130 132 131 133 // $get_all = true, populate the full blog-details cache and the blog slug lookup cache 132 134 $details = get_blog_details( $blog_id, true ); 133 $cached_details = wp_cache_get( $blog_id, 'site-details' ); 134 $this->assertNotFalse( $cached_details ); 135 $this->assertEqualSets( get_object_vars( $details ), get_object_vars( $cached_details ) ); 135 $this->assertEquals( $details, wp_cache_get( $blog_id, 'blog-details' ) ); 136 $this->assertEquals( $details, wp_cache_get( $key, 'blog-lookup' ) ); 136 137 137 138 // Check existence of each database table for the created site. … … 196 197 wpmu_delete_blog( $blog_id, false ); 197 198 198 $this->assertEquals( false, wp_cache_get( $blog_id, 'sites' ) ); 199 $this->assertEquals( false, wp_cache_get( $blog_id, 'site-details' ) ); 199 $this->assertEquals( false, wp_cache_get( $blog_id, 'blog-details' ) ); 200 $this->assertEquals( false, wp_cache_get( $blog_id . 'short', 'blog-details' ) ); 201 $this->assertEquals( false, wp_cache_get( $key, 'blog-lookup' ) ); 200 202 $this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) ); 201 203 } … … 233 235 wpmu_delete_blog( $blog_id, true ); 234 236 235 $this->assertEquals( false, wp_cache_get( $blog_id, 'sites' ) ); 236 $this->assertEquals( false, wp_cache_get( $blog_id, 'site-details' ) ); 237 $this->assertEquals( false, wp_cache_get( $blog_id, 'blog-details' ) ); 238 $this->assertEquals( false, wp_cache_get( $blog_id . 'short', 'blog-details' ) ); 239 $this->assertEquals( false, wp_cache_get( $key, 'blog-lookup' ) ); 237 240 $this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) ); 238 241 } … … 270 273 wpmu_delete_blog( $blog_id, true ); 271 274 272 $this->assertEquals( false, wp_cache_get( $blog_id, 'sites' ) ); 273 $this->assertEquals( false, wp_cache_get( $blog_id, 'site-details' ) ); 275 $this->assertEquals( false, wp_cache_get( $blog_id, 'blog-details' ) ); 276 $this->assertEquals( false, wp_cache_get( $blog_id . 'short', 'blog-details' ) ); 277 $this->assertEquals( false, wp_cache_get( $key, 'blog-lookup' ) ); 274 278 $this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) ); 275 279 } … … 387 391 get_blog_details( $blog_id ); 388 392 389 // When the cache is primed with an invalid site, the value is not set.390 $this->assert False( wp_cache_get( $blog_id, 'site-details' ) );393 // When the cache is primed with an invalid site, the value is set to -1. 394 $this->assertEquals( -1, wp_cache_get( $blog_id, 'blog-details' ) ); 391 395 392 396 // Create a site in the invalid site's place. … … 394 398 395 399 // When a new site is created, its cache is cleared through refresh_blog_details. 396 $this->assertFalse( wp_cache_get( $blog_id, ' site-details' ) );400 $this->assertFalse( wp_cache_get( $blog_id, 'blog-details' ) ); 397 401 398 402 $blog = get_blog_details( $blog_id ); 399 403 400 404 // When the cache is refreshed, it should now equal the site data. 401 $cached_blog = wp_cache_get( $blog_id, 'site-details' ); 402 $this->assertNotFalse( $cached_blog ); 403 $this->assertEqualSets( get_object_vars( $blog ), get_object_vars( $cached_blog ) ); 405 $this->assertEquals( $blog, wp_cache_get( $blog_id, 'blog-details' ) ); 404 406 } 405 407
Note: See TracChangeset
for help on using the changeset viewer.