WordPress.org

Make WordPress Core

Changeset 913 in tests


Ignore:
Timestamp:
07/19/12 13:00:03 (3 years ago)
Author:
nacin
Message:

Tests for WP_Object_Cache::delete(). props tollmanz, fixes #108.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/cache.php

    r909 r913  
    149149        $this->assertEquals( 0, $this->cache->get( $key ) ); 
    150150    } 
     151 
     152    function test_delete() { 
     153        $key = rand_str(); 
     154        $val = rand_str(); 
     155 
     156        // Verify set 
     157        $this->assertTrue( $this->cache->set( $key, $val ) ); 
     158        $this->assertEquals( $val, $this->cache->get( $key ) ); 
     159 
     160        // Verify successful delete 
     161        $this->assertTrue( $this->cache->delete( $key ) ); 
     162        $this->assertFalse( $this->cache->get( $key ) ); 
     163 
     164        // Delete returns (bool) true when key is not set and $force is true 
     165        $this->assertTrue( $this->cache->delete( $key, 'default', true ) ); 
     166        $this->assertFalse( $this->cache->delete( $key, 'default') ); 
     167    } 
    151168} 
Note: See TracChangeset for help on using the changeset viewer.