Ejemplo n.º 1
0
 /**
  * Checks whether the cache has starting buffering or not
  *
  * @return boolean
  */
 public function isStarted()
 {
     return $this->cache->isStarted();
 }
Ejemplo n.º 2
0
 public function dataIgbinary(UnitTester $I)
 {
     if (!extension_loaded('igbinary')) {
         throw new \PHPUnit_Framework_SkippedTestError('Warning: igbinary extension is not loaded');
     }
     $I->wantTo("Use File cache with Igbinary frontend");
     $frontend = new Igbinary(['lifetime' => 600]);
     $backend = new File($frontend, ['cacheDir' => PATH_CACHE, 'prefix' => 'igbinary_']);
     $I->assertFalse($backend->isStarted());
     $backend->save('test-data', 'nothing interesting');
     $I->amInPath(PATH_CACHE);
     $I->seeFileFound('igbinary_' . $backend->getKey('test-data'));
     $I->seeFileContentsEqual(igbinary_serialize('nothing interesting'));
     $I->assertEquals('nothing interesting', $backend->get('test-data'));
     $backend->save('test-data', 'something interesting');
     $I->assertEquals('something interesting', $backend->get('test-data'));
     $data = ['null' => null, 'array' => [1, 2, 3, 4 => 5], 'string', 123.45, 6, true, false, null, 0, ""];
     $serialized = igbinary_serialize($data);
     $I->assertEquals($data, igbinary_unserialize($serialized));
     $backend->save('test-data', $data);
     $I->assertEquals($data, $backend->get('test-data'));
     $I->assertTrue($backend->exists('test-data'));
     $I->assertTrue($backend->delete('test-data'));
     // Delete cache
     $I->dontSeeFileFound('igbinary_' . $backend->getKey('test-data'));
 }