Skip to content

Commit

Permalink
Merge branch '8.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Oct 28, 2019
2 parents ced6984 + ffc9e37 commit 1fad9d0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
14 changes: 13 additions & 1 deletion src/Util/Log/JUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ final class JUnit extends Printer implements TestListener
*/
private $testSuiteErrors = [0];

/**
* @var int[]
*/
private $testSuiteWarnings = [0];

/**
* @var int[]
*/
Expand Down Expand Up @@ -128,7 +133,7 @@ public function addError(Test $test, \Throwable $t, float $time): void
public function addWarning(Test $test, Warning $e, float $time): void
{
$this->doAddFault($test, $e, $time, 'warning');
$this->testSuiteFailures[$this->testSuiteLevel]++;
$this->testSuiteWarnings[$this->testSuiteLevel]++;
}

/**
Expand Down Expand Up @@ -208,6 +213,7 @@ public function startTestSuite(TestSuite $suite): void
$this->testSuiteTests[$this->testSuiteLevel] = 0;
$this->testSuiteAssertions[$this->testSuiteLevel] = 0;
$this->testSuiteErrors[$this->testSuiteLevel] = 0;
$this->testSuiteWarnings[$this->testSuiteLevel] = 0;
$this->testSuiteFailures[$this->testSuiteLevel] = 0;
$this->testSuiteSkipped[$this->testSuiteLevel] = 0;
$this->testSuiteTimes[$this->testSuiteLevel] = 0;
Expand All @@ -233,6 +239,11 @@ public function endTestSuite(TestSuite $suite): void
(string) $this->testSuiteErrors[$this->testSuiteLevel]
);

$this->testSuites[$this->testSuiteLevel]->setAttribute(
'warnings',
(string) $this->testSuiteWarnings[$this->testSuiteLevel]
);

$this->testSuites[$this->testSuiteLevel]->setAttribute(
'failures',
(string) $this->testSuiteFailures[$this->testSuiteLevel]
Expand All @@ -252,6 +263,7 @@ public function endTestSuite(TestSuite $suite): void
$this->testSuiteTests[$this->testSuiteLevel - 1] += $this->testSuiteTests[$this->testSuiteLevel];
$this->testSuiteAssertions[$this->testSuiteLevel - 1] += $this->testSuiteAssertions[$this->testSuiteLevel];
$this->testSuiteErrors[$this->testSuiteLevel - 1] += $this->testSuiteErrors[$this->testSuiteLevel];
$this->testSuiteWarnings[$this->testSuiteLevel - 1] += $this->testSuiteWarnings[$this->testSuiteLevel];
$this->testSuiteFailures[$this->testSuiteLevel - 1] += $this->testSuiteFailures[$this->testSuiteLevel];
$this->testSuiteSkipped[$this->testSuiteLevel - 1] += $this->testSuiteSkipped[$this->testSuiteLevel];
$this->testSuiteTimes[$this->testSuiteLevel - 1] += $this->testSuiteTimes[$this->testSuiteLevel];
Expand Down
4 changes: 2 additions & 2 deletions tests/end-to-end/dataprovider-log-xml-isolation.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ PHPUnit %s by Sebastian Bergmann and contributors.

..F. 4 / 4 (100%)<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="DataProviderTest" file="%sDataProviderTest.php" tests="4" assertions="4" errors="0" failures="1" skipped="0" time="%f">
<testsuite name="DataProviderTest::testAdd" tests="4" assertions="4" errors="0" failures="1" skipped="0" time="%f">
<testsuite name="DataProviderTest" file="%sDataProviderTest.php" tests="4" assertions="4" errors="0" warnings="0" failures="1" skipped="0" time="%f">
<testsuite name="DataProviderTest::testAdd" tests="4" assertions="4" errors="0" warnings="0" failures="1" skipped="0" time="%f">
<testcase name="testAdd with data set #0" class="DataProviderTest" classname="DataProviderTest" file="%sDataProviderTest.php" line="%d" assertions="1" time="%f"/>
<testcase name="testAdd with data set #1" class="DataProviderTest" classname="DataProviderTest" file="%sDataProviderTest.php" line="%d" assertions="1" time="%f"/>
<testcase name="testAdd with data set #2" class="DataProviderTest" classname="DataProviderTest" file="%sDataProviderTest.php" line="%d" assertions="1" time="%f">
Expand Down
4 changes: 2 additions & 2 deletions tests/end-to-end/dataprovider-log-xml.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ PHPUnit %s by Sebastian Bergmann and contributors.

..F. 4 / 4 (100%)<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="DataProviderTest" file="%sDataProviderTest.php" tests="4" assertions="4" errors="0" failures="1" skipped="0" time="%f">
<testsuite name="DataProviderTest::testAdd" tests="4" assertions="4" errors="0" failures="1" skipped="0" time="%f">
<testsuite name="DataProviderTest" file="%sDataProviderTest.php" tests="4" assertions="4" errors="0" warnings="0" failures="1" skipped="0" time="%f">
<testsuite name="DataProviderTest::testAdd" tests="4" assertions="4" errors="0" warnings="0" failures="1" skipped="0" time="%f">
<testcase name="testAdd with data set #0" class="DataProviderTest" classname="DataProviderTest" file="%sDataProviderTest.php" line="%d" assertions="1" time="%f"/>
<testcase name="testAdd with data set #1" class="DataProviderTest" classname="DataProviderTest" file="%sDataProviderTest.php" line="%d" assertions="1" time="%f"/>
<testcase name="testAdd with data set #2" class="DataProviderTest" classname="DataProviderTest" file="%sDataProviderTest.php" line="%d" assertions="1" time="%f">
Expand Down
2 changes: 1 addition & 1 deletion tests/end-to-end/loggers/log-junit-phpt.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PHPUnit %s by Sebastian Bergmann and contributors.

. 1 / 1 (100%)<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="%s">
<testsuite name="" tests="1" assertions="1" errors="0" warnings="0" failures="0" skipped="0" time="%s">
<testcase name="%send-to-end%ephpt-stderr.phpt" assertions="1" time="%s">
<system-out>PHPUnit must look at STDERR when running PHPT tests.</system-out>
</testcase>
Expand Down
2 changes: 1 addition & 1 deletion tests/end-to-end/loggers/log-junit.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ PHPUnit %s by Sebastian Bergmann and contributors.

.FEISRW.FEISRW 14 / 14 (100%)<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="PHPUnit\SelfTest\Basic\StatusTest" file="%s%eStatusTest.php" tests="14" assertions="4" errors="4" failures="4" skipped="4" time="%f">
<testsuite name="PHPUnit\SelfTest\Basic\StatusTest" file="%s%eStatusTest.php" tests="14" assertions="4" errors="4" warnings="2" failures="2" skipped="4" time="%f">
<testcase name="testSuccess" class="PHPUnit\SelfTest\Basic\StatusTest" classname="PHPUnit.SelfTest.Basic.StatusTest" file="%s%eStatusTest.php" line="%d" assertions="1" time="%f"/>
<testcase name="testFailure" class="PHPUnit\SelfTest\Basic\StatusTest" classname="PHPUnit.SelfTest.Basic.StatusTest" file="%s%eStatusTest.php" line="%d" assertions="1" time="%f">
<failure type="PHPUnit\Framework\ExpectationFailedException">PHPUnit\SelfTest\Basic\StatusTest::testFailure
Expand Down

0 comments on commit 1fad9d0

Please sign in to comment.