diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index 257930f59..4e7dcf496 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -84,7 +84,7 @@ class ClassMapGenerator foreach ($classes as $class) { if (!isset($map[$class])) { $map[$class] = $filePath; - } elseif ($io && $map[$class] !== $filePath) { + } elseif ($io && $map[$class] !== $filePath && preg_match('{/(test|fixture)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) { $io->write( 'Warning: Ambiguous class resolution, "'.$class.'"'. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.' diff --git a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php index fa9380e5f..07e95d525 100644 --- a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php +++ b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php @@ -102,6 +102,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase $find->invoke(null, __DIR__.'/no-file'); } + public function testAmbiguousReference() { $this->checkIfFinderIsAvailable();