Skip to content

Commit d2acee8

Browse files
committed
refactor: apply generator to draft 3 test case
1 parent fce0267 commit d2acee8

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

tests/Drafts/Draft3Test.php

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,26 +81,34 @@ protected function getFilePaths(): array
8181
];
8282
}
8383

84-
public function getInvalidForAssocTests(): array
84+
public function getInvalidForAssocTests(): \Generator
8585
{
86-
$tests = parent::getInvalidForAssocTests();
87-
unset(
88-
$tests['type.json / object type matches objects / an array is not an object'],
89-
$tests['type.json / array type matches arrays / an object is not an array']
90-
);
86+
$skip = [
87+
'type.json / object type matches objects / an array is not an object',
88+
'type.json / array type matches arrays / an object is not an array',
89+
];
9190

92-
return $tests;
91+
foreach (parent::getInvalidForAssocTests() as $name => $testcase) {
92+
if (in_array($name, $skip, true)) {
93+
continue;
94+
}
95+
yield $name => $testcase;
96+
}
9397
}
9498

95-
public function getValidForAssocTests(): array
99+
public function getValidForAssocTests(): \Generator
96100
{
97-
$tests = parent::getValidForAssocTests();
98-
unset(
99-
$tests['type.json / object type matches objects / an array is not an object'],
100-
$tests['type.json / array type matches arrays / an object is not an array']
101-
);
101+
$skip = [
102+
'type.json / object type matches objects / an array is not an object',
103+
'type.json / array type matches arrays / an object is not an array',
104+
];
102105

103-
return $tests;
106+
foreach (parent::getValidForAssocTests() as $name => $testcase) {
107+
if (in_array($name, $skip, true)) {
108+
continue;
109+
}
110+
yield $name => $testcase;
111+
}
104112
}
105113

106114
/**

0 commit comments

Comments
 (0)