[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/_test/ -> fetchphpunit.php (source)

   1  #!/usr/bin/php
   2  <?php
   3  /**
   4   * Simple command line script to fetch the correct PHPUnit release
   5   */
   6  
   7  $phpVersion = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION;
   8  print "Running PHP $phpVersion\n";
   9  
  10  switch ($phpVersion) {
  11      case '5.6':
  12          $phpunit = 'phpunit-5.phar';
  13          break;
  14      case '7.0':
  15          $phpunit = 'phpunit-6.phar';
  16          break;
  17      case '7.1':
  18      case '7.2':
  19      case '7.3':
  20          $phpunit = 'phpunit-7.phar';
  21          break;
  22      case '7.4':
  23          $phpunit = 'phpunit-7.phar';
  24          // PHP 5 backward compatibility lock to PHPUnit 7 (type hinting)
  25          break;
  26      default:
  27          $phpunit = 'phpunit-7.phar';
  28  
  29  }
  30  
  31  $url = "https://phar.phpunit.de/$phpunit";
  32  $out = __DIR__ . '/phpunit.phar';
  33  
  34  $return = 0;
  35  system("wget '$url' -O '$out'", $return);
  36  if ($return !== 0) exit($return);
  37  
  38  chmod($out, 0755);
  39  print "Downloaded $phpunit\n";
  40  exit(0);