Skip to content

Add DataSet attribute #70

@roxblnfk

Description

@roxblnfk

Summary

Inline data for parameterized tests without separate provider method.

Feature

#[DataSet([1, 'a'])]
#[DataSet([2, 'b'])]
#[DataSet([3, 'c'])]
public function testMethod(int $number, string $letter) {}
Dataset $number $letter
0 1 a
1 2 b
2 3 c

Named datasets

#[DataSet('first', [1, 'a'])]
#[DataSet('second', [2, 'b'])]
public function testMethod(int $number, string $letter) {}

Datasets: first, second

Combined with DataProvider

#[DataProvider('commonCases')]
#[DataSet('edge', [0, ''])]
public function testMethod(int $number, string $letter) {}

Notes

  • Empty args #[DataSet([])] → Dataset without arguments (default values will be used)

Future Scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions