]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Added test namespace field to `ArcanistUnitTestResult`
authorJoshua Spence <josh@joshuaspence.com>
Mon, 13 Jan 2014 20:35:33 +0000 (12:35 -0800)
committerepriestley <git@epriestley.com>
Mon, 13 Jan 2014 20:37:26 +0000 (12:37 -0800)
Summary: See https://github.com/facebook/libphutil/issues/34

Test Plan: Run `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran
Differential Revision: https://secure.phabricator.com/D7952

src/unit/ArcanistUnitTestResult.php
src/unit/engine/phutil/ArcanistPhutilTestCase.php
src/unit/renderer/ArcanistUnitConsoleRenderer.php

index a004ee688491e08266cb066a2200885a8079bdd9..a1cd34a80fb37f5e41af1b9922ea7979f8dab2b7 100644 (file)
@@ -14,6 +14,7 @@ final class ArcanistUnitTestResult {
   const RESULT_UNSOUND      = 'unsound';
   const RESULT_POSTPONED    = 'postponed';
 
+  private $namespace;
   private $name;
   private $link;
   private $result;
@@ -22,6 +23,15 @@ final class ArcanistUnitTestResult {
   private $extraData;
   private $coverage;
 
+  public function setNamespace($namespace) {
+    $this->namespace = $namespace;
+    return $this;
+  }
+
+  public function getNamespace() {
+    return $this->namespace;
+  }
+
   public function setName($name) {
     $this->name = $name;
     return $this;
index d88e5e93afedaad411df014fde2afd72b6f06a5e..2825ebcd16fb7366d0b8d0a5437c62aef793c3c5 100644 (file)
@@ -396,6 +396,7 @@ abstract class ArcanistPhutilTestCase {
 
     $result = new ArcanistUnitTestResult();
     $result->setCoverage($coverage);
+    $result->setNamespace(get_class($this));
     $result->setName($this->runningTest);
     $result->setLink($this->getLink($this->runningTest));
     $result->setResult($test_result);
index a20265f01f8c75b8a1916af56c2db4061cd0bc90..4ab444bdf2c263c399c23b79fb5e6657ccf9b13f 100644 (file)
@@ -12,10 +12,17 @@ final class ArcanistUnitConsoleRenderer extends ArcanistUnitRenderer {
     if ($result_code == ArcanistUnitTestResult::RESULT_PASS) {
       $duration = ' '.$this->formatTestDuration($result->getDuration());
     }
+
+    $test_name = $result->getName();
+    $test_namespace = $result->getNamespace();
+    if (strlen($test_namespace)) {
+      $test_name = $test_namespace.'::'.$test_name;
+    }
+
     $return = sprintf(
       "  %s %s\n",
       $this->getFormattedResult($result->getResult()).$duration,
-      $result->getName());
+      $test_name);
 
     if ($result_code != ArcanistUnitTestResult::RESULT_PASS) {
       $return .= $result->getUserData()."\n";