Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Correctly handle relative paths for namespaces in PHPUnit bootstrap

  • Loading branch information...
commit 6b33d39b50c8df4d515c14d40f74eeec2b3b8fff 1 parent d6ed535
@mrtorrent mrtorrent authored
Showing with 12 additions and 1 deletion.
  1. +11 −0 Tests/bootstrap.php
  2. +1 −1  phpunit.xml.dist
View
11 Tests/bootstrap.php
@@ -8,6 +8,17 @@
}
});
+foreach (array('SYMFONY', 'DOCTRINE_COMMON', 'DOCTRINE_ORM') as $component) {
+ if (!isset($_SERVER[$component])) {
+ throw new \RuntimeException("You must set the {$component} path");
+ }
+
+ if (0 === strpos($_SERVER[$component], '..')) {
+ # The path is relative to phpunit.xml, so get the absolute path
+ $_SERVER[$component] = realpath(__DIR__ . "/../{$_SERVER[$component]}");
+ }
+}
+
require_once $_SERVER['SYMFONY'].'/Symfony/Component/ClassLoader/UniversalClassLoader.php';
$loader = new Symfony\Component\ClassLoader\UniversalClassLoader();
View
2  phpunit.xml.dist
@@ -2,7 +2,7 @@
<phpunit bootstrap="Tests/bootstrap.php">
<php>
- <!-- override these paths in your phpunit.xml if necessary -->
+ <!-- override these paths in your phpunit.xml if necessary, relative to this directory -->
<server name="SYMFONY" value="../../../symfony/src" />
<server name="DOCTRINE_COMMON" value="../../../doctrine-common/lib" />
<server name="DOCTRINE_ORM" value="../../../doctrine/lib" />
Please sign in to comment.
Something went wrong with that request. Please try again.