bootstrap.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. use Doctrine\Common\Annotations\AnnotationRegistry;
  3. use Doctrine\Common\Annotations\AnnotationReader;
  4. use Doctrine\Common\Annotations\CachedReader;
  5. use Doctrine\Common\Cache\ArrayCache;
  6. use Composer\Autoload\ClassLoader;
  7. /**
  8. * This is bootstrap for phpUnit unit tests,
  9. * use README.md for more details
  10. *
  11. * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  12. * @author Christoph Krämer <cevou@gmx.de>
  13. * @link http://www.gediminasm.org
  14. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  15. */
  16. define('TESTS_PATH', __DIR__);
  17. define('TESTS_TEMP_DIR', __DIR__ . '/temp');
  18. define('VENDOR_PATH', realpath(__DIR__ . '/../vendor'));
  19. if (!class_exists('PHPUnit_Framework_TestCase') ||
  20. version_compare(PHPUnit_Runner_Version::id(), '3.5') < 0
  21. ) {
  22. die('PHPUnit framework is required, at least 3.5 version');
  23. }
  24. if (!class_exists('PHPUnit_Framework_MockObject_MockBuilder')) {
  25. die('PHPUnit MockObject plugin is required, at least 1.0.8 version');
  26. }
  27. /** @var $loader ClassLoader */
  28. $loader = require __DIR__ . '/../vendor/autoload.php';
  29. $loader->add('Gedmo\\Mapping\\Mock', __DIR__);
  30. $loader->add('Tool', __DIR__ . '/Gedmo');
  31. // fixture namespaces
  32. $loader->add('Translator\\Fixture', __DIR__ . '/Gedmo');
  33. $loader->add('Translatable\\Fixture', __DIR__ . '/Gedmo');
  34. $loader->add('Timestampable\\Fixture', __DIR__ . '/Gedmo');
  35. $loader->add('Blameable\\Fixture', __DIR__.'/Gedmo');
  36. $loader->add('Tree\\Fixture', __DIR__ . '/Gedmo');
  37. $loader->add('Sluggable\\Fixture', __DIR__ . '/Gedmo');
  38. $loader->add('Sortable\\Fixture', __DIR__ . '/Gedmo');
  39. $loader->add('Mapping\\Fixture', __DIR__ . '/Gedmo');
  40. $loader->add('Loggable\\Fixture', __DIR__ . '/Gedmo');
  41. $loader->add('SoftDeleteable\\Fixture', __DIR__ . '/Gedmo');
  42. $loader->add('Uploadable\\Fixture', __DIR__ . '/Gedmo');
  43. $loader->add('Wrapper\\Fixture', __DIR__ . '/Gedmo');
  44. $loader->add('ReferenceIntegrity\\Fixture', __DIR__ . '/Gedmo');
  45. $loader->add('References\\Fixture', __DIR__ . '/Gedmo');
  46. // stubs
  47. $loader->add('Gedmo\\Uploadable\\Stub', __DIR__);
  48. AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
  49. Gedmo\DoctrineExtensions::registerAnnotations();
  50. $reader = new AnnotationReader();
  51. $reader = new CachedReader($reader, new ArrayCache());
  52. $_ENV['annotation_reader'] = $reader;