Skip to:
Content

BuddyPress.org

Changeset 8040


Ignore:
Timestamp:
03/05/2014 02:27:27 AM (11 years ago)
Author:
boonebgorges
Message:

More generous tests for blog meta cache

The current test assumes we know exhaustively what the blog meta keys will be.
The new technique only checks to make sure that our whitelist is present in the
cache, which is all we really need to check to verify that the cache priming
is working.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/testcases/blogs/cache.php

    r7918 r8040  
    7373        );
    7474
    75         $this->assertSame( $b1_expected, wp_cache_get( $b1, 'blog_meta' ) );
    76         $this->assertSame( $b2_expected, wp_cache_get( $b2, 'blog_meta' ) );
     75        // The cache may contain more than just this, so loop through
     76        // and check only relevant keys
     77        $b1_found = wp_cache_get( $b1, 'blog_meta' );
     78        foreach ( $b1_expected as $k => $v ) {
     79            $this->assertSame( $v, $b1_found[ $k ] );
     80        }
     81
     82        $b2_found = wp_cache_get( $b2, 'blog_meta' );
     83        foreach ( $b2_expected as $k => $v ) {
     84            $this->assertSame( $v, $b2_found[ $k ] );
     85        }
    7786    }
    7887
     
    156165        );
    157166
    158         $this->assertSame( $b1_expected, wp_cache_get( $b1, 'blog_meta' ) );
    159         $this->assertSame( $b2_expected, wp_cache_get( $b2, 'blog_meta' ) );
     167        // The cache may contain more than just this, so loop through
     168        // and check only relevant keys
     169        $b1_found = wp_cache_get( $b1, 'blog_meta' );
     170        foreach ( $b1_expected as $k => $v ) {
     171            $this->assertSame( $v, $b1_found[ $k ] );
     172        }
     173
     174        $b2_found = wp_cache_get( $b2, 'blog_meta' );
     175        foreach ( $b2_expected as $k => $v ) {
     176            $this->assertSame( $v, $b2_found[ $k ] );
     177        }
    160178
    161179        $this->set_current_user( $old_user );
Note: See TracChangeset for help on using the changeset viewer.