|
| 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