<?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"));

    $cm->setNoCache();
    self::assertFalse($cm->shouldCache("b"));
    self::assertTrue($cm->shouldCache("b"));
    self::assertTrue($cm->shouldCache("b"));

    $cm->setNoCache();
    self::assertFalse($cm->shouldCache("c", false));
    self::assertFalse($cm->shouldCache("c", false));
    self::assertFalse($cm->shouldCache("c", false));

    $cm->setNoCache();
    self::assertFalse($cm->shouldCache("d"));
    self::assertTrue($cm->shouldCache("d"));
    $cm->setNoCache();
    self::assertFalse($cm->shouldCache("d"));
    self::assertTrue($cm->shouldCache("d"));
  }
}