better report format
This commit is contained in:
parent
a922237371
commit
b6ad89e0f3
@ -7,34 +7,33 @@ final class Poster{
|
|||||||
|
|
||||||
function __construct($testdox,$xml){
|
function __construct($testdox,$xml){
|
||||||
$report=file_get_contents($testdox);
|
$report=file_get_contents($testdox);
|
||||||
$this->report=preg_replace('# \[#',' * [',$report);
|
$report=preg_replace('# \[#',' * [',$report);
|
||||||
|
|
||||||
$log=file_get_contents($xml);
|
$xml = simplexml_load_file($xml);
|
||||||
$p = xml_parser_create();
|
$project = $xml->testsuite;
|
||||||
xml_parse_into_struct($p, $log, $vals, $index);
|
//echo sprintf("total: %s msec", ($project['time'])) . PHP_EOL;
|
||||||
xml_parser_free($p);
|
foreach ($project->testsuite as $testsuite) {
|
||||||
$this->vals=$vals;
|
//echo sprintf(" suite: %s msec : %s", ($testsuite['time']), $testsuite['name']) . PHP_EOL;
|
||||||
$this->index=$index;
|
foreach ($testsuite->testcase as $testcase) {
|
||||||
|
//echo sprintf(" case: %s msec : %s", ($testcase['time']), $testcase['name']) . PHP_EOL;
|
||||||
|
foreach($testcase as $k=>$v){
|
||||||
|
$report.="\n```plain\n".print_r($testcase,true)."\n```";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$this->report=$report;
|
||||||
|
}
|
||||||
|
|
||||||
function post($url, $user, $pass, $repoUser, $repo){
|
function post($url, $user, $pass, $repoUser, $repo){
|
||||||
//open connection and repo
|
// open connection and repo
|
||||||
$client=new Client($url, $user, $pass, $repoUser, $repo);
|
$client=new Client($url, $user, $pass, $repoUser, $repo);
|
||||||
$repo=$client->getRepo($repoUser, $repo);
|
$repo=$client->getRepo($repoUser, $repo);
|
||||||
|
|
||||||
//create a test issue
|
// create the issue
|
||||||
$issue=$repo->createIssue([
|
$issue=$repo->createIssue([
|
||||||
'title'=>'Test Results',
|
'title'=>'Test Results',
|
||||||
'body'=>$this->report
|
'body'=>$this->report
|
||||||
]);
|
]);
|
||||||
//$issue->addLabel($label);
|
|
||||||
|
|
||||||
foreach($this->index['FAILURE'] as $id){
|
|
||||||
$msg=$this->vals[$id]['value'];
|
|
||||||
$msg=str_replace('\n','',$msg);
|
|
||||||
$issue->addComment("```plain\n$msg\n```");
|
|
||||||
}
|
|
||||||
|
|
||||||
$issue->save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user