@@ -220,6 +220,64 @@ public function testRenderPreservesFullContextWhenBoundingPreview(string $value,
220220 );
221221 }
222222
223+ #[DataProviderExternal(EventInspectorRendererProvider::class, 'numericGroupKeys ' )]
224+ public function testRenderPreservesNumericGroupKeys (string $ attribute , string $ value , bool $ withFilter ): void
225+ {
226+ $ row = new EventRow (
227+ 10.0 ,
228+ $ attribute === 'name ' ? $ value : 'event ' ,
229+ $ attribute === 'class ' ? $ value : 'Event ' ,
230+ '0 ' ,
231+ $ attribute === 'senderClass ' ? $ value : 'Worker ' ,
232+ );
233+
234+ $ eventAttribute = $ attribute === 'class ' ? 'class ' : 'name ' ;
235+ $ filters = [];
236+
237+ $ filterUrl = static function (string $ attribute , string $ value ) use (&$ filters ): string {
238+ $ filters [] = [$ attribute , $ value ];
239+
240+ return "/debug? {$ attribute }= {$ value }" ;
241+ };
242+
243+ $ html = EventInspectorRenderer::render (
244+ [$ row , $ row ],
245+ [],
246+ $ withFilter ? $ filterUrl : null ,
247+ $ eventAttribute ,
248+ 'Coverage ' ,
249+ );
250+
251+ self ::assertStringContainsString (
252+ "<span title= \"{$ value }\"><strong> {$ value }</strong></span><span>2</span> " ,
253+ $ html ,
254+ 'Numeric group labels must retain their original string representation and complete capture count. ' ,
255+ );
256+ self ::assertSame (
257+ 2 ,
258+ substr_count ($ html , 'class="yii-debug-event-group" ' ),
259+ 'Repeated observations must share one event group and one source group. ' ,
260+ );
261+ self ::assertSame (
262+ $ withFilter
263+ ? [
264+ [$ eventAttribute , $ eventAttribute === 'class ' ? $ row ->class : $ row ->name ],
265+ ['senderClass ' , $ row ->senderClass ],
266+ ]
267+ : [],
268+ $ filters ,
269+ 'Filter callbacks must receive the original group values as strings. ' ,
270+ );
271+
272+ if ($ withFilter ) {
273+ self ::assertStringContainsString (
274+ "href= \"/debug? {$ attribute }= {$ value }\"" ,
275+ $ html ,
276+ 'Numeric group links must retain their filter attribute and value. ' ,
277+ );
278+ }
279+ }
280+
223281 public function testRenderUsesEventClassAsNameWithoutInspection (): void
224282 {
225283 $ row = new EventRow (10.0 , 'App \\Started ' , 'App \\Started ' , '1 ' , '' );
0 commit comments