Skip to content

Commit 7eadae9

Browse files
staabmsebastianbergmann
authored andcommitted
Test same-type attribute providers don't warn
1 parent 7e1c6e7 commit 7eadae9

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php declare(strict_types=1);
2+
3+
/*
4+
* This file is part of PHPUnit.
5+
*
6+
* (c) Sebastian Bergmann <[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+
namespace PHPUnit\TestFixture;
12+
13+
use PHPUnit\Framework\Attributes\DataProvider;
14+
use PHPUnit\Framework\Attributes\DataProviderExternal;
15+
use PHPUnit\Framework\TestCase;
16+
17+
final class TestDataProviderExternalAndDataProviderTest extends TestCase
18+
{
19+
public static function externalProvider(): iterable
20+
{
21+
yield 'foo' => ['bar', 'baz'];
22+
}
23+
24+
public static function provider(): iterable
25+
{
26+
yield 'foo2' => ['bar', 'baz'];
27+
}
28+
29+
#[DataProvider('provider')]
30+
#[DataProviderExternal(self::class, 'externalProvider')]
31+
public function testWithDifferentProviderTypes($one, $two): void
32+
{
33+
$this->assertTrue(true);
34+
}
35+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
phpunit ../_files/TestDataProviderExternalAndDataProviderTest.php
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--no-configuration';
7+
$_SERVER['argv'][] = __DIR__ . '/../_files/TestDataProviderExternalAndDataProviderTest.php';
8+
9+
require __DIR__ . '/../../bootstrap.php';
10+
11+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
12+
--EXPECTF--
13+
PHPUnit %s by Sebastian Bergmann and contributors.
14+
15+
Runtime: %s
16+
17+
.. 2 / 2 (100%)
18+
19+
Time: %s, Memory: %s
20+
21+
OK (2 tests, 2 assertions)

0 commit comments

Comments
 (0)