Making WordPress.org


Ignore:
Timestamp:
06/08/2017 08:18:20 PM (9 years ago)
Author:
iandunn
Message:

Events: Replace object caching with stubs when running tests

Previously the object cache was enabled during tests, but it was bypassed by adding a cachebuster to the input. That was broken by r5552, because the cache keys are no longer built with the entire input. It wasn't immediately apparent, because the tests continued to pass as expected.

This commit changes that approach, so that the tests never load the object cache in the first place, and simply stub its functions instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/events/1.0/index.php

    r5552 r5558  
    1111
    1212        bootstrap();
    13         wp_cache_init();
    1413
    1514        /*
    … …  
    3130        }
    3231
     32        wp_cache_init();
     33
    3334        $cache_group   = 'events';
    3435        $cache_life    = 12 * 60 * 60;
    … …  
    4950        require( $base_dir . '/init.php' );
    5051        require( $base_dir . '/includes/hyperdb/bb-10-hyper-db.php' );
    51         include( $base_dir . '/includes/object-cache.php' );
    5252        include( $base_dir . '/includes/wp-json-encode.php' );
     53
     54        if ( ! defined( 'RUNNING_TESTS' ) || ! RUNNING_TESTS ) {
     55                include( $base_dir . '/includes/object-cache.php' );
     56        }
    5357}
    5458
Note: See TracChangeset for help on using the changeset viewer.