2023-12-03 22:11:29 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace nur\io;
|
|
|
|
|
|
|
|
use nur\b\io\CacheManager;
|
|
|
|
use nur\t\TestCase;
|
|
|
|
|
|
|
|
class CacheManagerTest extends TestCase {
|
|
|
|
function test() {
|
|
|
|
$cm = new CacheManager();
|
|
|
|
|
|
|
|
self::assertTrue($cm->shouldCache("a"));
|
|
|
|
self::assertTrue($cm->shouldCache("a"));
|
|
|
|
self::assertTrue($cm->shouldCache("a"));
|
|
|
|
|
2024-07-05 15:43:02 +04:00
|
|
|
$cm->setNoCache(true);
|
2023-12-03 22:11:29 +04:00
|
|
|
self::assertFalse($cm->shouldCache("b"));
|
|
|
|
self::assertTrue($cm->shouldCache("b"));
|
|
|
|
self::assertTrue($cm->shouldCache("b"));
|
|
|
|
|
2024-07-05 15:43:02 +04:00
|
|
|
$cm->setNoCache(true);
|
|
|
|
self::assertFalse($cm->shouldCache("c", null, false));
|
|
|
|
self::assertFalse($cm->shouldCache("c", null, false));
|
|
|
|
self::assertFalse($cm->shouldCache("c", null, false));
|
2023-12-03 22:11:29 +04:00
|
|
|
|
2024-07-05 15:43:02 +04:00
|
|
|
$cm->setNoCache(true);
|
2023-12-03 22:11:29 +04:00
|
|
|
self::assertFalse($cm->shouldCache("d"));
|
|
|
|
self::assertTrue($cm->shouldCache("d"));
|
2024-07-05 15:43:02 +04:00
|
|
|
$cm->setNoCache(true);
|
2023-12-03 22:11:29 +04:00
|
|
|
self::assertFalse($cm->shouldCache("d"));
|
|
|
|
self::assertTrue($cm->shouldCache("d"));
|
|
|
|
}
|
|
|
|
}
|