Fix the conditional definition of the SymfonyTestsListener

This commit is contained in:
Christophe Coevoet 2017-06-12 15:35:45 +02:00
parent d024c82b48
commit 0ec8b1c1ff

View File

@ -18,53 +18,53 @@ use PHPUnit\Framework\Warning;
if (class_exists('PHPUnit_Runner_Version') && version_compare(\PHPUnit_Runner_Version::id(), '6.0.0', '<')) {
class_alias('Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener', 'Symfony\Bridge\PhpUnit\SymfonyTestsListener');
return;
}
/**
* Collects and replays skipped tests.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*/
class SymfonyTestsListener extends BaseTestListener
{
private $trait;
public function __construct(array $mockedNamespaces = array())
// Using an early return instead of a else does not work when using the PHPUnit phar due to some weird PHP behavior (the class
// gets defined without executing the code before it and so the definition is not properly conditional)
} else {
/**
* Collects and replays skipped tests.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*/
class SymfonyTestsListener extends BaseTestListener
{
$this->trait = new Legacy\SymfonyTestsListenerTrait($mockedNamespaces);
}
private $trait;
public function globalListenerDisabled()
{
$this->trait->globalListenerDisabled();
}
public function __construct(array $mockedNamespaces = array())
{
$this->trait = new Legacy\SymfonyTestsListenerTrait($mockedNamespaces);
}
public function startTestSuite(TestSuite $suite)
{
return $this->trait->startTestSuite($suite);
}
public function globalListenerDisabled()
{
$this->trait->globalListenerDisabled();
}
public function addSkippedTest(Test $test, \Exception $e, $time)
{
return $this->trait->addSkippedTest($test, $e, $time);
}
public function startTestSuite(TestSuite $suite)
{
return $this->trait->startTestSuite($suite);
}
public function startTest(Test $test)
{
return $this->trait->startTest($test);
}
public function addSkippedTest(Test $test, \Exception $e, $time)
{
return $this->trait->addSkippedTest($test, $e, $time);
}
public function addWarning(Test $test, Warning $e, $time)
{
return $this->trait->addWarning($test, $e, $time);
}
public function startTest(Test $test)
{
return $this->trait->startTest($test);
}
public function endTest(Test $test, $time)
{
return $this->trait->endTest($test, $time);
public function addWarning(Test $test, Warning $e, $time)
{
return $this->trait->addWarning($test, $e, $time);
}
public function endTest(Test $test, $time)
{
return $this->trait->endTest($test, $time);
}
}
}