forked from symfony/symfony
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpunit
More file actions
executable file
·54 lines (51 loc) · 2.36 KB
/
Copy pathphpunit
File metadata and controls
executable file
·54 lines (51 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env php
<?php
if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\nPlease run `composer update` before running this command.\n";
exit(1);
}
if (!getenv('SYMFONY_PHPUNIT_VERSION')) {
if (\PHP_VERSION_ID >= 80300) {
if (\PHP_VERSION_ID >= 80401) {
putenv('SYMFONY_PHPUNIT_VERSION=13');
if (!in_array('--fail-on-empty-test-suite', $_SERVER['argv'], true) && !in_array('--do-not-fail-on-empty-test-suite', $_SERVER['argv'], true)) {
$_SERVER['argv'][] = '--do-not-fail-on-empty-test-suite';
}
} else {
putenv('SYMFONY_PHPUNIT_VERSION=12');
}
if (!in_array('--fail-on-phpunit-notice', $_SERVER['argv'], true) && !in_array('--do-not-fail-on-phpunit-notice', $_SERVER['argv'], true)) {
$_SERVER['argv'][] = '--fail-on-phpunit-notice';
}
} else {
putenv('SYMFONY_PHPUNIT_VERSION=11.5');
}
}
(static function () {
if (version_compare(getenv('SYMFONY_PHPUNIT_VERSION'), '13', '>=') || !is_file($file = realpath('./phpunit.xml.dist'))) {
return;
}
$target = substr($file, 0, -5);
$content = file_get_contents($file);
$content = str_replace('<deprecationTrigger ignoreUndefinedTriggers="true">', '<deprecationTrigger>', $content);
if (version_compare(getenv('SYMFONY_PHPUNIT_VERSION'), '12', '<')) {
$content = str_replace('<function>trigger_deprecation</function>', '', $content);
$content = str_replace('<method>Doctrine\Deprecations\Deprecation::trigger</method>', '', $content);
$content = str_replace('<method>Doctrine\Deprecations\Deprecation::triggerIfCalledFromOutside</method>', '', $content);
}
$lock = fopen($file, 'r');
flock($lock, LOCK_EX);
if (!is_file($target) || file_get_contents($target) !== $content) {
file_put_contents($target, $content);
}
flock($lock, LOCK_UN);
fclose($lock);
})();
if (!getenv('SYMFONY_PATCH_TYPE_DECLARATIONS')) {
putenv('SYMFONY_PATCH_TYPE_DECLARATIONS=deprecations=1');
}
if (getcwd() === realpath(__DIR__.'/src/Symfony/Bridge/PhpUnit')) {
putenv('SYMFONY_DEPRECATIONS_HELPER=disabled');
}
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
require __DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';