FileCacheReaderTest.php 1013 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Doctrine\Tests\Common\Annotations;
  3. use Doctrine\Common\Annotations\AnnotationReader;
  4. use Doctrine\Common\Annotations\FileCacheReader;
  5. class FileCacheReaderTest extends AbstractReaderTest
  6. {
  7. private $cacheDir;
  8. protected function getReader()
  9. {
  10. $this->cacheDir = sys_get_temp_dir() . "/annotations_". uniqid();
  11. @mkdir($this->cacheDir);
  12. return new FileCacheReader(new AnnotationReader(), $this->cacheDir);
  13. }
  14. public function tearDown()
  15. {
  16. foreach (glob($this->cacheDir.'/*.php') AS $file) {
  17. unlink($file);
  18. }
  19. rmdir($this->cacheDir);
  20. }
  21. /**
  22. * @group DCOM-81
  23. */
  24. public function testAttemptToCreateAnnotationCacheDir()
  25. {
  26. $this->cacheDir = sys_get_temp_dir() . "/not_existed_dir_". uniqid();
  27. $this->assertFalse(is_dir($this->cacheDir));
  28. $cache = new FileCacheReader(new AnnotationReader(), $this->cacheDir);
  29. $this->assertTrue(is_dir($this->cacheDir));
  30. }
  31. }