You are here

public function TestInfoParsingTest::infoParserProvider in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php \Drupal\Tests\simpletest\Unit\TestInfoParsingTest::infoParserProvider()

File

core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php, line 27
Contains \Drupal\Tests\simpletest\Unit\TestInfoParsingTest.

Class

TestInfoParsingTest
@coversDefaultClass \Drupal\simpletest\TestDiscovery @group simpletest

Namespace

Drupal\Tests\simpletest\Unit

Code

public function infoParserProvider() {

  // A module provided unit test.
  $tests[] = [
    // Expected result.
    [
      'name' => 'Drupal\\Tests\\simpletest\\Unit\\TestInfoParsingTest',
      'group' => 'PHPUnit',
      'description' => 'Tests \\Drupal\\simpletest\\TestDiscovery.',
    ],
    // Classname.
    'Drupal\\Tests\\simpletest\\Unit\\TestInfoParsingTest',
  ];

  // A core unit test.
  $tests[] = [
    // Expected result.
    [
      'name' => 'Drupal\\Tests\\Core\\DrupalTest',
      'group' => 'PHPUnit',
      'description' => 'Tests \\Drupal.',
    ],
    // Classname.
    'Drupal\\Tests\\Core\\DrupalTest',
  ];

  // Functional PHPUnit test.
  $tests[] = [
    // Expected result.
    [
      'name' => 'Drupal\\Tests\\simpletest\\Functional\\BrowserTestBaseTest',
      'group' => 'simpletest',
      'description' => 'Tests BrowserTestBase functionality.',
    ],
    // Classname.
    'Drupal\\Tests\\simpletest\\Functional\\BrowserTestBaseTest',
  ];

  // Simpletest classes can not be autoloaded in a PHPUnit test, therefore
  // provide a docblock.
  $tests[] = [
    // Expected result.
    [
      'name' => 'Drupal\\field\\Tests\\BulkDeleteTest',
      'group' => 'field',
      'description' => 'Bulk delete storages and fields, and clean up afterwards.',
    ],
    // Classname.
    'Drupal\\field\\Tests\\BulkDeleteTest',
    // Doc block.
    "/**\n * Bulk delete storages and fields, and clean up afterwards.\n *\n * @group field\n */\n ",
  ];

  // Test with a different amount of leading spaces.
  $tests[] = [
    // Expected result.
    [
      'name' => 'Drupal\\field\\Tests\\BulkDeleteTest',
      'group' => 'field',
      'description' => 'Bulk delete storages and fields, and clean up afterwards.',
    ],
    // Classname.
    'Drupal\\field\\Tests\\BulkDeleteTest',
    // Doc block.
    "/**\n   * Bulk delete storages and fields, and clean up afterwards.\n   *\n   * @group field\n   */\n ",
  ];

  // Make sure that a "* @" inside a string does not get parsed as an
  // annotation.
  $tests[] = [
    // Expected result.
    [
      'name' => 'Drupal\\field\\Tests\\BulkDeleteTest',
      'group' => 'field',
      'description' => 'Bulk delete storages and fields, and clean up afterwards. * @',
    ],
    // Classname.
    'Drupal\\field\\Tests\\BulkDeleteTest',
    // Doc block.
    "/**\n   * Bulk delete storages and fields, and clean up afterwards. * @\n   *\n   * @group field\n   */\n ",
  ];

  // Multiple @group annotations.
  $tests[] = [
    // Expected result.
    [
      'name' => 'Drupal\\field\\Tests\\BulkDeleteTest',
      'group' => 'Test',
      'description' => 'Bulk delete storages and fields, and clean up afterwards.',
    ],
    // Classname.
    'Drupal\\field\\Tests\\BulkDeleteTest',
    // Doc block.
    "/**\n * Bulk delete storages and fields, and clean up afterwards.\n *\n * @group Test\n * @group field\n */\n ",
  ];

  // @dependencies annotation.
  $tests[] = [
    // Expected result.
    [
      'name' => 'Drupal\\field\\Tests\\BulkDeleteTest',
      'group' => 'field',
      'description' => 'Bulk delete storages and fields, and clean up afterwards.',
      'requires' => [
        'module' => [
          'test',
        ],
      ],
    ],
    // Classname.
    'Drupal\\field\\Tests\\BulkDeleteTest',
    // Doc block.
    "/**\n * Bulk delete storages and fields, and clean up afterwards.\n *\n * @dependencies test\n * @group field\n */\n ",
  ];

  // Multiple @dependencies annotation.
  $tests[] = [
    // Expected result.
    [
      'name' => 'Drupal\\field\\Tests\\BulkDeleteTest',
      'group' => 'field',
      'description' => 'Bulk delete storages and fields, and clean up afterwards.',
      'requires' => [
        'module' => [
          'test',
          'test1',
          'test2',
        ],
      ],
    ],
    // Classname.
    'Drupal\\field\\Tests\\BulkDeleteTest',
    // Doc block.
    "/**\n * Bulk delete storages and fields, and clean up afterwards.\n *\n * @dependencies test, test1,test2\n * @group field\n */\n ",
  ];

  // Multi-line summary line.
  $tests[] = [
    // Expected result.
    [
      'name' => 'Drupal\\field\\Tests\\BulkDeleteTest',
      'group' => 'field',
      'description' => 'Bulk delete storages and fields, and clean up afterwards. And the summary line continues and there is no gap to the annotation.',
    ],
    // Classname.
    'Drupal\\field\\Tests\\BulkDeleteTest',
    // Doc block.
    "/**\n * Bulk delete storages and fields, and clean up afterwards. And the summary\n * line continues and there is no gap to the annotation.\n * @group field\n */\n ",
  ];
  return $tests;
}