@@ -465,19 +465,33 @@ public function testNestedAttributes()
465465 $ this ->assertSame ($ tokens [$ attribute ]['attribute_opener ' ], $ tokens [$ closer ]['attribute_opener ' ]);
466466 $ this ->assertSame ($ tokens [$ attribute ]['attribute_closer ' ], $ tokens [$ closer ]['attribute_closer ' ]);
467467
468- $ test = function (array $ tokens , $ length ) use ($ attribute ) {
468+ $ this ->assertArrayNotHasKey ('nested_attributes ' , $ tokens [$ attribute ]);
469+ $ this ->assertArrayHasKey ('nested_attributes ' , $ tokens [($ attribute + 8 )]);
470+ $ this ->assertSame ([$ attribute => ($ attribute + 24 )], $ tokens [($ attribute + 8 )]['nested_attributes ' ]);
471+
472+ $ test = function (array $ tokens , $ length , $ nestedMap ) use ($ attribute ) {
469473 foreach ($ tokens as $ token ) {
470474 $ this ->assertArrayHasKey ('attribute_closer ' , $ token );
471475 $ this ->assertSame (($ attribute + $ length ), $ token ['attribute_closer ' ]);
476+ $ this ->assertSame ($ nestedMap , $ token ['nested_attributes ' ]);
472477 }
473478 };
474479
475- $ test (array_slice ($ tokens , ($ attribute + 1 ), 7 ), 24 );
480+ $ test (array_slice ($ tokens , ($ attribute + 1 ), 7 ), 24 , [$ attribute => $ attribute + 24 ]);
481+ $ test (array_slice ($ tokens , ($ attribute + 8 ), 1 ), 8 + 5 , [$ attribute => $ attribute + 24 ]);
476482
477483 // Length here is 8 (nested attribute offset) + 5 (real length).
478- $ test (array_slice ($ tokens , ($ attribute + 8 ), 6 ), 8 + 5 );
484+ $ test (
485+ array_slice ($ tokens , ($ attribute + 9 ), 4 ),
486+ 8 + 5 ,
487+ [
488+ $ attribute => $ attribute + 24 ,
489+ $ attribute + 8 => $ attribute + 13 ,
490+ ]
491+ );
479492
480- $ test (array_slice ($ tokens , ($ attribute + 14 ), 11 ), 24 );
493+ $ test (array_slice ($ tokens , ($ attribute + 13 ), 1 ), 8 + 5 , [$ attribute => $ attribute + 24 ]);
494+ $ test (array_slice ($ tokens , ($ attribute + 14 ), 10 ), 24 , [$ attribute => $ attribute + 24 ]);
481495
482496 $ map = array_map (
483497 static function ($ token ) {
0 commit comments