@@ -474,21 +474,26 @@ public function testCanRenderWithChildViewModel()
474474 $ path = __DIR__ . '/TestAsset ' ;
475475 $ renderer = new ZendViewRenderer ();
476476 $ renderer ->addPath ($ path );
477- $ viewModelParent = new ViewModel ();
477+
478478 $ viewModelChild = new ViewModel ();
479479 $ viewModelChild ->setTemplate ('zendview-null ' );
480+
481+ $ viewModelParent = new ViewModel ();
480482 $ viewModelParent ->setVariables ([
481- 'layout ' => 'zendview-layout ' ,
483+ 'layout ' => 'zendview-layout ' ,
482484 ]);
483485 $ viewModelParent ->addChild ($ viewModelChild , 'name ' );
486+
484487 $ result = $ renderer ->render ('zendview ' , $ viewModelParent );
485488
486- $ content = file_get_contents ("$ path/zendview-null.phtml " );
487- $ contentParent = file_get_contents ("$ path/zendview.phtml " );
488- $ contentParentLayout = file_get_contents ("$ path/zendview-layout.phtml " );
489- //trim is used here, because rendering engine is trimming content too
489+ $ content = file_get_contents (sprintf ('%s/zendview-null.phtml ' , $ path ));
490+ $ contentParent = file_get_contents (sprintf ('%s/zendview.phtml ' , $ path ));
491+ $ contentParentLayout = file_get_contents (sprintf ('%s/zendview-layout.phtml ' , $ path ));
492+
493+ // trim is used here, because rendering engine is trimming content too
490494 $ content = trim (str_replace ('<?php echo $name ?> ' , $ content , $ contentParent ));
491495 $ content = str_replace ('<?= $this->content ?> ' , $ content , $ contentParentLayout );
496+
492497 $ this ->assertEquals ($ content , $ result );
493498 }
494499}
0 commit comments