1 | <?php |
||
10 | class TestHelper |
||
11 | { |
||
12 | /** |
||
13 | * @var int |
||
14 | */ |
||
15 | protected $exitCode = 0; |
||
16 | |||
17 | public function __construct($testName) |
||
23 | |||
24 | /** |
||
25 | * @return int |
||
26 | */ |
||
27 | public function getExitCode() |
||
31 | |||
32 | /** |
||
33 | * @return $this |
||
34 | */ |
||
35 | public function resetExitCode() |
||
41 | |||
42 | /** |
||
43 | * @param string $string |
||
44 | * @return $this |
||
45 | */ |
||
46 | public function printSkipText($string) |
||
52 | |||
53 | /** |
||
54 | * @param string $string |
||
55 | * @return $this |
||
56 | */ |
||
57 | public function printPassText($string) |
||
63 | |||
64 | /** |
||
65 | * @param string $string |
||
66 | * @return $this |
||
67 | */ |
||
68 | public function printFailText($string) |
||
75 | |||
76 | /** |
||
77 | * @param int $count |
||
78 | * @return $this |
||
79 | */ |
||
80 | public function printNewLine($count = 1) |
||
88 | |||
89 | /** |
||
90 | * @param $string |
||
91 | * @param bool $strtoupper |
||
92 | * @return $this |
||
93 | */ |
||
94 | public function printText($string, $strtoupper = false) |
||
104 | |||
105 | /** |
||
106 | * @return void |
||
107 | */ |
||
108 | public function terminateTest() |
||
112 | } |
An exit expression should only be used in rare cases. For example, if you write a short command line script.
In most cases however, using an
exit
expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.