From 881713747ed78f052e9c6aa6687c197247ad2582 Mon Sep 17 00:00:00 2001 From: Pablo Tejada Date: Thu, 5 Jan 2017 18:14:45 +0700 Subject: [PATCH] Handles the rare warning test status when generating code coverage --- src/PHPCensor/Plugin/Util/PhpUnitResult.php | 4 ++++ .../PHPCensor/Plugin/SampleFiles/phpunit_money.txt | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/PHPCensor/Plugin/Util/PhpUnitResult.php b/src/PHPCensor/Plugin/Util/PhpUnitResult.php index 3222f297..76303d40 100644 --- a/src/PHPCensor/Plugin/Util/PhpUnitResult.php +++ b/src/PHPCensor/Plugin/Util/PhpUnitResult.php @@ -132,6 +132,10 @@ class PhpUnitResult $pass = true; $severity = self::SEVERITY_PASS; break; + case 'warning': + $pass = true; + $severity = self::SEVERITY_PASS; + break; default: throw new \Exception("Unexpected PHPUnit test status: {$status}"); break; diff --git a/tests/PHPCensor/Plugin/SampleFiles/phpunit_money.txt b/tests/PHPCensor/Plugin/SampleFiles/phpunit_money.txt index e5f055be..101cafc5 100644 --- a/tests/PHPCensor/Plugin/SampleFiles/phpunit_money.txt +++ b/tests/PHPCensor/Plugin/SampleFiles/phpunit_money.txt @@ -339,6 +339,19 @@ "trace": [], "message": "", "output": "" +}{ + "event": "testStart", + "suite": "Tests\\Money\\MoneyTest", + "test": "Tests\\Money\\MoneyTest::testFactoryMethods" +}{ + "event": "test", + "suite": "Tests\\Money\\MoneyTest", + "test": "Tests\\Money\\MoneyTest::testFactoryMethods", + "status": "warning", + "time": 0.06482195854187, + "trace": [], + "message": "Trying to @cover or @use not existing method \"Monies::test\".", + "output": "" }{ "event": "testStart", "suite": "Tests\\Money\\Parser\\IntlMoneyParserTest::testIntlParser",