function testCacheHit()
  {
    registerTestingIni(
      'testing2.ini',
      'test = 1'
    );

    registerTestingIni(
      'testing2.ini.override',
      'test = 2'
    );

    $ini = new Ini(VAR_DIR . 'testing2.ini', true); //ini should be cached here...

    $ini_mock = new IniMockVersionOverride($this);

    touch($ini->getCacheFile(), time()+100);

    $ini_mock->expectNever('_parse');
    $ini_mock->expectNever('_saveCache');

    $ini_mock->__construct(VAR_DIR . 'testing2.ini', true);

    $ini_mock->tally();

    $ini->resetCache();
  }
예제 #2
0
  function testNoCache()
  {
    registerTestingIni(
      'testing.ini',
      'test = 1'
    );

    $ini = new Ini(VAR_DIR . 'testing.ini', true); //ini should be cached here...

    $this->assertTrue(file_exists($ini->getCacheFile()));
    unlink($ini->getCacheFile());

    $ini_mock = new IniMockVersion($this);
    $ini_mock->expectOnce('_parse');
    $ini_mock->expectOnce('_saveCache');

    $ini_mock->Ini(VAR_DIR . 'testing.ini', true);

    $ini_mock->tally();

    $ini->resetCache();
  }