class CachedReaderTest

Hierarchy

  • class \Doctrine\Tests\Common\Annotations\AbstractReaderTest extends \Doctrine\Tests\Common\Annotations\PHPUnit_Framework_TestCase

Expanded class hierarchy of CachedReaderTest

File

drupal/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/CachedReaderTest.php, line 10

Namespace

Doctrine\Tests\Common\Annotations
View source
class CachedReaderTest extends AbstractReaderTest {
  private $cache;
  public function testIgnoresStaleCache() {
    $file = __DIR__ . '/Fixtures/Controller.php';
    touch($file);
    $name = 'Doctrine\\Tests\\Common\\Annotations\\Fixtures\\Controller';
    $cacheKey = $name . '@[Annot]';
    $cache = $this
      ->getMock('Doctrine\\Common\\Cache\\Cache');
    $cache
      ->expects($this
      ->at(0))
      ->method('fetch')
      ->with($this
      ->equalTo($cacheKey))
      ->will($this
      ->returnValue(array()));
    $cache
      ->expects($this
      ->at(1))
      ->method('fetch')
      ->with($this
      ->equalTo('[C]' . $cacheKey))
      ->will($this
      ->returnValue(time() - 10));
    $cache
      ->expects($this
      ->at(2))
      ->method('save')
      ->with($this
      ->equalTo($cacheKey));
    $cache
      ->expects($this
      ->at(3))
      ->method('save')
      ->with($this
      ->equalTo('[C]' . $cacheKey));
    $reader = new CachedReader(new AnnotationReader(), $cache, true);
    $route = new Route();
    $route->pattern = '/someprefix';
    $this
      ->assertEquals(array(
      $route,
    ), $reader
      ->getClassAnnotations(new \ReflectionClass($name)));
  }
  protected function getReader() {
    $this->cache = new ArrayCache();
    return new CachedReader(new AnnotationReader(), $this->cache);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractReaderTest::getReflectionClass public function
AbstractReaderTest::testAnnotations public function @dataProvider getReflectionClass
AbstractReaderTest::testAnnotationsWithValidTargets public function
AbstractReaderTest::testAnnotationsWithVarType public function
AbstractReaderTest::testClassSyntaxErrorContext public function @expectedException Doctrine\Common\Annotations\AnnotationException @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 18 in class Doctrine\Tests\Common\Annotations\DummyClassSyntaxError.
AbstractReaderTest::testClassWithAnnotationWithTargetSyntaxErrorAtClassDocBlock public function @expectedException Doctrine\Common\Annotations\AnnotationException @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 24 in class @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithTargetSyntaxError.
AbstractReaderTest::testClassWithAnnotationWithTargetSyntaxErrorAtMethodDocBlock public function @expectedException Doctrine\Common\Annotations\AnnotationException @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 24 in class @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithTargetSyntaxError.
AbstractReaderTest::testClassWithAnnotationWithTargetSyntaxErrorAtPropertyDocBlock public function @expectedException Doctrine\Common\Annotations\AnnotationException @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 24 in class @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithTargetSyntaxError.
AbstractReaderTest::testClassWithInvalidAnnotationTargetAtClassDocBlock public function @expectedException Doctrine\Common\Annotations\AnnotationException @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetPropertyMethod is not allowed to be declared on class… 1
AbstractReaderTest::testClassWithInvalidAnnotationTargetAtMethodDocBlock public function @expectedException Doctrine\Common\Annotations\AnnotationException @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetClass is not allowed to be declared on method… 1
AbstractReaderTest::testClassWithInvalidAnnotationTargetAtPropertyDocBlock public function @expectedException Doctrine\Common\Annotations\AnnotationException @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetClass is not allowed to be declared on property… 1
AbstractReaderTest::testClassWithInvalidNestedAnnotationTargetAtPropertyDocBlock public function @expectedException Doctrine\Common\Annotations\AnnotationException @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetAnnotation is not allowed to be declared on property… 1
AbstractReaderTest::testClassWithMethodInvalidVarTypeError public function @expectedException Doctrine\Common\Annotations\AnnotationException @expectedExceptionMessage [Type Error] Attribute "annotation" of @AnnotationWithVarType declared on method…
AbstractReaderTest::testClassWithPropertyInvalidVarTypeError public function @expectedException Doctrine\Common\Annotations\AnnotationException @expectedExceptionMessage [Type Error] Attribute "string" of @AnnotationWithVarType declared on property…
AbstractReaderTest::testErrorWhenInvalidAnnotationIsUsed public function @expectedException Doctrine\Common\Annotations\AnnotationException @expectedExceptionMessage The class "Doctrine\Tests\Common\Annotations\Fixtures\NoAnnotation" is not annotated with . Are you sure this class can be used as annotation? If…
AbstractReaderTest::testIgnoresAnnotationsNotPrefixedWithWhitespace public function
AbstractReaderTest::testImportDetectsNonExistentAnnotation public function @expectedException Doctrine\Common\Annotations\AnnotationException @expectedExceptionMessage The annotation "@Foo\Bar\Name" in property Doctrine\Tests\Common\Annotations\TestNonExistentAnnotationClass::$field was never imported. 1
AbstractReaderTest::testImportDetectsNotImportedAnnotation public function @expectedException Doctrine\Common\Annotations\AnnotationException @expectedExceptionMessage The annotation "@NameFoo" in property Doctrine\Tests\Common\Annotations\TestAnnotationNotImportedClass::$field was never imported. 1
AbstractReaderTest::testImportWithConcreteAnnotation public function
AbstractReaderTest::testImportWithInheritance public function
AbstractReaderTest::testInvalidAnnotationButIgnored public function @group DDC-1660 @group regression 1
AbstractReaderTest::testInvalidAnnotationUsageButIgnoredClass public function 1
AbstractReaderTest::testMethodSyntaxErrorContext public function @expectedException Doctrine\Common\Annotations\AnnotationException @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 18 in method Doctrine\Tests\Common\Annotations\DummyClassMethodSyntaxError::foo().
AbstractReaderTest::testMultipleAnnotationsOnSameLine public function @group regression
AbstractReaderTest::testNonAnnotationProblem public function
AbstractReaderTest::testPropertySyntaxErrorContext public function @expectedException Doctrine\Common\Annotations\AnnotationException @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 18 in property Doctrine\Tests\Common\Annotations\DummyClassPropertySyntaxError::$foo.
AbstractReaderTest::testTopLevelAnnotation public function
CachedReaderTest::$cache private property
CachedReaderTest::getReader protected function Overrides AbstractReaderTest::getReader
CachedReaderTest::testIgnoresStaleCache public function