WordPress.org

Make WordPress Core

Changeset 1045 in tests


Ignore:
Timestamp:
09/24/12 19:32:23 (19 months ago)
Author:
ryan
Message:

Tests for blog-details and blog-lookup cache invalidation. see #WP20950

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/ms.php

    r1024 r1045  
    1919            $this->assertInternalType( 'int', $blog_id ); 
    2020            $prefix = $wpdb->get_blog_prefix( $blog_id ); 
     21 
     22            // $get_all = false 
     23            $details = get_blog_details( $blog_id, false ); 
     24            $this->assertEquals( $details, wp_cache_get( $blog_id . 'short', 'blog-details' ) ); 
     25 
     26            // get_id_from_blogname(), see #20950 
     27            $this->assertEquals( $blog_id, get_id_from_blogname( $details->path ) ); 
     28            $this->assertEquals( $blog_id, wp_cache_get( 'get_id_from_blogname_' . trim( $details->path, '/' ), 'blog-details' ) ); 
     29 
     30            // These are empty until get_blog_details() is called with $get_all = true 
     31            $this->assertEquals( false, wp_cache_get( $blog_id, 'blog-details' ) ); 
     32            $key = md5( $details->domain . $details->path ); 
     33            $this->assertEquals( false, wp_cache_get( $key, 'blog-lookup' ) ); 
     34 
     35            // $get_all = true should propulate the full blog-details cache and the blog slug lookup cache 
     36            $details = get_blog_details( $blog_id, true ); 
     37            $this->assertEquals( $details, wp_cache_get( $blog_id, 'blog-details' ) ); 
     38            $this->assertEquals( $details, wp_cache_get( $key, 'blog-lookup' ) ); 
    2139 
    2240            foreach ( $wpdb->tables( 'blog', false ) as $table ) { 
     
    4260            // drop tables for every second blog 
    4361            $drop_tables = ! $drop_tables; 
     62            $details = get_blog_details( $blog_id, false ); 
     63 
    4464            wpmu_delete_blog( $blog_id, $drop_tables ); 
     65 
     66            $this->assertEquals( false, wp_cache_get( 'get_id_from_blogname_' . trim( $details->path, '/' ), 'blog-details' ) ); 
     67            $this->assertEquals( false, wp_cache_get( $blog_id, 'blog-details' ) ); 
     68            $this->assertEquals( false, wp_cache_get( $blog_id . 'short', 'blog-details' ) ); 
     69            $key = md5( $details->domain . $details->path ); 
     70            $this->assertEquals( false, wp_cache_get( $key, 'blog-lookup' ) ); 
    4571 
    4672            $prefix = $wpdb->get_blog_prefix( $blog_id ); 
Note: See TracChangeset for help on using the changeset viewer.