Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve exception output in teamcity printer #215

Merged
merged 1 commit into from
Nov 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 2 additions & 27 deletions src/TeamCity.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ final class TeamCity extends DefaultResultPrinter
private const DURATION = 'duration';
private const TEST_SUITE_STARTED = 'testSuiteStarted';
private const TEST_SUITE_FINISHED = 'testSuiteFinished';
private const TEST_FAILED = 'testFailed';

/** @var int */
private $flowId;
Expand Down Expand Up @@ -149,19 +148,7 @@ public function endTest(Test $test, float $time): void
*/
public function addError(Test $test, Throwable $t, float $time): void
{
if (!TeamCity::isPestTest($test)) {
$this->phpunitTeamCity->addError($test, $t, $time);

return;
}

$this->printEvent(
self::TEST_FAILED, [
self::NAME => $test->getName(),
'message' => $t->getMessage(),
'details' => $t->getTraceAsString(),
self::DURATION => self::toMilliseconds($time),
]);
$this->phpunitTeamCity->addError($test, $t, $time);
}

/**
Expand All @@ -171,19 +158,7 @@ public function addError(Test $test, Throwable $t, float $time): void
*/
public function addWarning(Test $test, Warning $e, float $time): void
{
if (!TeamCity::isPestTest($test)) {
$this->phpunitTeamCity->addWarning($test, $e, $time);

return;
}

$this->printEvent(
self::TEST_FAILED, [
self::NAME => $test->getName(),
'message' => $e->getMessage(),
'details' => $e->getTraceAsString(),
self::DURATION => self::toMilliseconds($time),
]);
$this->phpunitTeamCity->addWarning($test, $e, $time);
}

public function addFailure(Test $test, AssertionFailedError $e, float $time): void
Expand Down