From 810e70d234b37885bdca3a7a3536c6d576f477a6 Mon Sep 17 00:00:00 2001 From: AnrDaemon Date: Fri, 23 Dec 2016 21:57:00 +0300 Subject: [PATCH] Fix __DIR__/getcwd() inconsistency. --- tests/Composer/Test/Repository/PathRepositoryTest.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/Composer/Test/Repository/PathRepositoryTest.php b/tests/Composer/Test/Repository/PathRepositoryTest.php index dc9ac5e91..9e672cf43 100644 --- a/tests/Composer/Test/Repository/PathRepositoryTest.php +++ b/tests/Composer/Test/Repository/PathRepositoryTest.php @@ -96,8 +96,12 @@ class PathRepositoryTest extends TestCase $loader = new ArrayLoader(new VersionParser()); $versionGuesser = null; - $repositoryUrl = implode(DIRECTORY_SEPARATOR, array(__DIR__, 'Fixtures', 'path', 'with-version')); - $relativeUrl = ltrim(substr($repositoryUrl, strlen(getcwd())), DIRECTORY_SEPARATOR); + // realpath() does not fully expand the paths + // PHP Bug https://bugs.php.net/bug.php?id=72642 + $repositoryUrl = implode(DIRECTORY_SEPARATOR, array(realpath(realpath(__DIR__)), 'Fixtures', 'path', 'with-version')); + // getcwd() not necessarily match __DIR__ + // PHP Bug https://bugs.php.net/bug.php?id=73797 + $relativeUrl = ltrim(substr($repositoryUrl, strlen(realpath(realpath(getcwd())))), DIRECTORY_SEPARATOR); $repository = new PathRepository(array('url' => $relativeUrl), $ioInterface, $config, $loader); $packages = $repository->getPackages();