WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/28/2017 07:35:49 PM (4 years ago)
Author:
jeremyfelt
Message:

Multisite: Respect $_wp_suspend_cache_invalidation when clearing network and site caches.

Props johnjamesjacoby.
Fixes #40028.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/multisite/site.php

    r39173 r40346  
    121121        wp_update_network_counts();
    122122        $this->assertEquals( 2, (int) get_blog_count() );
     123    }
     124
     125    public function test_site_caches_should_invalidate_when_invalidation_is_not_suspended() {
     126        $site_id = self::factory()->blog->create();
     127
     128        $details = get_site( $site_id );
     129
     130        $suspend = wp_suspend_cache_invalidation( false );
     131        update_blog_details( $site_id, array( 'path' => '/a-non-random-test-path/' ) );
     132        $new_details = get_site( $site_id );
     133        wp_suspend_cache_invalidation( $suspend );
     134
     135        $this->assertNotEquals( $details->path, $new_details->path );
     136    }
     137
     138    public function test_site_caches_should_not_invalidate_when_invalidation_is_suspended() {
     139        $site_id = self::factory()->blog->create();
     140
     141        $details = get_site( $site_id );
     142
     143        $suspend = wp_suspend_cache_invalidation();
     144        update_blog_details( $site_id, array( 'path' => '/a-non-random-test-path/' ) );
     145        $new_details = get_site( $site_id );
     146        wp_suspend_cache_invalidation( $suspend );
     147
     148        $this->assertEquals( $details->path, $new_details->path );
    123149    }
    124150
Note: See TracChangeset for help on using the changeset viewer.