bootstrap.php 874 B

12345678910111213141516171819202122232425262728293031
  1. <?php declare(strict_types=1);
  2. /**
  3. * phpunit
  4. * // output coverage without xdebug
  5. * phpdbg -dauto_globals_jit=Off -qrr /usr/local/bin/phpunit --coverage-text
  6. */
  7. error_reporting(E_ALL);
  8. date_default_timezone_set('Asia/Shanghai');
  9. $libDir = dirname(__DIR__);
  10. $npMap = [
  11. 'Inhere\\Validate\\' => $libDir . '/src/',
  12. 'Inhere\\ValidateTest\\' => $libDir . '/test/',
  13. ];
  14. spl_autoload_register(static function ($class) use ($npMap) {
  15. foreach ($npMap as $np => $dir) {
  16. $file = $dir . str_replace('\\', '/', substr($class, strlen($np))) . '.php';
  17. if (file_exists($file)) {
  18. include $file;
  19. }
  20. }
  21. });
  22. if (is_file(dirname(__DIR__, 3) . '/autoload.php')) {
  23. require dirname(__DIR__, 3) . '/autoload.php';
  24. } elseif (is_file(dirname(__DIR__) . '/vendor/autoload.php')) {
  25. require dirname(__DIR__) . '/vendor/autoload.php';
  26. }