Skip to content

Fix the conditional definition of the SymfonyTestsListener #23145

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

Merged
merged 1 commit into from
Jun 12, 2017
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
82 changes: 41 additions & 41 deletions src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,53 +18,53 @@

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);
}
}
}