mirror of
https://github.com/composer/composer
synced 2025-05-10 17:12:51 +00:00
Add whitelist to the classmap generator to allow skipping of Test files
This commit is contained in:
parent
48c46ce3b6
commit
ee14950972
2 changed files with 13 additions and 3 deletions
|
@ -121,7 +121,12 @@ EOF;
|
|||
foreach ($autoloads['psr-0'] as $namespace => $paths) {
|
||||
foreach ($paths as $dir) {
|
||||
$dir = $this->getPath($filesystem, $relVendorPath, $vendorPath, $dir);
|
||||
foreach (ClassMapGenerator::createMap($dir) as $class => $path) {
|
||||
$whitelist = sprintf(
|
||||
'{%s/%s.+(?<!(?<!/)Test\.php)$}',
|
||||
preg_quote(rtrim($dir, '/')),
|
||||
strpos($namespace, '_') === false ? preg_quote(strtr($namespace, '\\', '/')) : ''
|
||||
);
|
||||
foreach (ClassMapGenerator::createMap($dir, $whitelist) as $class => $path) {
|
||||
if (0 === strpos($class, $namespace)) {
|
||||
$path = '/'.$filesystem->findShortestPath(getcwd(), $path, true);
|
||||
if (!isset($classMap[$class])) {
|
||||
|
@ -304,7 +309,7 @@ EOF;
|
|||
// path starts with vendor dir
|
||||
return $vendorPath . substr($path, strlen($relVendorPath));
|
||||
}
|
||||
return getcwd().'/'.$path;
|
||||
return strtr(getcwd(), '\\', '/').'/'.$path;
|
||||
}
|
||||
|
||||
return $path;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue