/** * 生成测试用例table * @param TestCase $testCase * @return ReportTable */ protected function getTestCaseTable(TestCase $testCase) { //计算测试用例数据 $table = new ReportTable(); $table->setHeaders([__('Test Method'), __('Test Result'), __('Messages')]); $rows = []; foreach ($testCase->getTestCaseReport()->getTestMethodReports() as $testMethodReport) { $rows[] = [$testMethodReport->getMethod()->getName(), $testMethodReport->getTestResult() ? __('Success') : __('Failed'), implode(PHP_EOL, $testMethodReport->getMessages()) ?: 'None']; } $table->setRows($rows); return $table; }