bootstrap.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * This is bootstrap for phpUnit unit tests,
  4. * make sure that your doctrine library structure looks like:
  5. * /Doctrine
  6. * /ORM
  7. * /DBAL
  8. * /Common
  9. *
  10. * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  11. * @package Gedmo.Tests
  12. * @link http://www.gediminasm.org
  13. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  14. */
  15. if (!defined('DOCTRINE_LIBRARY_PATH')) {
  16. die('path to doctrine library must be defined in phpunit.xml configuration');
  17. }
  18. // if empty string given, assume its in include path allready
  19. if (strlen(DOCTRINE_LIBRARY_PATH)) {
  20. set_include_path(implode(PATH_SEPARATOR, array(
  21. realpath(DOCTRINE_LIBRARY_PATH),
  22. get_include_path(),
  23. )));
  24. }
  25. !defined('DS') && define('DS', DIRECTORY_SEPARATOR);
  26. !defined('TESTS_PATH') && define('TESTS_PATH', __DIR__);
  27. $classLoaderFile = 'Doctrine/Common/ClassLoader.php';
  28. if (strlen(DOCTRINE_LIBRARY_PATH)) {
  29. $classLoaderFile = DOCTRINE_LIBRARY_PATH . DS . $classLoaderFile;
  30. if (!file_exists($classLoaderFile)) {
  31. die('cannot find doctrine classloader, check the library path');
  32. }
  33. }
  34. require_once $classLoaderFile;
  35. $classLoader = new Doctrine\Common\ClassLoader('Doctrine');
  36. $classLoader->register();
  37. $classLoader = new Doctrine\Common\ClassLoader('Symfony', 'Doctrine');
  38. $classLoader->register();
  39. $classLoader = new Doctrine\Common\ClassLoader('Gedmo', __DIR__ . '/../lib');
  40. $classLoader->register();