1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
phpunit_test_listener_plain.php
См. документацию.
1<?php
2
3class PHPUnit_Util_Log_BX_Plain extends PHPUnit_Util_Printer implements PHPUnit_Framework_TestListener
4{
8 protected $currentTestSuiteName = '';
9
13 protected $currentTestName = '';
14
19 protected $currentTestPass = true;
20
21 protected $messages;
22
30 public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
31 {
32 $this->writeCase(
33 'error',
34 $time,
35 PHPUnit_Util_Filter::getFilteredStacktrace($e, false),
36 $e->getMessage()." @ ".$e->getFile().":".$e->getLine(),
37 $test
38 );
39
40 $this->currentTestPass = false;
41 }
42
50 public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
51 {
52 $this->write('fail: '.$e->getMessage());
53
54 $trace = current(PHPUnit_Util_Filter::getFilteredStacktrace($e, false));
55 $this->write('trace: '.print_r($trace, 1));
56
57 $this->currentTestPass = false;
58 }
59
67 public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
68 {
69 $this->writeCase('error', $time, array(), 'Incomplete Test', $test);
70
71 $this->currentTestPass = false;
72 }
73
81 public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
82 {
83 $this->writeCase('error', $time, array(), 'Skipped Test', $test);
84
85 $this->currentTestPass = false;
86 }
87
93 public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
94 {
95 $this->currentTestSuiteName = $suite->getName();
96 $this->currentTestName = '';
97
98 $this->write(sprintf('suite started: %s (%d test%s)',
99 $this->currentTestSuiteName,
100 count($suite),
101 count($suite) == 1 ? '' : 's'
102 ));
103 }
104
110 public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
111 {
112 $this->currentTestSuiteName = '';
113 $this->currentTestName = '';
114 }
115
121 public function startTest(PHPUnit_Framework_Test $test)
122 {
123 $this->currentTestName = PHPUnit_Util_Test::describe($test);
124 $this->currentTestPass = true;
125
126 $this->write("\n");
127
128 $this->write(sprintf('test started: %s',
129 $this->currentTestName
130 ));
131 }
132
139 public function endTest(PHPUnit_Framework_Test $test, $time)
140 {
141 if ($this->currentTestPass)
142 {
143 $this->write(sprintf('test passed in %.3f sec.',
144 $time
145 ));
146 }
147
148 echo $test->getActualOutput();
149 }
150
157 protected function writeCase($status, $time, array $trace = array(), $message = '', $test = null)
158 {
159 $output = '';
160
161 if ($test !== null && $test->hasOutput())
162 {
163 $output = $test->getActualOutput();
164 }
165
166 $this->write(
167 array(
168 'event' => 'test',
169 'suite' => $this->currentTestSuiteName,
170 'test' => $this->currentTestName,
171 'status' => $status,
172 'time' => $time,
173 'trace' => $trace,
174 'message' => PHPUnit_Util_String::convertToUtf8($message),
175 'output' => $output,
176 )
177 );
178 }
179
183 public function write($buffer)
184 {
185 $this->messages[] = $buffer;
186 }
187
188 public function getMessages()
189 {
190 return $this->messages;
191 }
192}
startTest(PHPUnit_Framework_Test $test)
addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
Определения phpunit_test_listener_plain.php:81
addError(PHPUnit_Framework_Test $test, Exception $e, $time)
Определения phpunit_test_listener_plain.php:30
addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
Определения phpunit_test_listener_plain.php:50
endTest(PHPUnit_Framework_Test $test, $time)
addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
Определения phpunit_test_listener_plain.php:67
startTestSuite(PHPUnit_Framework_TestSuite $suite)
Определения phpunit_test_listener_plain.php:93
writeCase($status, $time, array $trace=array(), $message='', $test=null)
endTestSuite(PHPUnit_Framework_TestSuite $suite)
if(!defined("ADMIN_AJAX_MODE") &&(($_REQUEST["mode"] ?? '') !='excel')) $buffer
Определения epilog_admin_after.php:40
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$output
Определения options.php:436
$status
Определения session.php:10
$time
Определения payment.php:61
$message
Определения payment.php:8
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936