Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 991 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
#!/usr/bin/env php
2
<?php declare(strict_types=1);
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
 
12
if (!version_compare(PHP_VERSION, PHP_VERSION, '=')) {
13
    fwrite(
14
        STDERR,
15
        sprintf(
16
            '%s declares an invalid value for PHP_VERSION.' . PHP_EOL .
17
            'This breaks fundamental functionality such as version_compare().' . PHP_EOL .
18
            'Please use a different PHP interpreter.' . PHP_EOL,
19
 
20
            PHP_BINARY
21
        )
22
    );
23
 
24
    die(1);
25
}
26
 
27
if (version_compare('7.3.0', PHP_VERSION, '>')) {
28
    fwrite(
29
        STDERR,
30
        sprintf(
31
            'This version of PHPUnit requires PHP >= 7.3.' . PHP_EOL .
32
            'You are using PHP %s (%s).' . PHP_EOL,
33
            PHP_VERSION,
34
            PHP_BINARY
35
        )
36
    );
37
 
38
    die(1);
39
}
40
 
991 lars 41
$requiredExtensions = ['dom', 'json', 'libxml', 'mbstring', 'tokenizer', 'xml', 'xmlwriter'];
42
 
43
$unavailableExtensions = array_filter(
44
    $requiredExtensions,
45
    static function ($extension) {
46
        return !extension_loaded($extension);
148 lars 47
    }
991 lars 48
);
148 lars 49
 
991 lars 50
if ([] !== $unavailableExtensions) {
148 lars 51
    fwrite(
52
        STDERR,
53
        sprintf(
991 lars 54
            'PHPUnit requires the "%s" extensions, but the "%s" %s not available.' . PHP_EOL,
55
            implode('", "', $requiredExtensions),
1464 lars 56
            implode('", "', $unavailableExtensions),
57
            count($unavailableExtensions) === 1 ? 'extension is' : 'extensions are'
148 lars 58
        )
59
    );
60
 
61
    die(1);
62
}
63
 
991 lars 64
unset($requiredExtensions, $unavailableExtensions);
65
 
148 lars 66
if (!ini_get('date.timezone')) {
67
    ini_set('date.timezone', 'UTC');
68
}
69
 
70
if (isset($GLOBALS['_composer_autoload_path'])) {
71
    define('PHPUNIT_COMPOSER_INSTALL', $GLOBALS['_composer_autoload_path']);
72
 
73
    unset($GLOBALS['_composer_autoload_path']);
74
} else {
75
    foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
76
        if (file_exists($file)) {
77
            define('PHPUNIT_COMPOSER_INSTALL', $file);
78
 
79
            break;
80
        }
81
    }
82
 
83
    unset($file);
84
}
85
 
86
if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
87
    fwrite(
88
        STDERR,
89
        'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL .
90
        '    composer install' . PHP_EOL . PHP_EOL .
91
        'You can learn all about Composer on https://getcomposer.org/.' . PHP_EOL
92
    );
93
 
94
    die(1);
95
}
96
 
97
$options = getopt('', array('prepend:'));
98
 
99
if (isset($options['prepend'])) {
100
    require $options['prepend'];
101
}
102
 
103
unset($options);
104
 
105
require PHPUNIT_COMPOSER_INSTALL;
106
 
107
PHPUnit\TextUI\Command::main();