Merge pull request #6823 from open-sausages/pulls/4.0/remove-TeamCityListener

Removed TeamCityListener
This commit is contained in:
Damian Mooyman 2017-04-21 15:56:20 +12:00 committed by GitHub
commit c21f71405f
2 changed files with 1 additions and 94 deletions

View File

@ -1247,6 +1247,7 @@ After (`mysite/_config/config.yml`):
* Removed `FunctionalTest::stat`
* Removed `LeftAndMainMarkingFilter`
* Removed `Controller::getFormOwner`
* Removed `TeamCityListener`
* The Spyc YAML library has been removed from /thirdparty. Please load it yourself, or use the
Symfony YAML component thats automatically installed by composer.
* `RestfulService` has been removed. Use Guzzle instead. See Upgrading notes.

View File

@ -1,94 +0,0 @@
<?php
namespace SilverStripe\Dev;
use PHPUnit_Framework_TestListener;
use PHPUnit_Framework_TestSuite;
use PHPUnit_Framework_Test;
use Exception;
use PHPUnit_Framework_AssertionFailedError;
use PHPUnit_Framework_TestFailure;
/**
* Bind TeamCity test listener. Echos messages to stdout that TeamCity interprets into the test results
*/
class TeamCityListener implements PHPUnit_Framework_TestListener
{
private function escape($str)
{
return strtr($str, array(
"\n" => '|n',
"\r" => '|r',
"[" => '|[',
"]" => '|]',
"'" => "|'",
"|" => '||'
));
}
public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
{
echo "##teamcity[testSuiteStarted name='{$suite->getName()}']\n";
}
public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
{
echo "##teamcity[testSuiteFinished name='{$suite->getName()}']\n";
}
public function startTest(PHPUnit_Framework_Test $test)
{
$class = get_class($test);
echo "##teamcity[testStarted name='{$class}.{$test->getName()}']\n";
}
public function endTest(PHPUnit_Framework_Test $test, $time)
{
$class = get_class($test);
echo "##teamcity[testFinished name='{$class}.{$test->getName()}' duration='$time']\n";
}
public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
{
$class = get_class($test);
$message = $this->escape("Exception: {$e->getMessage()}");
$trace = $this->escape($e->getTraceAsString());
echo "##teamcity[testFailed type='exception' name='{$class}.{$test->getName()}' message='$message'"
. " details='$trace']\n";
}
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
{
$class = get_class($test);
$message = $this->escape(PHPUnit_Framework_TestFailure::exceptionToString($e));
$trace = $this->escape($e->getTraceAsString());
echo "##teamcity[testFailed type='failure' name='{$class}.{$test->getName()}' message='$message'"
. " details='$trace']\n";
}
public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
{
// NOP
}
public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
{
$class = get_class($test);
$message = $this->escape($e->getMessage());
echo "##teamcity[testIgnored name='{$class}.{$test->getName()}' message='$message']\n";
}
/**
* Risky test.
*
* @param PHPUnit_Framework_Test $test
* @param Exception $e
* @param float $time
* @since Method available since Release 3.8.0
*/
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time)
{
// Stub out to support PHPUnit 3.8
}
}