Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15436377
D13486.id32625.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13486.id32625.diff
View Options
diff --git a/src/workflow/ArcanistUnitWorkflow.php b/src/workflow/ArcanistUnitWorkflow.php
--- a/src/workflow/ArcanistUnitWorkflow.php
+++ b/src/workflow/ArcanistUnitWorkflow.php
@@ -184,6 +184,9 @@
}
$results = $this->engine->run();
+
+ $this->validateUnitEngineResults($this->engine, $results);
+
$this->testResults = $results;
$console = PhutilConsole::getConsole();
@@ -368,4 +371,42 @@
return idx($known_formats, $format, 'full');
}
+
+ /**
+ * Raise a tailored error when a unit test engine returns results in an
+ * invalid format.
+ *
+ * @param ArcanistUnitTestEngine The engine.
+ * @param wild Results from the engine.
+ */
+ private function validateUnitEngineResults(
+ ArcanistUnitTestEngine $engine,
+ $results) {
+
+ if (!is_array($results)) {
+ throw new Exception(
+ pht(
+ 'Unit test engine (of class "%s") returned invalid results when '.
+ 'run (with method "%s"). Expected a list of "%s" objects as results.',
+ get_class($engine),
+ 'run()',
+ 'ArcanistUnitTestResult'));
+ }
+
+ foreach ($results as $key => $result) {
+ if (!($result instanceof ArcanistUnitTestResult)) {
+ throw new Exception(
+ pht(
+ 'Unit test engine (of class "%s") returned invalid results when '.
+ 'run (with method "%s"). Expected a list of "%s" objects as '.
+ 'results, but value with key "%s" is not valid.',
+ get_class($engine),
+ 'run()',
+ 'ArcanistUnitTestResult',
+ $key));
+ }
+ }
+
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 26, 1:49 PM (2 w, 3 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7309322
Default Alt Text
D13486.id32625.diff (1 KB)
Attached To
Mode
D13486: Raise a more tailored error message when a third-party test engine returns bad results
Attached
Detach File
Event Timeline
Log In to Comment