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

Skip to content

Commit 993c43e

Browse files
committed
[Phpunit] Fix running skipped tests expecting only deprecations
1 parent b90664b commit 993c43e

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function addSkippedTest($test, \Exception $e, $time)
196196

197197
public function startTest($test)
198198
{
199-
if (-2 < $this->state && ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)) {
199+
if (-2 < $this->state && ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase) && $test->getTestResultObject()) {
200200
// This event is triggered before the test is re-run in isolation
201201
if ($this->willBeIsolated($test)) {
202202
$this->runsInSeparateProcess = tempnam(sys_get_temp_dir(), 'deprec');
Lines 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 <[email protected]>
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)