public function DocParserTest::testAnnotationWithVarTypeError

@dataProvider getAnnotationVarTypeProviderInvalid

File

drupal/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php, line 511

Class

DocParserTest

Namespace

Doctrine\Tests\Common\Annotations

Code

public function testAnnotationWithVarTypeError($attribute, $type, $value, $given) {
  $parser = $this
    ->createTestParser();
  $context = 'property SomeClassName::invalidProperty.';
  $docblock = sprintf('@Doctrine\\Tests\\Common\\Annotations\\Fixtures\\AnnotationWithVarType(%s = %s)', $attribute, $value);
  $parser
    ->setTarget(Target::TARGET_PROPERTY);
  try {
    $parser
      ->parse($docblock, $context);
    $this
      ->fail();
  } catch (\Doctrine\Common\Annotations\AnnotationException $exc) {
    $this
      ->assertContains("[Type Error] Attribute \"{$attribute}\" of @Doctrine\\Tests\\Common\\Annotations\\Fixtures\\AnnotationWithVarType declared on property SomeClassName::invalidProperty. expects a(n) {$type}, but got {$given}.", $exc
      ->getMessage());
  }
}