From 3793998df43bbb5170ceb7350263d017aae3985c Mon Sep 17 00:00:00 2001 From: Sebastian Szulc Date: Thu, 16 Jul 2015 13:40:04 -0700 Subject: [PATCH] Fix unitialized variable in ArcanistPhpunitTestResultParser Summary: This is to fix `arc unit` when running a test file with no test results (e.g. skipped) ``` EXCEPTION: (RuntimeException) Undefined variable: last_test_finished at [/src/error/PhutilErrorHandler.php:210] arcanist(head=master, ref.master=d54cb072facd), deviantart(), phutil(head=master, ref.master=75f675747648) #0 PhutilErrorHandler::handleError(integer, string, string, integer, array) called at [/src/unit/parser/ArcanistPhpunitTestResultParser.php:95] #1 ArcanistPhpunitTestResultParser::parseTestResults(string, string) called at [/unit/DaUnitEngine.php:150] #2 DaUnitEngine::parseTestResults(string, TempFile, string, string) called at [/unit/DaUnitEngine.php:82] #3 DaUnitEngine::run() called at [/src/workflow/ArcanistUnitWorkflow.php:186] #4 ArcanistUnitWorkflow::run() called at [/scripts/arcanist.php:382] ``` Test Plan: Create a test file with skipped tests. Run `arc unit`. Make sure the exception is not thrown. Reviewers: joshuaspence, epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin, aurelijus Differential Revision: https://secure.phabricator.com/D13640 --- src/unit/parser/ArcanistPhpunitTestResultParser.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/unit/parser/ArcanistPhpunitTestResultParser.php b/src/unit/parser/ArcanistPhpunitTestResultParser.php index 10a09051..46e9c131 100644 --- a/src/unit/parser/ArcanistPhpunitTestResultParser.php +++ b/src/unit/parser/ArcanistPhpunitTestResultParser.php @@ -33,6 +33,8 @@ final class ArcanistPhpunitTestResultParser extends ArcanistTestResultParser { $coverage = $this->readCoverage(); } + $last_test_finished = true; + $results = array(); foreach ($report as $event) { switch (idx($event, 'event')) {