| 148 |
lars |
1 |
<?php declare(strict_types=1);
|
|
|
2 |
/*
|
|
|
3 |
* This file is part of PHPUnit.
|
|
|
4 |
*
|
|
|
5 |
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
|
|
6 |
*
|
|
|
7 |
* For the full copyright and license information, please view the LICENSE
|
|
|
8 |
* file that was distributed with this source code.
|
|
|
9 |
*/
|
|
|
10 |
namespace PHPUnit\TextUI\XmlConfiguration;
|
|
|
11 |
|
|
|
12 |
use function str_replace;
|
|
|
13 |
|
|
|
14 |
/**
|
|
|
15 |
* @internal This class is not covered by the backward compatibility promise for PHPUnit
|
|
|
16 |
*/
|
|
|
17 |
final class Generator
|
|
|
18 |
{
|
|
|
19 |
/**
|
|
|
20 |
* @var string
|
|
|
21 |
*/
|
|
|
22 |
private const TEMPLATE = <<<'EOT'
|
|
|
23 |
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
24 |
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
|
25 |
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/{phpunit_version}/phpunit.xsd"
|
|
|
26 |
bootstrap="{bootstrap_script}"
|
|
|
27 |
cacheResultFile="{cache_directory}/test-results"
|
|
|
28 |
executionOrder="depends,defects"
|
|
|
29 |
forceCoversAnnotation="true"
|
|
|
30 |
beStrictAboutCoversAnnotation="true"
|
|
|
31 |
beStrictAboutOutputDuringTests="true"
|
|
|
32 |
beStrictAboutTodoAnnotatedTests="true"
|
|
|
33 |
convertDeprecationsToExceptions="true"
|
|
|
34 |
failOnRisky="true"
|
|
|
35 |
failOnWarning="true"
|
|
|
36 |
verbose="true">
|
|
|
37 |
<testsuites>
|
|
|
38 |
<testsuite name="default">
|
|
|
39 |
<directory>{tests_directory}</directory>
|
|
|
40 |
</testsuite>
|
|
|
41 |
</testsuites>
|
|
|
42 |
|
|
|
43 |
<coverage cacheDirectory="{cache_directory}/code-coverage"
|
|
|
44 |
processUncoveredFiles="true">
|
|
|
45 |
<include>
|
|
|
46 |
<directory suffix=".php">{src_directory}</directory>
|
|
|
47 |
</include>
|
|
|
48 |
</coverage>
|
|
|
49 |
</phpunit>
|
|
|
50 |
|
|
|
51 |
EOT;
|
|
|
52 |
|
|
|
53 |
public function generateDefaultConfiguration(string $phpunitVersion, string $bootstrapScript, string $testsDirectory, string $srcDirectory, string $cacheDirectory): string
|
|
|
54 |
{
|
|
|
55 |
return str_replace(
|
|
|
56 |
[
|
|
|
57 |
'{phpunit_version}',
|
|
|
58 |
'{bootstrap_script}',
|
|
|
59 |
'{tests_directory}',
|
|
|
60 |
'{src_directory}',
|
|
|
61 |
'{cache_directory}',
|
|
|
62 |
],
|
|
|
63 |
[
|
|
|
64 |
$phpunitVersion,
|
|
|
65 |
$bootstrapScript,
|
|
|
66 |
$testsDirectory,
|
|
|
67 |
$srcDirectory,
|
|
|
68 |
$cacheDirectory,
|
|
|
69 |
],
|
|
|
70 |
self::TEMPLATE
|
|
|
71 |
);
|
|
|
72 |
}
|
|
|
73 |
}
|