bootstrap.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 DoctrineExtensions.Translatable
  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') || !strlen(DOCTRINE_LIBRARY_PATH)) {
  16. die('path to doctrine library must be defined in phpunit.xml configuration');
  17. }
  18. set_include_path(implode(PATH_SEPARATOR, array(
  19. realpath(DOCTRINE_LIBRARY_PATH),
  20. get_include_path(),
  21. )));
  22. !defined('DS') && define('DS', DIRECTORY_SEPARATOR);
  23. !defined('TESTS_PATH') && define('TESTS_PATH', __DIR__);
  24. $classLoaderFile = DOCTRINE_LIBRARY_PATH . DS . 'Doctrine/Common/ClassLoader.php';
  25. if (!file_exists($classLoaderFile)) {
  26. die('cannot find doctrine classloader, check the library path');
  27. }
  28. require_once $classLoaderFile;
  29. $classLoader = new Doctrine\Common\ClassLoader('Doctrine');
  30. $classLoader->register();
  31. $classLoader = new Doctrine\Common\ClassLoader('DoctrineExtensions', __DIR__ . '/../lib');
  32. $classLoader->register();