| | 124 | |
| | 125 | /** |
| | 126 | * @ticket 43506 |
| | 127 | */ |
| | 128 | public function test_get_network_option_sets_notoptions_if_option_found() { |
| | 129 | $network_id = get_current_network_id(); |
| | 130 | $notoptions_key = "$network_id:notoptions"; |
| | 131 | |
| | 132 | $original_cache = wp_cache_get( $notoptions_key, 'site-options' ); |
| | 133 | if ( false !== $original_cache ) { |
| | 134 | wp_cache_delete( $notoptions_key, 'site-options' ); |
| | 135 | } |
| | 136 | |
| | 137 | // Retrieve any existing option. |
| | 138 | get_network_option( $network_id, 'site_name' ); |
| | 139 | |
| | 140 | $cache = wp_cache_get( $notoptions_key, 'site-options' ); |
| | 141 | if ( false !== $original_cache ) { |
| | 142 | wp_cache_set( $notoptions_key, $original_cache, 'site-options' ); |
| | 143 | } |
| | 144 | |
| | 145 | $this->assertSame( array(), $cache ); |
| | 146 | } |
| | 147 | |
| | 148 | /** |
| | 149 | * @ticket 43506 |
| | 150 | */ |
| | 151 | public function test_get_network_option_sets_notoptions_if_option_not_found() { |
| | 152 | $network_id = get_current_network_id(); |
| | 153 | $notoptions_key = "$network_id:notoptions"; |
| | 154 | |
| | 155 | $original_cache = wp_cache_get( $notoptions_key, 'site-options' ); |
| | 156 | if ( false !== $original_cache ) { |
| | 157 | wp_cache_delete( $notoptions_key, 'site-options' ); |
| | 158 | } |
| | 159 | |
| | 160 | // Retrieve any non-existing option. |
| | 161 | get_network_option( $network_id, 'this_does_not_exist' ); |
| | 162 | |
| | 163 | $cache = wp_cache_get( $notoptions_key, 'site-options' ); |
| | 164 | if ( false !== $original_cache ) { |
| | 165 | wp_cache_set( $notoptions_key, $original_cache, 'site-options' ); |
| | 166 | } |
| | 167 | |
| | 168 | $this->assertSame( array( 'this_does_not_exist' => true ), $cache ); |
| | 169 | } |