1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 02:32:42 +01:00

Allow linking unit tests

Summary:
We have lots of info about unit tests.
This allows linking them from Unit field.

Test Plan: Monkey patched `$test['link']`, clicked on it.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3434
This commit is contained in:
vrana 2012-09-04 20:44:02 -07:00
parent 8ff52c0b6c
commit 9b843a3d44
2 changed files with 15 additions and 1 deletions

View file

@ -31,6 +31,7 @@ final class ConduitAPI_differential_updateunitresults_Method
'diff_id' => 'required diff_id',
'file' => 'required string',
'name' => 'required string',
'link' => 'optional string',
'result' => 'required string',
'message' => 'required string',
'coverage' => 'optional map<string, string>',
@ -57,6 +58,7 @@ final class ConduitAPI_differential_updateunitresults_Method
$file = $request->getValue('file');
$name = $request->getValue('name');
$link = $request->getValue('link');
$message = $request->getValue('message');
$result = $request->getValue('result');
$coverage = $request->getValue('coverage', array());
@ -83,6 +85,7 @@ final class ConduitAPI_differential_updateunitresults_Method
$unit_result['name'] === $file ||
$unit_result['name'] === $diff->getSourcePath().$file) {
$unit_result['name'] = $name;
$unit_result['link'] = $link;
$unit_result['file'] = $file;
$unit_result['result'] = $result;
$unit_result['userdata'] = $message;
@ -98,6 +101,7 @@ final class ConduitAPI_differential_updateunitresults_Method
$unit_result = array();
$unit_result['file'] = $file;
$unit_result['name'] = $name;
$unit_result['link'] = $link;
$unit_result['result'] = $result;
$unit_result['userdata'] = $message;
$unit_result['coverage'] = $coverage;

View file

@ -101,10 +101,20 @@ final class DifferentialUnitFieldSpecification
$hidden[$result]++;
}
$value = phutil_escape_html(idx($test, 'name'));
if (!empty($test['link'])) {
$value = phutil_render_tag(
'a',
array(
'href' => $test['link'],
'target' => '_blank',
),
$value);
}
$rows[] = array(
'style' => $this->getResultStyle($result),
'name' => phutil_escape_html(ucwords($result)),
'value' => phutil_escape_html(idx($test, 'name')),
'value' => $value,
'show' => $show,
);