[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/_test/ -> fetchphpunit.php (source)

   1  #!/usr/bin/env 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  
  11  if(version_compare($phpVersion, '7.4') < 0) {
  12      echo 'we no longer support PHP versions < 7.4 and thus do not support tests on them';
  13      exit(1);
  14  }
  15  
  16  // for now we default to phpunit-8
  17  $phpunit = 'phpunit-8.phar';
  18  
  19  
  20  $url = "https://phar.phpunit.de/$phpunit";
  21  $out = __DIR__ . '/phpunit.phar';
  22  
  23  $return = 0;
  24  try {
  25      file_put_contents($out, file_get_contents($url));
  26  } catch (Throwable $e) {
  27      fwrite(STDERR, $e->getMessage());
  28      exit(1);
  29  }
  30  
  31  chmod($out, 0755);
  32  print "Downloaded $phpunit\n";
  33  exit(0);