|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Paraunit\Tests\Stub\PHPUnitOutput\JSONLogs; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Class JSONLogStub |
|
7
|
|
|
* @package Paraunit\Tests\Stub\PHPUnitOutput\JSONLogs |
|
8
|
|
|
*/ |
|
9
|
|
|
class JSONLogStub |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* @param string $jsonString The dirty output |
|
13
|
|
|
* @return string The normalized log, as an array of JSON objects |
|
14
|
|
|
*/ |
|
15
|
|
|
public static function cleanLog($jsonString) |
|
16
|
|
|
{ |
|
17
|
|
|
$splitted = preg_replace('/\}\{/', '},{', $jsonString); |
|
18
|
|
|
|
|
19
|
|
|
return '[' . $splitted . ']'; |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
public static function get2Errors2Failures() |
|
23
|
|
|
{ |
|
24
|
|
|
return self::getOutputFileContent('2Errors2Failures'); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public static function getAllGreen() |
|
28
|
|
|
{ |
|
29
|
|
|
return self::getOutputFileContent('AllGreen'); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public static function getFatalError() |
|
33
|
|
|
{ |
|
34
|
|
|
return self::getOutputFileContent('FatalError'); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
public static function getSegFault() |
|
38
|
|
|
{ |
|
39
|
|
|
return self::getOutputFileContent('SegFault'); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public static function getSingleError() |
|
43
|
|
|
{ |
|
44
|
|
|
return self::getOutputFileContent('SingleError'); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public static function getSingleIncomplete() |
|
48
|
|
|
{ |
|
49
|
|
|
return self::getOutputFileContent('SingleIncomplete'); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public static function getSingleRisky() |
|
53
|
|
|
{ |
|
54
|
|
|
return self::getOutputFileContent('SingleRisky'); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public static function getSingleSkip() |
|
58
|
|
|
{ |
|
59
|
|
|
return self::getOutputFileContent('SingleSkip'); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public static function getSingleWarning() |
|
63
|
|
|
{ |
|
64
|
|
|
return self::getOutputFileContent('SingleWarning'); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @param $filename |
|
69
|
|
|
* |
|
70
|
|
|
* @return string |
|
71
|
|
|
*/ |
|
72
|
|
|
protected static function getOutputFileContent($filename) |
|
73
|
|
|
{ |
|
74
|
|
|
return file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . $filename . '.json'); |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|