function TestDiscoveryTest::testTestInfoParser

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

Tests test info parser.

Attributes

#[DataProvider('infoParserProvider')] #[RunInSeparateProcess]

File

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

Class

TestDiscoveryTest
Unit tests for test discovery.

Namespace

Drupal\Tests\Core\Test

Code

public function testTestInfoParser(array $expected, string $classname) : void {
  $configurationFilePath = $this->root . \DIRECTORY_SEPARATOR . 'core';
  $phpUnitTestDiscovery = PhpUnitTestDiscovery::instance()->setConfigurationFilePath($configurationFilePath);
  $classes = $phpUnitTestDiscovery->getTestClasses(NULL, [
    $expected['type'],
  ]);
  $info = $classes[$expected['group']][$classname];
  // The 'file' key varies depending on the CI build directory, but that's
  // rather irrelevant here. Remove the key before comparison.
  unset($info['file']);
  $this->assertEquals($expected, $info);
}

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