Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
use SebastianBergmann\CodeCoverage\CodeCoverage;
3
use SebastianBergmann\CodeCoverage\Driver\Selector;
4
use PHPUnit\TextUI\XmlConfiguration\Loader;
5
use PHPUnit\TextUI\XmlConfiguration\PhpHandler;
6
 
7
if (!defined('STDOUT')) {
8
    // php://stdout does not obey output buffering. Any output would break
9
    // unserialization of child process results in the parent process.
10
    define('STDOUT', fopen('php://temp', 'w+b'));
11
    define('STDERR', fopen('php://stderr', 'wb'));
12
}
13
 
14
{iniSettings}
15
ini_set('display_errors', 'stderr');
16
set_include_path('{include_path}');
17
 
18
$composerAutoload = {composerAutoload};
19
$phar             = {phar};
20
 
21
ob_start();
22
 
23
if ($composerAutoload) {
24
    require_once $composerAutoload;
25
    define('PHPUNIT_COMPOSER_INSTALL', $composerAutoload);
26
} else if ($phar) {
27
    require $phar;
28
}
29
 
30
function __phpunit_run_isolated_test()
31
{
32
    if (!class_exists('{className}')) {
33
        require_once '{filename}';
34
    }
35
 
36
    $result = new PHPUnit\Framework\TestResult;
37
 
38
    if ({collectCodeCoverageInformation}) {
39
        $filter = unserialize('{codeCoverageFilter}');
40
 
41
        $codeCoverage = new CodeCoverage(
42
            (new Selector)->{driverMethod}($filter),
43
            $filter
44
        );
45
 
46
        if ({cachesStaticAnalysis}) {
47
            $codeCoverage->cacheStaticAnalysis(unserialize('{codeCoverageCacheDirectory}'));
48
        }
49
 
50
        $result->setCodeCoverage($codeCoverage);
51
    }
52
 
53
    $result->beStrictAboutTestsThatDoNotTestAnything({isStrictAboutTestsThatDoNotTestAnything});
54
    $result->beStrictAboutOutputDuringTests({isStrictAboutOutputDuringTests});
55
    $result->enforceTimeLimit({enforcesTimeLimit});
56
    $result->beStrictAboutTodoAnnotatedTests({isStrictAboutTodoAnnotatedTests});
57
    $result->beStrictAboutResourceUsageDuringSmallTests({isStrictAboutResourceUsageDuringSmallTests});
58
 
59
    $test = new {className}('{name}', unserialize('{data}'), '{dataName}');
60
    $test->setDependencyInput(unserialize('{dependencyInput}'));
61
    $test->setInIsolation(TRUE);
62
 
63
    ob_end_clean();
64
    $test->run($result);
65
    $output = '';
66
    if (!$test->hasExpectationOnOutput()) {
67
        $output = $test->getActualOutput();
68
    }
69
 
70
    ini_set('xdebug.scream', '0');
71
    @rewind(STDOUT); /* @ as not every STDOUT target stream is rewindable */
72
    if ($stdout = @stream_get_contents(STDOUT)) {
73
        $output = $stdout . $output;
74
        $streamMetaData = stream_get_meta_data(STDOUT);
75
        if (!empty($streamMetaData['stream_type']) && 'STDIO' === $streamMetaData['stream_type']) {
76
            @ftruncate(STDOUT, 0);
77
            @rewind(STDOUT);
78
        }
79
    }
80
 
81
    print serialize(
82
      [
83
        'testResult'    => $test->getResult(),
84
        'numAssertions' => $test->getNumAssertions(),
85
        'result'        => $result,
86
        'output'        => $output
87
      ]
88
    );
89
}
90
 
91
$configurationFilePath = '{configurationFilePath}';
92
 
93
if ('' !== $configurationFilePath) {
94
    $configuration = (new Loader)->load($configurationFilePath);
95
 
96
    (new PhpHandler)->handle($configuration->php());
97
 
98
    unset($configuration);
99
}
100
 
101
function __phpunit_error_handler($errno, $errstr, $errfile, $errline)
102
{
103
   return true;
104
}
105
 
106
set_error_handler('__phpunit_error_handler');
107
 
108
{constants}
109
{included_files}
110
{globals}
111
 
112
restore_error_handler();
113
 
114
if (isset($GLOBALS['__PHPUNIT_BOOTSTRAP'])) {
115
    require_once $GLOBALS['__PHPUNIT_BOOTSTRAP'];
116
    unset($GLOBALS['__PHPUNIT_BOOTSTRAP']);
117
}
118
 
119
__phpunit_run_isolated_test();