PageRenderTime 56ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/Symfony/vendor/assetic/tests/Assetic/Test/Cache/FilesystemCacheTest.php

https://bitbucket.org/joseph_b/mti-php-zinreader
PHP | 52 lines | 30 code | 14 blank | 8 comment | 0 complexity | 16a184d7676e739d21ca246c4e1b7c7e MD5 | raw file
Possible License(s): LGPL-2.1, LGPL-3.0, BSD-3-Clause, BSD-2-Clause, Apache-2.0
  1. <?php
  2. /*
  3. * This file is part of the Assetic package, an OpenSky project.
  4. *
  5. * (c) 2010-2011 OpenSky Project Inc
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Assetic\Test\Cache;
  11. use Assetic\Cache\FilesystemCache;
  12. class FilesystemCacheTest extends \PHPUnit_Framework_TestCase
  13. {
  14. public function testCache()
  15. {
  16. $cache = new FilesystemCache(sys_get_temp_dir());
  17. $this->assertFalse($cache->has('foo'));
  18. $cache->set('foo', 'bar');
  19. $this->assertEquals('bar', $cache->get('foo'));
  20. $this->assertTrue($cache->has('foo'));
  21. $cache->remove('foo');
  22. $this->assertFalse($cache->has('foo'));
  23. }
  24. public function testSetCreatesDir()
  25. {
  26. $dir = sys_get_temp_dir().'/assetic/fscachetest';
  27. $tearDown = function() use($dir)
  28. {
  29. array_map('unlink', glob($dir.'/*'));
  30. @rmdir($dir);
  31. };
  32. $tearDown();
  33. $cache = new FilesystemCache($dir);
  34. $cache->set('foo', 'bar');
  35. $this->assertFileExists($dir.'/foo');
  36. $tearDown();
  37. }
  38. }