WordPress.org

Make WordPress Core

Changeset 456 in tests


Ignore:
Timestamp:
10/18/11 16:42:18 (2 years ago)
Author:
duck_
Message:

Test to ensure get_site_option doesn't cache the default value for non-existent options. See #WP18955.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_option.php

    r436 r456  
    9898    // #15497 - ensure update_site_option will add options with false-y values 
    9999    function test_update_adds_falsey_value() { 
    100         global $wpdb; 
    101100        $key = rand_str(); 
    102101        $value = 0; 
     
    106105        wp_cache_flush(); // ensure we're getting the value from the DB 
    107106        $this->assertEquals( $value, get_site_option( $key ) ); 
     107    } 
     108 
     109    // #18955 - ensure get_site_option doesn't cache the default value for non-existent options 
     110    function test_get_doesnt_cache_default_value() { 
     111        $option = rand_str(); 
     112        $default = 'a default'; 
     113 
     114        $this->assertEquals( get_site_option( $option, $default ), $default ); 
     115        $this->assertFalse( get_site_option( $option ) );    
    108116    } 
    109117} 
Note: See TracChangeset for help on using the changeset viewer.