1 | <?php |
||
13 | class TestCase |
||
14 | { |
||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | public $name; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | public $class; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | public $file; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | public $line; |
||
34 | |||
35 | /** |
||
36 | * @var int |
||
37 | */ |
||
38 | public $assertions; |
||
39 | |||
40 | /** |
||
41 | * @var string |
||
42 | */ |
||
43 | public $time; |
||
44 | |||
45 | /** |
||
46 | * Number of failures in this test case |
||
47 | * |
||
48 | * @var array |
||
49 | */ |
||
50 | public $failures = array(); |
||
51 | |||
52 | /** |
||
53 | * Number of errors in this test case |
||
54 | * |
||
55 | * @var array |
||
56 | */ |
||
57 | public $errors = array(); |
||
58 | |||
59 | 51 | public function __construct( |
|
60 | $name, |
||
61 | $class, |
||
62 | $file, |
||
63 | $line, |
||
64 | $assertions, |
||
65 | $time |
||
66 | ) { |
||
67 | 51 | $this->name = $name; |
|
68 | 51 | $this->class = $class; |
|
69 | 51 | $this->file = $file; |
|
70 | 51 | $this->line = $line; |
|
71 | 51 | $this->assertions = $assertions; |
|
72 | 51 | $this->time = $time; |
|
73 | 51 | } |
|
74 | |||
75 | /** |
||
76 | * @param string $type |
||
77 | * @param string $text |
||
78 | */ |
||
79 | 45 | public function addFailure($type, $text) |
|
83 | |||
84 | /** |
||
85 | * @param string $type |
||
86 | * @param string $text |
||
87 | */ |
||
88 | 46 | public function addError($type, $text) |
|
92 | |||
93 | /** |
||
94 | * Add a defect type (error or failure) |
||
95 | * |
||
96 | * @param string $collName the name of the collection to add to |
||
97 | * @param $type |
||
98 | * @param $text |
||
99 | */ |
||
100 | 46 | protected function addDefect($collName, $type, $text) |
|
107 | |||
108 | /** |
||
109 | * Factory method that creates a TestCase object |
||
110 | * from a SimpleXMLElement |
||
111 | * |
||
112 | * @param \SimpleXMLElement $node |
||
113 | * @return TestCase |
||
114 | */ |
||
115 | 51 | public static function caseFromNode(\SimpleXMLElement $node) |
|
135 | } |
||
136 |