本文整理汇总了PHP中DifferentialDiff::getUnitStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP DifferentialDiff::getUnitStatus方法的具体用法?PHP DifferentialDiff::getUnitStatus怎么用?PHP DifferentialDiff::getUnitStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DifferentialDiff
的用法示例。
在下文中一共展示了DifferentialDiff::getUnitStatus方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderDiffPropertyViewValue
public function renderDiffPropertyViewValue(DifferentialDiff $diff)
{
$colors = array(DifferentialUnitStatus::UNIT_NONE => 'grey', DifferentialUnitStatus::UNIT_OKAY => 'green', DifferentialUnitStatus::UNIT_WARN => 'yellow', DifferentialUnitStatus::UNIT_FAIL => 'red', DifferentialUnitStatus::UNIT_SKIP => 'blue', DifferentialUnitStatus::UNIT_AUTO_SKIP => 'blue');
$icon_color = idx($colors, $diff->getUnitStatus(), 'grey');
$message = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff->getUnitStatus());
$status = id(new PHUIStatusListView())->addItem(id(new PHUIStatusItemView())->setIcon(PHUIStatusItemView::ICON_STAR, $icon_color)->setTarget($message));
return $status;
}
示例2: renderHarbormasterStatus
protected function renderHarbormasterStatus(DifferentialDiff $diff, array $messages)
{
$colors = array(DifferentialUnitStatus::UNIT_NONE => 'grey', DifferentialUnitStatus::UNIT_OKAY => 'green', DifferentialUnitStatus::UNIT_WARN => 'yellow', DifferentialUnitStatus::UNIT_FAIL => 'red', DifferentialUnitStatus::UNIT_SKIP => 'blue', DifferentialUnitStatus::UNIT_AUTO_SKIP => 'blue', DifferentialUnitStatus::UNIT_POSTPONED => 'blue');
$icon_color = idx($colors, $diff->getUnitStatus(), 'grey');
$message = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff);
$note = array();
$groups = mgroup($messages, 'getResult');
$groups = array_select_keys($groups, array(ArcanistUnitTestResult::RESULT_FAIL, ArcanistUnitTestResult::RESULT_BROKEN, ArcanistUnitTestResult::RESULT_UNSOUND, ArcanistUnitTestResult::RESULT_SKIP, ArcanistUnitTestResult::RESULT_PASS)) + $groups;
foreach ($groups as $result => $group) {
$count = new PhutilNumber(count($group));
switch ($result) {
case ArcanistUnitTestResult::RESULT_PASS:
$note[] = pht('%s Passed Test(s)', $count);
break;
case ArcanistUnitTestResult::RESULT_FAIL:
$note[] = pht('%s Failed Test(s)', $count);
break;
case ArcanistUnitTestResult::RESULT_SKIP:
$note[] = pht('%s Skipped Test(s)', $count);
break;
case ArcanistUnitTestResult::RESULT_BROKEN:
$note[] = pht('%s Broken Test(s)', $count);
break;
case ArcanistUnitTestResult::RESULT_UNSOUND:
$note[] = pht('%s Unsound Test(s)', $count);
break;
default:
$note[] = pht('%s Other Test(s)', $count);
break;
}
}
$buildable = $diff->getBuildable();
if ($buildable) {
$full_results = '/harbormaster/unit/' . $buildable->getID() . '/';
$note[] = phutil_tag('a', array('href' => $full_results), pht('View Full Results'));
}
$excuse = $diff->getProperty('arc:unit-excuse');
if (strlen($excuse)) {
$excuse = array(phutil_tag('strong', array(), pht('Excuse:')), ' ', phutil_escape_html_newlines($excuse));
$note[] = $excuse;
}
$note = phutil_implode_html(" · ", $note);
$status = id(new PHUIStatusListView())->addItem(id(new PHUIStatusItemView())->setIcon(PHUIStatusItemView::ICON_STAR, $icon_color)->setTarget($message)->setNote($note));
return $status;
}
示例3: getDiffUnitMessage
public static function getDiffUnitMessage(DifferentialDiff $diff)
{
switch ($diff->getUnitStatus()) {
case DifferentialUnitStatus::UNIT_NONE:
return pht('No Unit Test Coverage');
case DifferentialUnitStatus::UNIT_OKAY:
return pht('Unit Tests OK');
case DifferentialUnitStatus::UNIT_WARN:
return pht('Unit Test Warnings');
case DifferentialUnitStatus::UNIT_FAIL:
return pht('Unit Test Errors');
case DifferentialUnitStatus::UNIT_SKIP:
return pht('Unit Tests Skipped');
case DifferentialUnitStatus::UNIT_AUTO_SKIP:
return pht('Automatic diff as part of commit; unit tests not applicable.');
case DifferentialUnitStatus::UNIT_POSTPONED:
return pht('Unit Tests Postponed');
}
return '???';
}
示例4: getDiffUnitMessage
public static function getDiffUnitMessage(DifferentialDiff $diff)
{
switch ($diff->getUnitStatus()) {
case DifferentialUnitStatus::UNIT_NONE:
return 'No Unit Test Coverage';
case DifferentialUnitStatus::UNIT_OKAY:
return 'Unit Tests OK';
case DifferentialUnitStatus::UNIT_WARN:
return 'Unit Test Warnings';
case DifferentialUnitStatus::UNIT_FAIL:
return 'Unit Test Errors';
case DifferentialUnitStatus::UNIT_SKIP:
return 'Unit Tests Skipped';
case DifferentialUnitStatus::UNIT_POSTPONED:
return 'Unit Tests Postponed';
}
return '???';
}