Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1f053f9

Browse filesBrowse files
bug #35489 [PhpUnitBridge] Fix running skipped tests expecting only deprecations (chalasr)
This PR was merged into the 3.4 branch. Discussion ---------- [PhpUnitBridge] Fix running skipped tests expecting only deprecations | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - If a test class has unsatisfied `@requires` and contains test methods expecting deprecation only, you get: > Fatal error: Uncaught Error: Call to a member function beStrictAboutTestsThatDoNotTestAnything() on null in ./symfony/symfony-dev/vendor/symfony/phpunit-bridge/Legacy/SymfonyTestsListenerTrait.php:229 Spotted in #34925's build. Commits ------- 6b02362 [Phpunit] Fix running skipped tests expecting only deprecations
2 parents 5144487 + 6b02362 commit 1f053f9
Copy full SHA for 1f053f9

File tree

2 files changed

+38
-0
lines changed
Filter options

2 files changed

+38
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ public function startTest($test)
222222
}
223223
}
224224

225+
if (!$test->getTestResultObject()) {
226+
return;
227+
}
228+
225229
$annotations = $Test::parseTestMethodAnnotations(\get_class($test), $test->getName(false));
226230

227231
if (isset($annotations['class']['expectedDeprecation'])) {
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\PhpUnit\Tests;
13+
14+
use PHPUnit\Framework\TestCase;
15+
16+
/**
17+
* This test is meant to be skipped.
18+
*
19+
* @requires extension ext-dummy
20+
*/
21+
final class OnlyExpectingDeprecationSkippedTest extends TestCase
22+
{
23+
/**
24+
* Do not remove this test in the next major versions.
25+
*
26+
* @group legacy
27+
*
28+
* @expectedDeprecation unreachable
29+
*/
30+
public function testExpectingOnlyDeprecations()
31+
{
32+
$this->fail('should never be ran.');
33+
}
34+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.