public function getTestFiles()

in src/Retriever/FileRetriever.hack [20:70]


  public function getTestFiles(): keyset<string> {
    if (\ini_get('hhvm.repo.authoritative')) {
      return \Facebook\AutoloadMap\Generated\map()['class']
        |> Keyset\filter(
          $$,
          $filename ==> (
            $filename === $this->path ||
            Str\starts_with($filename, $this->path.'/')
          ) &&
            $this->isTestFile($filename),
        );
    }

    $path = \realpath($this->path);
    if (!$path) {
      throw new InvalidTestFileException(
        Str\format('File or directory (%s) not found', $this->path),
      );
    }
    $files = keyset[];
    if (!\is_dir($path)) {
      $file = $path;
      if (!\is_file($file)) {
        throw new InvalidTestFileException(
          Str\format('File (%s) not found', $file),
        );
      }
      if ($this->isTestFile($file)) {
        return keyset[$file];
      }
      throw new InvalidTestFileException(
        Str\format(
          "Asked to run tests in %s, but it does not end in 'Test.hack' or ".
          'or a legacy extension.',
          $file,
        ),
      );
    }
    $rii = new \RecursiveIteratorIterator(
      new \RecursiveDirectoryIterator($path),
    );

    foreach ($rii as $file) {
      $filename = $file->getPathname();
      if (!$file->isDir() && $this->isTestFile($filename)) {
        $files[] = $filename;
      }
    }

    return $files;
  }