Changeset 41719 for trunk/tests/phpunit/tests/multisite/site.php
- Timestamp:
- 10/03/2017 07:40:01 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/multisite/site.php
r41716 r41719 119 119 $details = get_blog_details( $blog_id, false ); 120 120 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' ) ); 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 ) ); 125 124 126 125 // get_blogaddress_by_name() 127 126 $this->assertEquals( 'http://' . $details->domain . $details->path, get_blogaddress_by_name( trim( $details->path, '/' ) ) ); 128 127 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' ) ); 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' ) ); 132 130 133 131 // $get_all = true, populate the full blog-details cache and the blog slug lookup cache 134 132 $details = get_blog_details( $blog_id, true ); 135 $this->assertEquals( $details, wp_cache_get( $blog_id, 'blog-details' ) ); 136 $this->assertEquals( $details, wp_cache_get( $key, 'blog-lookup' ) ); 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 ) ); 137 136 138 137 // Check existence of each database table for the created site. … … 197 196 wpmu_delete_blog( $blog_id, false ); 198 197 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' ) ); 198 $this->assertEquals( false, wp_cache_get( $blog_id, 'sites' ) ); 199 $this->assertEquals( false, wp_cache_get( $blog_id, 'site-details' ) ); 202 200 $this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) ); 203 201 } … … 235 233 wpmu_delete_blog( $blog_id, true ); 236 234 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' ) ); 235 $this->assertEquals( false, wp_cache_get( $blog_id, 'sites' ) ); 236 $this->assertEquals( false, wp_cache_get( $blog_id, 'site-details' ) ); 240 237 $this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) ); 241 238 } … … 273 270 wpmu_delete_blog( $blog_id, true ); 274 271 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' ) ); 272 $this->assertEquals( false, wp_cache_get( $blog_id, 'sites' ) ); 273 $this->assertEquals( false, wp_cache_get( $blog_id, 'site-details' ) ); 278 274 $this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) ); 279 275 } … … 391 387 get_blog_details( $blog_id ); 392 388 393 // When the cache is primed with an invalid site, the value is set to -1.394 $this->assert Equals( -1, wp_cache_get( $blog_id, 'blog-details' ) );389 // When the cache is primed with an invalid site, the value is not set. 390 $this->assertFalse( wp_cache_get( $blog_id, 'site-details' ) ); 395 391 396 392 // Create a site in the invalid site's place. … … 398 394 399 395 // When a new site is created, its cache is cleared through refresh_blog_details. 400 $this->assertFalse( wp_cache_get( $blog_id, ' blog-details' ) );396 $this->assertFalse( wp_cache_get( $blog_id, 'site-details' ) ); 401 397 402 398 $blog = get_blog_details( $blog_id ); 403 399 404 400 // When the cache is refreshed, it should now equal the site data. 405 $this->assertEquals( $blog, wp_cache_get( $blog_id, 'blog-details' ) ); 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 ) ); 406 404 } 407 405
Note: See TracChangeset
for help on using the changeset viewer.