Skip to content

Commit

Permalink
Risky tests should not be counted within Errors (#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
Slamdunk authored Jul 22, 2022
1 parent bce7b96 commit ae5803c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Logging/JUnit/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private function parseTestSuite(SimpleXMLElement $node, bool $isRootSuite): Test
(int) $node['tests'],
(int) $node['assertions'],
(int) $node['failures'],
(int) $node['errors'],
(int) $node['errors'] - $risky,
(int) $node['warnings'],
$risky,
(int) $node['skipped'],
Expand Down
2 changes: 1 addition & 1 deletion src/Logging/JUnit/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private function createSuiteNode(TestSuite $parentSuite): DOMElement

$suiteNode->setAttribute('tests', (string) $parentSuite->tests);
$suiteNode->setAttribute('assertions', (string) $parentSuite->assertions);
$suiteNode->setAttribute('errors', (string) $parentSuite->errors);
$suiteNode->setAttribute('errors', (string) ($parentSuite->errors + $parentSuite->risky));
$suiteNode->setAttribute('warnings', (string) $parentSuite->warnings);
$suiteNode->setAttribute('failures', (string) $parentSuite->failures);
$suiteNode->setAttribute('skipped', (string) $parentSuite->skipped);
Expand Down
6 changes: 3 additions & 3 deletions test/Unit/Logging/JUnit/ReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testMixedSuiteShouldConstructRootSuite(): TestSuite
static::assertSame(19, $suite->tests);
static::assertSame(10, $suite->assertions);
static::assertSame(3, $suite->failures);
static::assertSame(3, $suite->errors);
static::assertSame(1, $suite->errors);
static::assertSame(1.234567, $suite->time);

return $suite;
Expand Down Expand Up @@ -225,7 +225,7 @@ public function testMixedGetTotals(): void
{
static::assertSame(19, $this->mixed->getTotalTests());
static::assertSame(10, $this->mixed->getTotalAssertions());
static::assertSame(3, $this->mixed->getTotalErrors());
static::assertSame(1, $this->mixed->getTotalErrors());
static::assertSame(3, $this->mixed->getTotalFailures());
static::assertSame(2, $this->mixed->getTotalWarnings());
static::assertSame(4, $this->mixed->getTotalSkipped());
Expand Down Expand Up @@ -356,7 +356,7 @@ public function testGetSkippedMessagesForSkippingDataProviders(): void

public function testMixedGetFeedback(): void
{
static::assertSame('EEEWWFFFRRSSSS.....', $this->mixed->getFeedback());
static::assertSame('EWWFFFRRSSSS.......', $this->mixed->getFeedback());
}

public function testRemoveLog(): void
Expand Down
4 changes: 2 additions & 2 deletions test/Unit/Logging/LogInterpreterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function testGetTotals(): void
{
static::assertSame(22, $this->interpreter->getTotalTests());
static::assertSame(13, $this->interpreter->getTotalAssertions());
static::assertSame(3, $this->interpreter->getTotalErrors());
static::assertSame(1, $this->interpreter->getTotalErrors());
static::assertSame(3, $this->interpreter->getTotalFailures());
static::assertSame(2, $this->interpreter->getTotalWarnings());
static::assertSame(4, $this->interpreter->getTotalSkipped());
Expand Down Expand Up @@ -180,7 +180,7 @@ public function testMergeReaders(): void
static::assertSame(22, $oneResult->tests);
static::assertSame(13, $oneResult->assertions);
static::assertSame(3, $oneResult->failures);
static::assertSame(3, $oneResult->errors);
static::assertSame(1, $oneResult->errors);
static::assertSame(2, $oneResult->warnings);
static::assertSame(2, $oneResult->risky);
static::assertSame(4, $oneResult->skipped);
Expand Down
4 changes: 2 additions & 2 deletions test/Unit/Runners/PHPUnit/ResultPrinterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public function testGetFooterWithFailures(): void
$footer = $this->printer->getFooter();

$eq = "FAILURES!\n";
$eq .= "Tests: 20, Assertions: 10, Errors: 4, Failures: 3, Warnings: 2, Skipped: 4.\n";
$eq .= "Tests: 20, Assertions: 10, Errors: 2, Failures: 3, Warnings: 2, Skipped: 4.\n";

static::assertSame($eq, $footer);
}
Expand Down Expand Up @@ -362,7 +362,7 @@ public function testPrintFeedbackForMixed(): void
$this->printer->addTest($this->mixedSuite);
$this->printer->printFeedback($this->mixedSuite);
$contents = $this->output->fetch();
static::assertSame("EEEWWFFFRRSSSS..... 19 / 19 (100%)\n", $contents);
static::assertSame("EWWFFFRRSSSS....... 19 / 19 (100%)\n", $contents);
}

public function testPrintFeedbackForMoreThan100Suites(): void
Expand Down

0 comments on commit ae5803c

Please sign in to comment.