Skip to content

Commit e7971ea

Browse files
authored
Fix data providers in ProfileValidatorTest (#1153)
The data providers in `ProfileValidatorTest` where returning an improperly constructed array causing the data set name to b treated as a named parameter (which obviously didn't exist). This was tolerated but deprecated in PHPUnit 10.x. It will not be supported in PHPUnit 11.x. Return generator from data providers for less array nesting and easier reading. Bug: T428034
1 parent d506119 commit e7971ea

1 file changed

Lines changed: 39 additions & 39 deletions

File tree

tests/Helper/ProfileValidatorTest.php

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -24,46 +24,46 @@ public function testProfileValidatorWorksWithInvalidProfile($profile): void {
2424
$this->assertFalse($validator->passes());
2525
}
2626

27-
public static function validProfileProvider() {
28-
return [
29-
['boring profile with no other' => [
30-
'purpose' => 'data_hub',
31-
'audience' => 'narrow',
32-
'temporality' => 'permanent',
33-
]],
34-
['with other values' => [
35-
'purpose' => 'data_hub',
36-
'audience' => 'other',
37-
'audience_other' => 'my cat',
38-
'temporality' => 'other',
39-
'temporality_other' => 'only in the past',
40-
]],
41-
];
27+
public static function validProfileProvider(): iterable {
28+
yield 'boring profile with no other' => [[
29+
'purpose' => 'data_hub',
30+
'audience' => 'narrow',
31+
'temporality' => 'permanent',
32+
]];
33+
34+
yield 'with other values' => [[
35+
'purpose' => 'data_hub',
36+
'audience' => 'other',
37+
'audience_other' => 'my cat',
38+
'temporality' => 'other',
39+
'temporality_other' => 'only in the past',
40+
]];
4241
}
4342

44-
public static function invalidProfileProvider() {
45-
return [
46-
['missing other keys' => [
47-
'purpose' => 'data_hub',
48-
'audience' => 'narrow',
49-
'temporality' => 'other',
50-
]],
51-
['audience is empty string' => [
52-
'purpose' => 'data_hub',
53-
'audience' => '',
54-
'temporality' => 'other',
55-
]],
56-
['audience key present when purpose not data_hub' => [
57-
'purpose' => 'data_lab',
58-
'audience' => 'narrow',
59-
'temporality' => 'permanent',
60-
]],
61-
['other keys when there should not be' => [
62-
'purpose' => 'data_hub',
63-
'purpose_other' => 'asdfasdf',
64-
'audience' => 'narrow',
65-
'temporality' => 'permanent',
66-
]],
67-
];
43+
public static function invalidProfileProvider(): iterable {
44+
yield 'missing other keys' => [[
45+
'purpose' => 'data_hub',
46+
'audience' => 'narrow',
47+
'temporality' => 'other',
48+
]];
49+
50+
yield 'audience is empty string' => [[
51+
'purpose' => 'data_hub',
52+
'audience' => '',
53+
'temporality' => 'other',
54+
]];
55+
56+
yield 'audience key present when purpose not data_hub' => [[
57+
'purpose' => 'data_lab',
58+
'audience' => 'narrow',
59+
'temporality' => 'permanent',
60+
]];
61+
62+
yield 'other keys when there should not be' => [[
63+
'purpose' => 'data_hub',
64+
'purpose_other' => 'asdfasdf',
65+
'audience' => 'narrow',
66+
'temporality' => 'permanent',
67+
]];
6868
}
6969
}

0 commit comments

Comments
 (0)