lithium\tests\cases\storage\CacheTest::testCacheWriteAndDeleteWithConditions PHP Метод

testCacheWriteAndDeleteWithConditions() публичный Метод

    public function testCacheWriteAndDeleteWithConditions()
    {
        $config = array('default' => array('adapter' => 'Memory', 'filters' => array()));
        Cache::config($config);
        $result = Cache::config();
        $expected = $config;
        $this->assertEqual($expected, $result);
        $conditions = function () use(&$config) {
            return isset($config['default']);
        };
        $result = Cache::delete('non_existing', 'key_value', compact('conditions'));
        $this->assertFalse($result);
        $result = Cache::write('default', 'to delete', 'dead data', '+1 minute');
        $this->assertTrue($result);
        $result = Cache::delete('default', 'to delete', array('conditions' => function () {
            return false;
        }));
        $this->assertFalse($result);
        $result = Cache::delete('default', 'to delete', compact('conditions'));
        $this->assertTrue($result);
    }