~tcuthbert/wordpress/openstack-objectstorage

« back to all changes in this revision

Viewing changes to vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseMethod.tpl.dist

  • Committer: Jacek Nykis
  • Date: 2015-02-11 15:35:31 UTC
  • Revision ID: jacek.nykis@canonical.com-20150211153531-hmy6zi0ov2qfkl0b
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
if (!defined('STDOUT')) {
 
3
    // php://stdout does not obey output buffering. Any output would break
 
4
    // unserialization of child process results in the parent process.
 
5
    define('STDOUT', fopen('php://temp', 'w+b'));
 
6
    define('STDERR', fopen('php://stderr', 'wb'));
 
7
}
 
8
 
 
9
{iniSettings}
 
10
ini_set('display_errors', 'stderr');
 
11
set_include_path('{include_path}');
 
12
 
 
13
$composerAutoload = {composerAutoload};
 
14
$phar             = {phar};
 
15
 
 
16
ob_start();
 
17
 
 
18
if ($composerAutoload) {
 
19
    require_once $composerAutoload;
 
20
    define('PHPUNIT_COMPOSER_INSTALL', $composerAutoload);
 
21
} else if ($phar) {
 
22
    require $phar;
 
23
}
 
24
 
 
25
function __phpunit_run_isolated_test()
 
26
{
 
27
    if (!class_exists('{className}')) {
 
28
        require_once '{filename}';
 
29
    }
 
30
 
 
31
    $result = new PHPUnit_Framework_TestResult;
 
32
 
 
33
    if ({collectCodeCoverageInformation}) {
 
34
        $result->setCodeCoverage(new PHP_CodeCoverage);
 
35
    }
 
36
 
 
37
    $result->beStrictAboutTestsThatDoNotTestAnything({isStrictAboutTestsThatDoNotTestAnything});
 
38
    $result->beStrictAboutOutputDuringTests({isStrictAboutOutputDuringTests});
 
39
    $result->beStrictAboutTestSize({isStrictAboutTestSize});
 
40
    $result->beStrictAboutTodoAnnotatedTests({isStrictAboutTodoAnnotatedTests});
 
41
 
 
42
    $test = new {className}('{methodName}', unserialize('{data}'), '{dataName}');
 
43
    $test->setDependencyInput(unserialize('{dependencyInput}'));
 
44
    $test->setInIsolation(TRUE);
 
45
 
 
46
    ob_end_clean();
 
47
    $test->run($result);
 
48
    $output = '';
 
49
    if (!$test->hasExpectationOnOutput()) {
 
50
        $output = $test->getActualOutput();
 
51
    }
 
52
 
 
53
    rewind(STDOUT);
 
54
    if ($stdout = stream_get_contents(STDOUT)) {
 
55
        $output = $stdout . $output;
 
56
    }
 
57
 
 
58
    print serialize(
 
59
      array(
 
60
        'testResult'    => $test->getResult(),
 
61
        'numAssertions' => $test->getNumAssertions(),
 
62
        'result'        => $result,
 
63
        'output'        => $output
 
64
      )
 
65
    );
 
66
}
 
67
 
 
68
{constants}
 
69
{included_files}
 
70
{globals}
 
71
 
 
72
if (isset($GLOBALS['__PHPUNIT_BOOTSTRAP'])) {
 
73
    require_once $GLOBALS['__PHPUNIT_BOOTSTRAP'];
 
74
    unset($GLOBALS['__PHPUNIT_BOOTSTRAP']);
 
75
}
 
76
 
 
77
__phpunit_run_isolated_test();