PHPUnit: 11.4
Symfony: 7.2
We have simple test with external data provider:
class AppTest {
#[DataProviderExternal(AppDataProvider::class, 'getData')]
public function testData(array $data): void {
static::assertSame($data['type'], '123');
}
}
class AppDataProvider {
public static function getData(): array {
return [
[
'data' => [
'type' => /* What code should be here?
* Something like static::fixtureManager()->getReference(AppTypeEnum::MAIN_TYPE->value)
*/
],
]
];
}
}
From source code I see that data provider set data for test via setData, but in this place test class is just created and no “setUp” was called or anything.
How can I get type to be taken from database fixtures in external data provider?