mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-28 17:52:42 +01:00
Child classes can prevent echoing test results.
Summary: We changed our Facebook implementation to echo test results while the tests are running. We do not want to echo the test results twice. Test Plan: Tested that implementing the function in PhutilUnitTestEngine and returning true showed the results and returning false didn't show the results. Reviewed By: epriestley Reviewers: jungejason, epriestley, grglr, slawekbiel Commenters: slawekbiel, aran CC: sgrimm, slawekbiel, aran, tuomaspelkonen, epriestley Differential Revision: 400
This commit is contained in:
parent
b763cecdb2
commit
9b7ee674eb
2 changed files with 16 additions and 2 deletions
|
@ -71,4 +71,14 @@ abstract class ArcanistBaseUnitTestEngine {
|
||||||
public function setDifferentialDiffID($id) {
|
public function setDifferentialDiffID($id) {
|
||||||
$this->diffID = $id;
|
$this->diffID = $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify the return value of this function in the child class, if
|
||||||
|
* you do not need to echo the test results after all the tests have
|
||||||
|
* been run. This is the case for example when the child class
|
||||||
|
* prints the tests results while the tests are running.
|
||||||
|
*/
|
||||||
|
public function shouldEchoTestResults() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,9 +122,13 @@ EOTEXT
|
||||||
if ($result_code == ArcanistUnitTestResult::RESULT_POSTPONED) {
|
if ($result_code == ArcanistUnitTestResult::RESULT_POSTPONED) {
|
||||||
$postponed_count++;
|
$postponed_count++;
|
||||||
} else {
|
} else {
|
||||||
|
if ($this->engine->shouldEchoTestResults()) {
|
||||||
echo ' '.$status_codes[$result_code].' '.$result->getName()."\n";
|
echo ' '.$status_codes[$result_code].' '.$result->getName()."\n";
|
||||||
|
}
|
||||||
if ($result_code != ArcanistUnitTestResult::RESULT_PASS) {
|
if ($result_code != ArcanistUnitTestResult::RESULT_PASS) {
|
||||||
|
if ($this->engine->shouldEchoTestResults()) {
|
||||||
echo $result->getUserData()."\n";
|
echo $result->getUserData()."\n";
|
||||||
|
}
|
||||||
$unresolved[] = $result;
|
$unresolved[] = $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue