Merge pull request #3969 from dokuwiki-translate/lang_update_635_1684167422
[dokuwiki.git] / _test / fetchphpunit.php
blob856e423822083c310d3e26ac39269641c34c249c
1 #!/usr/bin/env php
2 <?php
3 /**
4 * Simple command line script to fetch the correct PHPUnit release
5 */
7 $phpVersion = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION;
8 print "Running PHP $phpVersion\n";
11 if(version_compare($phpVersion, '7.2') < 0) {
12 echo 'we no longer support PHP versions < 7.2 and thus do not support tests on them';
13 exit(1);
16 // for now we default to phpunit-8
17 $phpunit = 'phpunit-8.phar';
20 $url = "https://phar.phpunit.de/$phpunit";
21 $out = __DIR__ . '/phpunit.phar';
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);
31 chmod($out, 0755);
32 print "Downloaded $phpunit\n";
33 exit(0);