phpunit 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of PHPUnit.
  5. *
  6. * (c) Sebastian Bergmann <sebastian@phpunit.de>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. if (version_compare('7.0.0', PHP_VERSION, '>')) {
  12. fwrite(
  13. STDERR,
  14. sprintf(
  15. 'This version of PHPUnit is supported on PHP 7.0 and PHP 7.1.' . PHP_EOL .
  16. 'You are using PHP %s (%s).' . PHP_EOL,
  17. PHP_VERSION,
  18. PHP_BINARY
  19. )
  20. );
  21. die(1);
  22. }
  23. if (!ini_get('date.timezone')) {
  24. ini_set('date.timezone', 'UTC');
  25. }
  26. foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
  27. if (file_exists($file)) {
  28. define('PHPUNIT_COMPOSER_INSTALL', $file);
  29. break;
  30. }
  31. }
  32. unset($file);
  33. if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
  34. fwrite(
  35. STDERR,
  36. 'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL .
  37. ' composer install' . PHP_EOL . PHP_EOL .
  38. 'You can learn all about Composer on https://getcomposer.org/.' . PHP_EOL
  39. );
  40. die(1);
  41. }
  42. require PHPUNIT_COMPOSER_INSTALL;
  43. PHPUnit\TextUI\Command::main();