You are here

protected function CoderSniffUnitTest::getTestFiles in Coder 8.3.x

Same name and namespace in other branches
  1. 8.3 tests/Drupal/CoderSniffUnitTest.php \Drupal\Test\CoderSniffUnitTest::getTestFiles()
  2. 8.2 coder_sniffer/Drupal/Test/CoderSniffUnitTest.php \Drupal\Test\CoderSniffUnitTest::getTestFiles()

Get a list of all test files to check.

These will have the same base as the sniff name but different extensions. We ignore the .php file as it is the class.

Parameters

string $testFileBase The base path that the unit tests files will have.:

Return value

array<string>

1 call to CoderSniffUnitTest::getTestFiles()
CoderSniffUnitTest::testSniff in tests/Drupal/CoderSniffUnitTest.php
Tests the extending classes Sniff class.
20 methods override CoderSniffUnitTest::getTestFiles()
AccessHookMenuUnitTest::getTestFiles in tests/DrupalPractice/FunctionDefinitions/AccessHookMenuUnitTest.php
Returns a list of test files that should be checked.
AutoAddedKeysUnitTest::getTestFiles in tests/Drupal/InfoFiles/AutoAddedKeysUnitTest.php
Returns a list of test files that should be checked.
BadUnitTest::getTestFiles in tests/Drupal/bad/BadUnitTest.php
Returns a list of test files that should be checked.
ClassFileNameUnitTest::getTestFiles in tests/Drupal/Classes/ClassFileNameUnitTest.php
Returns a list of test files that should be checked.
ClassFilesUnitTest::getTestFiles in tests/Drupal/InfoFiles/ClassFilesUnitTest.php
Returns a list of test files that should be checked.

... See full list

File

tests/Drupal/CoderSniffUnitTest.php, line 91

Class

CoderSniffUnitTest

Namespace

Drupal\Test

Code

protected function getTestFiles($testFileBase) : array {
  $testFiles = [];
  $dir = substr($testFileBase, 0, strrpos($testFileBase, DIRECTORY_SEPARATOR));
  $di = new \DirectoryIterator($dir);
  foreach ($di as $file) {
    $path = $file
      ->getPathname();
    if (substr($path, 0, strlen($testFileBase)) === $testFileBase) {
      if ($path !== $testFileBase . 'php' && substr($path, -5) !== 'fixed') {
        $testFiles[] = $path;
      }
    }
  }

  // Put them in order.
  sort($testFiles);
  return $testFiles;
}