Forráskód Böngészése

Fix test autoload

Thomas Rabaix 11 éve
szülő
commit
5b8998208f
1 módosított fájl, 15 hozzáadás és 8 törlés
  1. 15 8
      Tests/tests/autoload.php.dist

+ 15 - 8
Tests/tests/autoload.php.dist

@@ -1,16 +1,23 @@
 <?php
 <?php
 
 
 // if the bundle is within a symfony project, try to reuse the project's autoload
 // if the bundle is within a symfony project, try to reuse the project's autoload
-$autoload = __DIR__.'/../../../../../../../app/autoload.php';
 
 
-// if the bundle is the project, try to use the composer's autoload for the tests
-$composerAutoload = __DIR__.'/../../vendor/autoload.php';
+$files = array(
+    __DIR__.'/../../../../../../../app/autoload.php',
+    __DIR__.'/../../../../../../../apps/autoload.php',
+    __DIR__.'/../../vendor/autoload.php',
+);
 
 
-if (is_file($composerAutoload)) {
-    include $composerAutoload;
-} elseif (is_file($autoload)) {
-    include $autoload;
-} else {
+$autoload = false;
+foreach ($files as $file) {
+    if (is_file($file)) {
+        $autoload = include_once $file;
+
+        break;
+    }
+}
+
+if (!$autoload) {
     die('Unable to find autoload.php file, please use composer to load dependencies:
     die('Unable to find autoload.php file, please use composer to load dependencies:
 
 
 wget http://getcomposer.org/composer.phar
 wget http://getcomposer.org/composer.phar