Skip to content

Commit ad03987

Browse files
staabmsebastianbergmann
authored andcommitted
Test more cases
1 parent 1372e8e commit ad03987

File tree

2 files changed

+43
-4
lines changed

2 files changed

+43
-4
lines changed

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,28 @@ PHPUnit %s by Sebastian Bergmann and contributors.
1414

1515
Runtime: %s
1616

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

1919
Time: %s, Memory: %s
2020

21-
1 test triggered 1 deprecation:
21+
3 tests triggered 3 deprecations:
2222

23-
1) %sTriggersDeprecationInDataProviderTest.php:24
23+
1) %sTriggersDeprecationInDataProviderTest.php:25
2424
some deprecation
2525

26+
Triggered by:
27+
28+
* PHPUnit\TestFixture\Issue6279\TriggersDeprecationInDataProviderTest::method2#0
29+
%sTriggersDeprecationInDataProviderTest.php:38
30+
31+
* PHPUnit\TestFixture\Issue6279\TriggersDeprecationInDataProviderTest::method4#0
32+
%sTriggersDeprecationInDataProviderTest.php:51
33+
34+
2) %sTriggersDeprecationInDataProviderTest.php:65
35+
first
36+
37+
3) %sTriggersDeprecationInDataProviderTest.php:66
38+
second
39+
2640
OK, but there were issues!
27-
Tests: 3, Assertions: 3, Deprecations: 1.
41+
Tests: 5, Assertions: 5, Deprecations: 3.

tests/end-to-end/regression/6279/TriggersDeprecationInDataProviderTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
namespace PHPUnit\TestFixture\Issue6279;
1313

1414
use const E_USER_DEPRECATED;
15+
use const E_USER_WARNING;
1516
use function trigger_error;
1617
use PHPUnit\Framework\Attributes\DataProvider;
18+
use PHPUnit\Framework\Attributes\DataProviderExternal;
1719
use PHPUnit\Framework\Attributes\Test;
1820
use PHPUnit\Framework\TestCase;
1921

@@ -26,6 +28,15 @@ public static function dataProvider(): iterable
2628
yield [true];
2729
}
2830

31+
public static function dataWith2Deprecations(): iterable
32+
{
33+
@trigger_error('first', E_USER_DEPRECATED);
34+
@trigger_error('second', E_USER_DEPRECATED);
35+
@trigger_error('warning', E_USER_WARNING);
36+
37+
yield [true];
38+
}
39+
2940
#[Test]
3041
public function method1(): void
3142
{
@@ -44,4 +55,18 @@ public function method3(): void
4455
{
4556
$this->assertTrue(true);
4657
}
58+
59+
#[Test]
60+
#[DataProvider('dataProvider')]
61+
public function method4(bool $value): void
62+
{
63+
$this->assertTrue($value);
64+
}
65+
66+
#[Test]
67+
#[DataProviderExternal(self::class, 'dataWith2Deprecations')]
68+
public function method5(bool $value): void
69+
{
70+
$this->assertTrue($value);
71+
}
4772
}

0 commit comments

Comments
 (0)