WordPress.org

Make WordPress Core

Changeset 917 in tests


Ignore:
Timestamp:
07/19/2012 02:58:34 PM (9 years ago)
Author:
nacin
Message:

Test that WP_Object_Cache::set() can override a cached key, unlike add(). props tollmanz. fixes #109.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/cache.php

    r913 r917  
    7878    function test_set() {
    7979        $key = rand_str();
    80         $val = rand_str();
     80        $val1 = rand_str();
     81        $val2 = rand_str();
    8182
    8283        // memcached accepts set() if the key does not exist
    83         $this->assertTrue($this->cache->set($key, $val));
    84         $this->assertEquals($val, $this->cache->get($key));
     84        $this->assertTrue($this->cache->set($key, $val1));
     85        $this->assertEquals($val1, $this->cache->get($key));
     86        // Second set() with same key should be allowed
     87        $this->assertTrue($this->cache->set($key, $val2));
     88        $this->assertEquals($val2, $this->cache->get($key));
    8589    }
    8690
Note: See TracChangeset for help on using the changeset viewer.