Skip to content

Commit f1a8821

Browse files
committed
Filter out documentation items for index generation tests
1 parent 055c2d2 commit f1a8821

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

build/tests/php/FileGenerator/Domain/ApiSearchGeneratorTest.php

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ public function test_generate_search_index_one_item(): void
3838
],
3939
];
4040

41-
self::assertEquals($expected, $actual);
41+
// Filter out documentation items for this test
42+
$apiItems = array_filter($actual, fn($item) => $item['type'] === 'api');
43+
$apiItems = array_values($apiItems); // Re-index array
44+
45+
self::assertEquals($expected, $apiItems);
4246
}
4347

4448
public function test_multiple_items_in_different_groups(): void
@@ -82,7 +86,11 @@ public function test_multiple_items_in_different_groups(): void
8286
],
8387
];
8488

85-
self::assertEquals($expected, $actual);
89+
// Filter out documentation items for this test
90+
$apiItems = array_filter($actual, fn($item) => $item['type'] === 'api');
91+
$apiItems = array_values($apiItems); // Re-index array
92+
93+
self::assertEquals($expected, $apiItems);
8694
}
8795

8896
public function test_multiple_items_in_the_same_group(): void
@@ -126,7 +134,11 @@ public function test_multiple_items_in_the_same_group(): void
126134
],
127135
];
128136

129-
self::assertEquals($expected, $actual);
137+
// Filter out documentation items for this test
138+
$apiItems = array_filter($actual, fn($item) => $item['type'] === 'api');
139+
$apiItems = array_values($apiItems); // Re-index array
140+
141+
self::assertEquals($expected, $apiItems);
130142
}
131143

132144
public function test_fn_name_with_slash_in_the_middle(): void
@@ -170,7 +182,11 @@ public function test_fn_name_with_slash_in_the_middle(): void
170182
],
171183
];
172184

173-
self::assertEquals($expected, $actual);
185+
// Filter out documentation items for this test
186+
$apiItems = array_filter($actual, fn($item) => $item['type'] === 'api');
187+
$apiItems = array_values($apiItems); // Re-index array
188+
189+
self::assertEquals($expected, $apiItems);
174190
}
175191

176192
public function test_fn_name_ending_with_minus(): void
@@ -214,7 +230,11 @@ public function test_fn_name_ending_with_minus(): void
214230
],
215231
];
216232

217-
self::assertEquals($expected, $actual);
233+
// Filter out documentation items for this test
234+
$apiItems = array_filter($actual, fn($item) => $item['type'] === 'api');
235+
$apiItems = array_values($apiItems); // Re-index array
236+
237+
self::assertEquals($expected, $apiItems);
218238
}
219239

220240
public function test_fn_name_with_upper_case(): void
@@ -258,6 +278,10 @@ public function test_fn_name_with_upper_case(): void
258278
],
259279
];
260280

261-
self::assertEquals($expected, $actual);
281+
// Filter out documentation items for this test
282+
$apiItems = array_filter($actual, fn($item) => $item['type'] === 'api');
283+
$apiItems = array_values($apiItems); // Re-index array
284+
285+
self::assertEquals($expected, $apiItems);
262286
}
263287
}

0 commit comments

Comments
 (0)