bootstrap.php 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. * @package Gedmo.Tests
  14. * @link http://www.gediminasm.org
  15. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  16. */
  17. define('TESTS_PATH', __DIR__);
  18. define('TESTS_TEMP_DIR', __DIR__ . '/temp');
  19. define('VENDOR_PATH', realpath(__DIR__ . '/../vendor'));
  20. if (!class_exists('PHPUnit_Framework_TestCase') ||
  21. version_compare(PHPUnit_Runner_Version::id(), '3.5') < 0
  22. ) {
  23. die('PHPUnit framework is required, at least 3.5 version');
  24. }
  25. if (!class_exists('PHPUnit_Framework_MockObject_MockBuilder')) {
  26. die('PHPUnit MockObject plugin is required, at least 1.0.8 version');
  27. }
  28. /** @var $loader ClassLoader */
  29. $loader = require __DIR__ . '/../vendor/autoload.php';
  30. $loader->add('Gedmo\\Mapping\\Mock', __DIR__);
  31. $loader->add('Tool', __DIR__ . '/Gedmo');
  32. // fixture namespaces
  33. $loader->add('Translator\\Fixture', __DIR__ . '/Gedmo');
  34. $loader->add('Translatable\\Fixture', __DIR__ . '/Gedmo');
  35. $loader->add('Timestampable\\Fixture', __DIR__ . '/Gedmo');
  36. $loader->add('Blameable\\Fixture', __DIR__.'/Gedmo');
  37. $loader->add('Tree\\Fixture', __DIR__ . '/Gedmo');
  38. $loader->add('Sluggable\\Fixture', __DIR__ . '/Gedmo');
  39. $loader->add('Sortable\\Fixture', __DIR__ . '/Gedmo');
  40. $loader->add('Mapping\\Fixture', __DIR__ . '/Gedmo');
  41. $loader->add('Loggable\\Fixture', __DIR__ . '/Gedmo');
  42. $loader->add('SoftDeleteable\\Fixture', __DIR__ . '/Gedmo');
  43. $loader->add('Uploadable\\Fixture', __DIR__ . '/Gedmo');
  44. $loader->add('Wrapper\\Fixture', __DIR__ . '/Gedmo');
  45. $loader->add('ReferenceIntegrity\\Fixture', __DIR__ . '/Gedmo');
  46. $loader->add('References\\Fixture', __DIR__ . '/Gedmo');
  47. // stubs
  48. $loader->add('Gedmo\\Uploadable\\Stub', __DIR__);
  49. AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
  50. Gedmo\DoctrineExtensions::registerAnnotations();
  51. $reader = new AnnotationReader();
  52. $reader = new CachedReader($reader, new ArrayCache());
  53. $_ENV['annotation_reader'] = $reader;