public function DocParserTest::testAnnotationWithAttributesWithVarTypeArrayError

@dataProvider getAnnotationVarTypeArrayProviderInvalid

File

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

Class

DocParserTest

Namespace

Doctrine\Tests\Common\Annotations

Code

public function testAnnotationWithAttributesWithVarTypeArrayError($attribute, $type, $value, $given) {
  $parser = $this
    ->createTestParser();
  $context = 'property SomeClassName::invalidProperty.';
  $docblock = sprintf('@Doctrine\\Tests\\Common\\Annotations\\Fixtures\\AnnotationWithAttributes(%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\\AnnotationWithAttributes declared on property SomeClassName::invalidProperty. expects either a(n) {$type}, or an array of {$type}s, but got {$given}.", $exc
      ->getMessage());
  }
}