Skip to content

Commit 4fd2c57

Browse files
Merge branch '12.3'
2 parents 2e00a98 + db8aea0 commit 4fd2c57

File tree

2 files changed

+91
-4
lines changed

2 files changed

+91
-4
lines changed

tests/end-to-end/regression/6279.phpt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ https://github.com/sebastianbergmann/phpunit/issues/6279
55
$_SERVER['argv'][] = '--do-not-cache-result';
66
$_SERVER['argv'][] = '--no-configuration';
77
$_SERVER['argv'][] = '--display-deprecations';
8-
$_SERVER['argv'][] = __DIR__ . '/6279/TriggersDeprecationInDataProviderTest.php';
8+
$_SERVER['argv'][] = __DIR__ . '/6279/';
99

1010
require_once __DIR__ . '/../../bootstrap.php';
1111
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
@@ -14,11 +14,11 @@ PHPUnit %s by Sebastian Bergmann and contributors.
1414

1515
Runtime: %s
1616

17-
.D.DD 5 / 5 (100%)
17+
.D.DD..DD. 10 / 10 (100%)
1818

1919
Time: %s, Memory: %s
2020

21-
3 tests triggered 3 deprecations:
21+
5 tests triggered 5 deprecations:
2222

2323
1) %sTriggersDeprecationInDataProviderTest.php:26
2424
some deprecation
@@ -37,5 +37,11 @@ first
3737
3) %sTriggersDeprecationInDataProviderTest.php:34
3838
second
3939

40+
4) %sTriggersDeprecationInDataProviderUsingIgnoreDeprecationsTest.php:32
41+
some deprecation 2
42+
43+
5) %sTriggersDeprecationInDataProviderUsingIgnoreDeprecationsTest.php:39
44+
some deprecation 3
45+
4046
OK, but there were issues!
41-
Tests: 5, Assertions: 5, Deprecations: 3.
47+
Tests: 10, Assertions: 10, Deprecations: 5.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/*
5+
* This file is part of PHPUnit.
6+
*
7+
* (c) Sebastian Bergmann <[email protected]>
8+
*
9+
* For the full copyright and license information, please view the LICENSE
10+
* file that was distributed with this source code.
11+
*/
12+
namespace PHPUnit\TestFixture\Issue6279;
13+
14+
use const E_USER_DEPRECATED;
15+
use function trigger_error;
16+
use PHPUnit\Framework\Attributes\DataProvider;
17+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
18+
use PHPUnit\Framework\Attributes\Test;
19+
use PHPUnit\Framework\TestCase;
20+
21+
class TriggersDeprecationInDataProviderUsingIgnoreDeprecationsTest extends TestCase
22+
{
23+
public static function dataProvider1(): iterable
24+
{
25+
@trigger_error('some deprecation', E_USER_DEPRECATED);
26+
27+
yield [true];
28+
}
29+
30+
public static function dataProvider2(): iterable
31+
{
32+
@trigger_error('some deprecation 2', E_USER_DEPRECATED);
33+
34+
yield [true];
35+
}
36+
37+
public static function dataProvider3(): iterable
38+
{
39+
@trigger_error('some deprecation 3', E_USER_DEPRECATED);
40+
41+
yield [true];
42+
}
43+
44+
#[Test]
45+
#[DataProvider('dataProvider1')]
46+
#[IgnoreDeprecations]
47+
public function someMethod1(bool $value): void
48+
{
49+
$this->assertTrue($value);
50+
}
51+
52+
#[Test]
53+
#[DataProvider('dataProvider2')]
54+
#[IgnoreDeprecations]
55+
public function method2_1(bool $value): void
56+
{
57+
$this->assertTrue($value);
58+
}
59+
60+
#[Test]
61+
#[DataProvider('dataProvider2')]
62+
public function method2_2(bool $value): void
63+
{
64+
$this->assertTrue($value);
65+
}
66+
67+
#[Test]
68+
#[DataProvider('dataProvider3')]
69+
public function method3_1(bool $value): void
70+
{
71+
$this->assertTrue($value);
72+
}
73+
74+
#[Test]
75+
#[DataProvider('dataProvider3')]
76+
#[IgnoreDeprecations]
77+
public function method3_2(bool $value): void
78+
{
79+
$this->assertTrue($value);
80+
}
81+
}

0 commit comments

Comments
 (0)