Make WordPress Core

Changeset 23 in tests


Ignore:
Timestamp:
09/22/2007 04:25:07 AM (18 years ago)
Author:
tellyworth
Message:

add cache test_individual_expiry

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_cache.php

    r5 r23  
    5151
    5252    function test_not_expired() {
    53         // this fails - looks like the object cache doesn't expire
    5453        $key = rand_str();
    5554        $val = rand_str();
     
    8786    }
    8887
     88    function test_individual_expiry() {
     89        // FIXME: this is a current bug
     90        $this->markTestSkipped();
     91
     92        $key = rand_str();
     93        $val = rand_str();
     94
     95        // http://trac.wordpress.org/ticket/4179
     96        // individual expiration parameters are ignored
     97        // this should expire after 1 second
     98        $this->assertTrue($this->cache1->add($key, $val, '', 1));
     99        $this->assertTrue($this->cache1->save());
     100
     101        // not yet expired
     102        $this->assertEquals($val, $this->cache1->get($key));
     103        $this->assertEquals($val, $this->cache2->get($key));
     104
     105        // 3 seconds later, key should have expired
     106        sleep(3);
     107        $this->assertEquals(NULL, $this->cache2->get($key));
     108        // cache1's key is still cached in memory, which doesn't expire
     109        $this->assertEquals($val, $this->cache1->get($key));
     110    }
    89111}
    90112
Note: See TracChangeset for help on using the changeset viewer.