File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -480,9 +480,10 @@ public function renderSection(string $sectionName)
480480 return ;
481481 }
482482
483- foreach ($ this ->sections [$ sectionName ] as $ contents )
483+ foreach ($ this ->sections [$ sectionName ] as $ key => $ contents )
484484 {
485485 echo $ contents ;
486+ unset($ this ->sections [$ sectionName ][$ key ]);
486487 }
487488 }
488489
Original file line number Diff line number Diff line change @@ -276,6 +276,18 @@ public function testRenderLayoutExtendsCorrectly()
276276 $ this ->assertContains ($ expected , $ view ->render ('extend ' ));
277277 }
278278
279+ public function testRenderLayoutExtendsMultipleCalls ()
280+ {
281+ $ view = new View ($ this ->config , $ this ->viewsDir , $ this ->loader );
282+
283+ $ view ->setVar ('testString ' , 'Hello World ' );
284+ $ expected = "<p>Open</p> \n<h1>Hello World</h1> \n<p>Hello World</p> " ;
285+
286+ $ view ->render ('extend ' );
287+
288+ $ this ->assertContains ($ expected , $ view ->render ('extend ' ));
289+ }
290+
279291 public function testRenderLayoutMakesDataAvailableToBoth ()
280292 {
281293 $ view = new View ($ this ->config , $ this ->viewsDir , $ this ->loader );
You can’t perform that action at this time.
0 commit comments