for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace BasicTests;
use kalanis\kw_cache\Simple;
use kalanis\kw_cache\StaticCache;
use kalanis\kw_cache\CacheException;
class StaticTest extends \CommonTestClass
{
/**
* @throws CacheException
*/
public function testRun(): void
StaticCache::setCache(new Simple\Memory());
$this->assertNotEmpty(StaticCache::getCache());
StaticCache::init('');
$this->assertFalse(StaticCache::exists());
$this->assertEquals('', StaticCache::get());
// simple write
$this->assertTrue(StaticCache::set(static::TESTING_CONTENT));
$this->assertTrue(StaticCache::exists());
$this->assertEquals(static::TESTING_CONTENT, StaticCache::get());
// clear all
StaticCache::clear();
}
public function testFailExists(): void
StaticCache::setCache(null);
$this->assertEmpty(StaticCache::getCache());
$this->expectException(CacheException::class);