]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Add more information about Harbormaster/Unit result codes to Arcanist
authorepriestley <git@epriestley.com>
Tue, 4 Aug 2015 20:05:38 +0000 (13:05 -0700)
committerepriestley <git@epriestley.com>
Tue, 4 Aug 2015 20:05:38 +0000 (13:05 -0700)
Summary: Ref T7419. This makes it easier to render helpful documentation in the next diff without having to copy/paste things.

Test Plan:
In next diff:

{F688894}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T7419

Differential Revision: https://secure.phabricator.com/D13788

src/unit/ArcanistUnitTestResult.php

index f570c07292ca9e4a2cce3054e78c2dfd652a1caf..039393f84df3080ba70c83a4e65782e5dabde734 100644 (file)
@@ -152,4 +152,68 @@ final class ArcanistUnitTestResult extends Phobject {
     );
   }
 
+  public static function getAllResultCodes() {
+    return array(
+      self::RESULT_PASS,
+      self::RESULT_FAIL,
+      self::RESULT_SKIP,
+      self::RESULT_BROKEN,
+      self::RESULT_UNSOUND,
+    );
+  }
+
+  public static function getResultCodeName($result_code) {
+    $spec = self::getResultCodeSpec($result_code);
+    if (!$spec) {
+      return null;
+    }
+    return idx($spec, 'name');
+  }
+
+  public static function getResultCodeDescription($result_code) {
+    $spec = self::getResultCodeSpec($result_code);
+    if (!$spec) {
+      return null;
+    }
+    return idx($spec, 'description');
+  }
+
+  private static function getResultCodeSpec($result_code) {
+    $specs = self::getResultCodeSpecs();
+    return idx($specs, $result_code);
+  }
+
+  private static function getResultCodeSpecs() {
+    return array(
+      self::RESULT_PASS => array(
+        'name' => pht('Pass'),
+        'description' => pht(
+          'The test passed.'),
+      ),
+      self::RESULT_FAIL => array(
+        'name' => pht('Fail'),
+        'description' => pht(
+          'The test failed.'),
+      ),
+      self::RESULT_SKIP => array(
+        'name' => pht('Skip'),
+        'description' => pht(
+          'The test was not executed.'),
+      ),
+      self::RESULT_BROKEN => array(
+        'name' => pht('Broken'),
+        'description' => pht(
+          'The test failed in an abnormal or severe way. For example, the '.
+          'harness crashed instead of reporting a failure.'),
+      ),
+      self::RESULT_UNSOUND => array(
+        'name' => pht('Unsound'),
+        'description' => pht(
+          'The test failed, but this change is probably not what broke it. '.
+          'For example, it might have already been failing.'),
+      ),
+    );
+  }
+
+
 }