Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ff174df

Browse files
minor #35178 [PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code (fancyweb)
This PR was merged into the 3.4 branch. Discussion ---------- [PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Risky errors when there are no assertions are added before the test end listeners are called (ie, before the code in endTest is executed) so forcing beStrictAboutTestsThatDoNotTestAnything to false when there is a expectedDeprecation annotation is enough. If the goal is to reset the value to the original value, then I think we should not do it since we basically "lie" to the next listeners. Let's assume that when a test expect a deprecation, it can have 0 assertions. Also this flag is not used anymore by PHPUnit after we reset it. Ref #21786 btw Commits ------- fb48bbc [PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code
2 parents f889c11 + fb48bbc commit ff174df

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class SymfonyTestsListenerTrait
3737
private $gatheredDeprecations = array();
3838
private $previousErrorHandler;
3939
private $testsWithWarnings;
40-
private $reportUselessTests;
4140
private $error;
4241
private $runsInSeparateProcess = false;
4342

@@ -198,10 +197,6 @@ public function addSkippedTest($test, \Exception $e, $time)
198197
public function startTest($test)
199198
{
200199
if (-2 < $this->state && ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)) {
201-
if (null !== $test->getTestResultObject()) {
202-
$this->reportUselessTests = $test->getTestResultObject()->isStrictAboutTestsThatDoNotTestAnything();
203-
}
204-
205200
// This event is triggered before the test is re-run in isolation
206201
if ($this->willBeIsolated($test)) {
207202
$this->runsInSeparateProcess = tempnam(sys_get_temp_dir(), 'deprec');
@@ -267,11 +262,6 @@ public function endTest($test, $time)
267262
$classGroups = $Test::getGroups($className);
268263
$groups = $Test::getGroups($className, $test->getName(false));
269264

270-
if (null !== $this->reportUselessTests) {
271-
$test->getTestResultObject()->beStrictAboutTestsThatDoNotTestAnything($this->reportUselessTests);
272-
$this->reportUselessTests = null;
273-
}
274-
275265
if ($errored = null !== $this->error) {
276266
$test->getTestResultObject()->addError($test, $this->error, 0);
277267
$this->error = null;

0 commit comments

Comments
 (0)