summaryrefslogtreecommitdiff
path: root/plugins/Minify/extlib/minify/min_unit_tests/test_Minify_Cache_APC.php
blob: 74a1b2c56e9d1440699b5922f8eb824d4e5eeac7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require_once '_inc.php';

require_once 'Minify/Cache/APC.php';

function test_Minify_Cache_APC()
{
    $prefix = 'Minify_Cache_APC : ';
    if (! function_exists('apc_store')) {
        return;
    }
    $data = str_repeat(md5('testing'), 160);
    $id = 'Minify_test_cache';
    
    $cache = new Minify_Cache_APC();
    
    assertTrue(true === $cache->store($id, $data), $prefix . 'store');
    
    assertTrue(strlen($data) === $cache->getSize($id), $prefix . 'getSize');
    
    assertTrue(true === $cache->isValid($id, $_SERVER['REQUEST_TIME'] - 10), $prefix . 'isValid');
    
    ob_start();
    $cache->display($id);
    $displayed = ob_get_contents();
    ob_end_clean();
    
    assertTrue($data === $displayed, $prefix . 'display');
    
    assertTrue($data === $cache->fetch($id), $prefix . 'fetch');
}

test_Minify_Cache_APC();