PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/FileCacheReaderTest.php

https://bitbucket.org/arturoblack/tomoyo
PHP | 40 lines | 28 code | 9 blank | 3 comment | 0 complexity | cc685d959b469513aa72252dbb0a7c45 MD5 | raw file
Possible License(s): BSD-3-Clause, BSD-2-Clause, Apache-2.0, LGPL-2.1, CC-BY-3.0, LGPL-3.0
  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. }