-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test method is correctly detectied with data provider (fixes #98)
- Loading branch information
Showing
2 changed files
with
61 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Qameta\Allure\PHPUnit\Test\Report\Generate; | ||
|
||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use PHPUnit\Framework\TestCase; | ||
use Qameta\Allure\Allure; | ||
use Qameta\Allure\Attribute\DisplayName; | ||
|
||
class DataProviderTest extends TestCase | ||
{ | ||
#[DataProvider('providerNamed'), DisplayName('Test with named data set')] | ||
public function testNamedDataSet(int $x, int $y): void | ||
{ | ||
Allure::runStep(fn () => self::assertSame($x, $y)); | ||
} | ||
|
||
public static function providerNamed(): iterable | ||
{ | ||
return [ | ||
'Simple name' => [1, 1], | ||
'' => [2, 2], | ||
'"Double-quoted" name' => [3, 3], | ||
"'Single-quoted' name" => [4, 4], | ||
' ' => [5, 5], | ||
]; | ||
} | ||
|
||
#[DataProvider('providerListed')] | ||
public function testListedDataSet(int $x, int $y): void | ||
{ | ||
Allure::runStep(fn () => self::assertSame($x, $y)); | ||
} | ||
|
||
public static function providerListed(): iterable | ||
{ | ||
return [ | ||
[1, 1], | ||
[2, 2], | ||
]; | ||
} | ||
} |