function TestDiscoveryTest::infoParserProvider

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::infoParserProvider()
  2. 8.9.x core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::infoParserProvider()
  3. 10 core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::infoParserProvider()

File

core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php, line 32

Class

TestDiscoveryTest
@coversDefaultClass \Drupal\Core\Test\TestDiscovery @group Test

Namespace

Drupal\Tests\Core\Test

Code

public static function infoParserProvider() {
    // A module provided unit test.
    $tests[] = [
        // Expected result.
[
            'name' => static::class,
            'group' => 'Test',
            'groups' => [
                'Test',
            ],
            'description' => 'Tests \\Drupal\\Core\\Test\\TestDiscovery.',
            'type' => 'PHPUnit-Unit',
        ],
        // Classname.
static::class,
    ];
    // A core unit test.
    $tests[] = [
        // Expected result.
[
            'name' => 'Drupal\\Tests\\Core\\DrupalTest',
            'group' => 'DrupalTest',
            'groups' => [
                'DrupalTest',
            ],
            'description' => 'Tests \\Drupal.',
            'type' => 'PHPUnit-Unit',
        ],
        // Classname.
'Drupal\\Tests\\Core\\DrupalTest',
    ];
    // Functional PHPUnit test.
    $tests[] = [
        // Expected result.
[
            'name' => 'Drupal\\FunctionalTests\\BrowserTestBaseTest',
            'group' => 'browsertestbase',
            'groups' => [
                'browsertestbase',
            ],
            'description' => 'Tests BrowserTestBase functionality.',
            'type' => 'PHPUnit-Functional',
        ],
        // Classname.
'Drupal\\FunctionalTests\\BrowserTestBaseTest',
    ];
    // Kernel PHPUnit test.
    $tests['phpunit-kernel'] = [
        // Expected result.
[
            'name' => '\\Drupal\\Tests\\file\\Kernel\\FileItemValidationTest',
            'group' => 'file',
            'groups' => [
                'file',
            ],
            'description' => 'Tests that files referenced in file and image fields are always validated.',
            'type' => 'PHPUnit-Kernel',
        ],
        // Classname.
'\\Drupal\\Tests\\file\\Kernel\\FileItemValidationTest',
    ];
    // Test with a different amount of leading spaces.
    $tests[] = [
        // Expected result.
[
            'name' => 'Drupal\\Tests\\ExampleTest',
            'group' => 'test',
            'groups' => [
                'test',
            ],
            'description' => 'Example test.',
            'type' => 'PHPUnit-Unit',
        ],
        // Classname.
'Drupal\\Tests\\ExampleTest',
        // Doc block.
"/**\n   * Example test.\n   *\n   * @group test\n   */\n ",
    ];
    // Make sure that a "* @" inside a string does not get parsed as an
    // annotation.
    $tests[] = [
        // Expected result.
[
            'name' => 'Drupal\\Tests\\ExampleTest',
            'group' => 'test',
            'groups' => [
                'test',
            ],
            'description' => 'Example test. * @',
            'type' => 'PHPUnit-Unit',
        ],
        // Classname.
'Drupal\\Tests\\ExampleTest',
        // Doc block.
"/**\n   * Example test. * @\n   *\n   * @group test\n   */\n ",
    ];
    // Multiple @group annotations.
    $tests[] = [
        // Expected result.
[
            'name' => 'Drupal\\Tests\\ExampleTest',
            'group' => 'test1',
            'groups' => [
                'test1',
                'test2',
            ],
            'description' => 'Example test.',
            'type' => 'PHPUnit-Unit',
        ],
        // Classname.
'Drupal\\Tests\\ExampleTest',
        // Doc block.
"/**\n * Example test.\n *\n * @group test1\n * @group test2\n */\n ",
    ];
    // A great number of @group annotations.
    $tests['many-group-annotations'] = [
        // Expected result.
[
            'name' => 'Drupal\\Tests\\ExampleTest',
            'group' => 'test1',
            'groups' => [
                'test1',
                'test2',
                'another',
                'more',
                'many',
                'enough',
                'whoa',
            ],
            'description' => 'Example test.',
            'type' => 'PHPUnit-Unit',
        ],
        // Classname.
'Drupal\\Tests\\ExampleTest',
        // Doc block.
"/**\n * Example test.\n *\n * @group test1\n * @group test2\n * @group another\n * @group more\n * @group many\n * @group enough\n * @group whoa\n */\n ",
    ];
    // Multi-line summary line.
    $tests[] = [
        // Expected result.
[
            'name' => 'Drupal\\Tests\\ExampleTest',
            'description' => 'Example test. And the summary line continues and there is no gap to the annotation.',
            'type' => 'PHPUnit-Unit',
            'group' => 'test',
            'groups' => [
                'test',
            ],
        ],
        // Classname.
'Drupal\\Tests\\ExampleTest',
        // Doc block.
"/**\n * Example test. And the summary line continues and there is no gap to the\n * annotation.\n *\n * @group test\n */\n ",
    ];
    return $tests;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.