mirror of
https://github.com/mrclay/minify.git
synced 2025-08-21 05:11:46 +02:00
port MinifyCacheZendPlatformTest to phpunit
This commit is contained in:
committed by
Steve Clay
parent
3cb97e2e47
commit
5d46afbc72
@@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once '_inc.php';
|
|
||||||
|
|
||||||
function test_Minify_Cache_ZendPlatform()
|
|
||||||
{
|
|
||||||
$prefix = 'Minify_Cache_ZendPlatform : ';
|
|
||||||
if (! function_exists('output_cache_put')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$data = str_repeat(md5(time()) . 'í', 100); // 3400 bytes in UTF-8
|
|
||||||
$id = 'Minify_test_cache';
|
|
||||||
|
|
||||||
$cache = new Minify_Cache_ZendPlatform();
|
|
||||||
|
|
||||||
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_ZendPlatform();
|
|
@@ -3,9 +3,7 @@
|
|||||||
require 'test_Minify.php';
|
require 'test_Minify.php';
|
||||||
require 'test_Minify_HTML_Helper.php';
|
require 'test_Minify_HTML_Helper.php';
|
||||||
require 'test_Minify_Cache_APC.php';
|
require 'test_Minify_Cache_APC.php';
|
||||||
require 'test_Minify_Cache_Memcache.php';
|
|
||||||
require 'test_Minify_Cache_WinCache.php';
|
require 'test_Minify_Cache_WinCache.php';
|
||||||
require 'test_Minify_Cache_ZendPlatform.php';
|
|
||||||
require 'test_Minify_CSS.php';
|
require 'test_Minify_CSS.php';
|
||||||
require 'test_Minify_CSS_UriRewriter.php';
|
require 'test_Minify_CSS_UriRewriter.php';
|
||||||
require 'test_Minify_HTML.php';
|
require 'test_Minify_HTML.php';
|
||||||
|
21
tests/MinifyCacheZendPlatformTest.php
Normal file
21
tests/MinifyCacheZendPlatformTest.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class MinifyCacheZendPlatformTest extends TestCase
|
||||||
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
if (!function_exists('output_cache_put')) {
|
||||||
|
// FIXME: be specific what to actually install
|
||||||
|
$this->markTestSkipped("To test this component, install ZendPlatform");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test1()
|
||||||
|
{
|
||||||
|
$data = str_repeat(md5(time()) . 'í', 100); // 3400 bytes in UTF-8
|
||||||
|
$id = 'Minify_test_cache';
|
||||||
|
|
||||||
|
$cache = new Minify_Cache_ZendPlatform();
|
||||||
|
$this->assertTestCache($cache, $id, $data);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user