<?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(true);
    self::assertFalse($cm->shouldCache("b"));
    self::assertTrue($cm->shouldCache("b"));
    self::assertTrue($cm->shouldCache("b"));

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

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