You are here

public function DocParserTest::getAnnotationVarTypeProviderInvalid in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php \Drupal\Tests\Component\Annotation\Doctrine\DocParserTest::getAnnotationVarTypeProviderInvalid()

File

core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php, line 455

Class

DocParserTest
@coversDefaultClass \Drupal\Component\Annotation\Doctrine\DocParser

Namespace

Drupal\Tests\Component\Annotation\Doctrine

Code

public function getAnnotationVarTypeProviderInvalid() {

  //({attribute name}, {type declared type}, {attribute value} , {given type or class})
  return array(
    // boolean type
    array(
      'boolean',
      'boolean',
      '1',
      'integer',
    ),
    array(
      'boolean',
      'boolean',
      '1.2',
      'double',
    ),
    array(
      'boolean',
      'boolean',
      '"str"',
      'string',
    ),
    array(
      'boolean',
      'boolean',
      '{1,2,3}',
      'array',
    ),
    array(
      'boolean',
      'boolean',
      '@Name',
      'an instance of Drupal\\Tests\\Component\\Annotation\\Doctrine\\Name',
    ),
    // alias for internal type boolean
    array(
      'bool',
      'bool',
      '1',
      'integer',
    ),
    array(
      'bool',
      'bool',
      '1.2',
      'double',
    ),
    array(
      'bool',
      'bool',
      '"str"',
      'string',
    ),
    array(
      'bool',
      'bool',
      '{"str"}',
      'array',
    ),
    // integer type
    array(
      'integer',
      'integer',
      'true',
      'boolean',
    ),
    array(
      'integer',
      'integer',
      'false',
      'boolean',
    ),
    array(
      'integer',
      'integer',
      '1.2',
      'double',
    ),
    array(
      'integer',
      'integer',
      '"str"',
      'string',
    ),
    array(
      'integer',
      'integer',
      '{"str"}',
      'array',
    ),
    array(
      'integer',
      'integer',
      '{1,2,3,4}',
      'array',
    ),
    // alias for internal type double
    array(
      'float',
      'float',
      'true',
      'boolean',
    ),
    array(
      'float',
      'float',
      'false',
      'boolean',
    ),
    array(
      'float',
      'float',
      '123',
      'integer',
    ),
    array(
      'float',
      'float',
      '"str"',
      'string',
    ),
    array(
      'float',
      'float',
      '{"str"}',
      'array',
    ),
    array(
      'float',
      'float',
      '{12.34}',
      'array',
    ),
    array(
      'float',
      'float',
      '{1,2,3}',
      'array',
    ),
    // string type
    array(
      'string',
      'string',
      'true',
      'boolean',
    ),
    array(
      'string',
      'string',
      'false',
      'boolean',
    ),
    array(
      'string',
      'string',
      '12',
      'integer',
    ),
    array(
      'string',
      'string',
      '1.2',
      'double',
    ),
    array(
      'string',
      'string',
      '{"str"}',
      'array',
    ),
    array(
      'string',
      'string',
      '{1,2,3,4}',
      'array',
    ),
    // annotation instance
    array(
      'annotation',
      'Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\AnnotationTargetAll',
      'true',
      'boolean',
    ),
    array(
      'annotation',
      'Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\AnnotationTargetAll',
      'false',
      'boolean',
    ),
    array(
      'annotation',
      'Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\AnnotationTargetAll',
      '12',
      'integer',
    ),
    array(
      'annotation',
      'Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\AnnotationTargetAll',
      '1.2',
      'double',
    ),
    array(
      'annotation',
      'Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\AnnotationTargetAll',
      '{"str"}',
      'array',
    ),
    array(
      'annotation',
      'Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\AnnotationTargetAll',
      '{1,2,3,4}',
      'array',
    ),
    array(
      'annotation',
      'Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\AnnotationTargetAll',
      '@Name',
      'an instance of Drupal\\Tests\\Component\\Annotation\\Doctrine\\Name',
    ),
  );
}