public static function scanDirectory($namespace_prefix,
$path) { if (substr($namespace_prefix, -1
) !== '\\'
) { throw new \
InvalidArgumentException("Namespace prefix for
$path must contain a trailing namespace separator."
);
} $flags = \FilesystemIterator::UNIX_PATHS;
$flags |= \FilesystemIterator::SKIP_DOTS;
$flags |= \FilesystemIterator::FOLLOW_SYMLINKS;
$flags |= \FilesystemIterator::CURRENT_AS_SELF;
$flags |= \FilesystemIterator::KEY_AS_FILENAME;
$iterator =
new \
RecursiveDirectoryIterator($path,
$flags);
$filter =
new \
RecursiveCallbackFilterIterator($iterator,
function D
$current,
$file_name,
$iterator) { if ($iterator->
hasChildren()) { return TRUE;
} // We don't want to discover abstract TestBase classes, traits or
// interfaces. They can be deprecated and will call @trigger_error()
// during discovery.
return substr($file_name, -4
) === '.php' &&
substr($file_name, -12
) !== 'TestBase.php' &&
substr($file_name, -9
) !== 'Trait.php' &&
substr($file_name, -13
) !== 'Interface.php';
});