PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/bootstrap.php

https://github.com/adrienbrault/metadata
PHP | 36 lines | 23 code | 7 blank | 6 comment | 7 complexity | a64c8ef1982f1d3fb1b38b9065bfce91 MD5 | raw file
Possible License(s): Apache-2.0
  1. <?php
  2. /*
  3. * This file is part of the Metadata library.
  4. *
  5. * (C) 2011 Johannes M. Schmitt <schmittjoh@gmail.com>
  6. *
  7. */
  8. spl_autoload_register(function($class) {
  9. if (0 === strpos($class, 'Metadata\Tests\\')) {
  10. $path = __DIR__.'/../tests/'.strtr($class, '\\', '/').'.php';
  11. if (file_exists($path) && is_readable($path)) {
  12. require_once $path;
  13. return true;
  14. }
  15. } elseif (0 === strpos($class, 'Metadata\\')) {
  16. $path = __DIR__.'/../src/'.($class = strtr($class, '\\', '/')).'.php';
  17. if (file_exists($path) && is_readable($path)) {
  18. require_once $path;
  19. return true;
  20. }
  21. } elseif (0 === strpos($class, 'Symfony\\')) {
  22. $path = __DIR__.'/../../symfony/src/'.strtr($class, '\\', '/').'.php';
  23. if (file_exists($path) && is_readable($path)) {
  24. require_once $path;
  25. return true;
  26. }
  27. }
  28. });
  29. @include __DIR__ . '/../vendor/.composer/autoload.php';