You are here

function xautoload_Plugin_DrupalSimpletest::findFile in X Autoload 7.2

Expect a class Drupal\(module)\Tests\SomeTest to be in (module dir)/lib/Drupal/(module)/Tests/SomeTest.php, but consider the PHP include_path setting.

Parameters

object $api: The InjectedAPI object.

string $Drupal_string: The way this plugin is registered, this will be "Drupal/".

string $second_part: Second part of the path, e.g. "$module/Tests/SomeTest.php".

Overrides xautoload_Plugin_Interface::findFile

File

lib/Plugin/DrupalSimpletest.php, line 21

Class

xautoload_Plugin_DrupalSimpletest

Code

function findFile($api, $Drupal_string, $second_part) {
  $pos = strpos($second_part, DIRECTORY_SEPARATOR);
  if ($pos !== FALSE && substr($second_part, $pos + 1, 6) === 'Tests' . DIRECTORY_SEPARATOR) {
    $extension = substr($second_part, 0, $pos);
    $extension_lib_drupal_dir = $this
      ->getExtensionPath($extension);
    if (!empty($extension_lib_drupal_dir)) {
      $path = $extension_lib_drupal_dir . $second_part;
      if ($api
        ->suggestFile($path)) {
        return TRUE;
      }
    }
  }
}