-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Description
when mixing #[TestWith(...)]
and #[DataProvider(...)]
style of data-providers, we prefer #[DataProvider(...)]
and ignore #[TestWith(...)]
.
I think we should emit a PHPUnit warning in case a #[TestWith(...)]
is ignored.
(I think its not worth supporting mixing these different dataprovider types on a single method)
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\TestFixture;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\TestWith;
use PHPUnit\Framework\TestCase;
final class TestWithAttributeAndDataProviderTest extends TestCase
{
public static function provider(): iterable
{
yield 'foo' => ['bar', 'baz'];
}
#[TestWith(['a', 'b'], 'foo')]
#[DataProvider('provider')]
public function testWithDuplicateName($one, $two): void
{
$this->assertTrue(true);
}
}
Metadata
Metadata
Assignees
Labels
No labels