You are here

protected function CoderSniffUnitTest::getTestFiles in Coder 8.2

Same name and namespace in other branches
  1. 8.3 tests/Drupal/CoderSniffUnitTest.php \Drupal\Test\CoderSniffUnitTest::getTestFiles()
  2. 8.3.x tests/Drupal/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

string[]

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

... See full list

File

coder_sniffer/Drupal/Test/CoderSniffUnitTest.php, line 84

Class

CoderSniffUnitTest

Namespace

Drupal\Test

Code

protected function getTestFiles($testFileBase) {
  $testFiles = array();
  $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;
}