class FilesystemCacheTest

Hierarchy

  • class \Assetic\Test\Cache\FilesystemCacheTest extends \Assetic\Test\Cache\PHPUnit_Framework_TestCase

Expanded class hierarchy of FilesystemCacheTest

File

drupal/core/vendor/kriswallsmith/assetic/tests/Assetic/Test/Cache/FilesystemCacheTest.php, line 16

Namespace

Assetic\Test\Cache
View source
class FilesystemCacheTest extends \PHPUnit_Framework_TestCase {
  public function testCache() {
    $cache = new FilesystemCache(sys_get_temp_dir());
    $this
      ->assertFalse($cache
      ->has('foo'));
    $cache
      ->set('foo', 'bar');
    $this
      ->assertEquals('bar', $cache
      ->get('foo'));
    $this
      ->assertTrue($cache
      ->has('foo'));
    $cache
      ->remove('foo');
    $this
      ->assertFalse($cache
      ->has('foo'));
  }
  public function testSetCreatesDir() {
    $dir = sys_get_temp_dir() . '/assetic/fscachetest';
    $tearDown = function () use ($dir) {
      array_map('unlink', glob($dir . '/*'));
      @rmdir($dir);
    };
    $tearDown();
    $cache = new FilesystemCache($dir);
    $cache
      ->set('foo', 'bar');
    $this
      ->assertFileExists($dir . '/foo');
    $tearDown();
  }

}

Members