1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-02 04:10:43 +02:00
Files
minify/tests/MinifyCacheMemcacheTest.php
2024-01-04 01:19:42 -05:00

53 lines
1.3 KiB
PHP

<?php
namespace Minify\Test;
use Memcache;
use Minify_Cache_Memcache;
class MinifyCacheMemcacheTest extends TestCase
{
/** @var Memcache */
private $mc;
public function setUp(): void
{
if (getenv('GITHUB_ACTION')) {
$this->markTestSkipped("Skipping on CI");
return;
}
if (!function_exists('memcache_set')) {
$this->markTestSkipped("To test this component, install memcache in PHP");
}
$this->mc = new Memcache();
if (!$this->mc->connect('localhost', 11211)) {
$this->markTestSkipped("Memcache server not found on localhost:11211");
}
}
public function test1()
{
$data = str_repeat(md5(time()) . 'í', 100); // 3400 bytes in UTF-8
$id = 'Minify_test_memcache';
$cache = new Minify_Cache_Memcache($this->mc);
$this->assertTestCache($cache, $id, $data);
}
public function test2()
{
if (!function_exists('gzencode')) {
$this->markTestSkipped("enable gzip extension to test this");
}
$data = str_repeat(md5(time()) . 'í', 100); // 3400 bytes in UTF-8
$id = 'Minify_test_memcache.gz';
$cache = new Minify_Cache_Memcache($this->mc);
$data = gzencode($data);
$this->assertTestCache($cache, $id, $data);
}
}