1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-11 16:44:44 +02:00

port MinifyCacheWinCacheTest to phpunit

This commit is contained in:
Elan Ruusamäe
2015-11-19 19:00:28 +02:00
committed by Steve Clay
parent 5b82a781dc
commit fa9f5db843
3 changed files with 20 additions and 32 deletions

View File

@@ -1,31 +0,0 @@
<?php
require_once '_inc.php';
function test_Minify_Cache_WinCache()
{
$prefix = 'Minify_Cache_WinCache : ';
if (! function_exists('wincache_ucache_info')) {
return;
}
$data = str_repeat(md5(time()) . 'í', 100); // 3400 bytes in UTF-8
$id = 'Minify_test_cache';
$cache = new Minify_Cache_WinCache();
assertTrue(true === $cache->store($id, $data), $prefix . 'store');
assertTrue(countBytes($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_WinCache();

View File

@@ -2,7 +2,6 @@
require 'test_Minify.php';
require 'test_Minify_HTML_Helper.php';
require 'test_Minify_Cache_WinCache.php';
require 'test_Minify_CSS.php';
require 'test_Minify_CSS_UriRewriter.php';
require 'test_Minify_HTML.php';

View File

@@ -0,0 +1,20 @@
<?php
class MinifyCacheWinCacheTest extends TestCase
{
public function setUp()
{
if (!function_exists('wincache_ucache_info')) {
$this->markTestSkipped("To test this component, install WinCache extension");
}
}
public function test1()
{
$data = str_repeat(md5(time()) . 'í', 100); // 3400 bytes in UTF-8
$id = 'Minify_test_cache';
$cache = new Minify_Cache_WinCache();
$this->assertTestCache($cache, $id, $data);
}
}