// with attributes
$strategy =
new HIncludeFragmentRenderer();
$this->
assertEquals('<hx:include src="/foo" p1="v1" p2="v2">default</hx:include>',
$strategy->
render('/foo', Request::
create('/'
),
['default' => 'default', 'attributes' =>
['p1' => 'v1', 'p2' => 'v2'
]])->
getContent());
// with id & attributes
$strategy =
new HIncludeFragmentRenderer();
$this->
assertEquals('<hx:include src="/foo" p1="v1" p2="v2" id="bar">default</hx:include>',
$strategy->
render('/foo', Request::
create('/'
),
['default' => 'default', 'id' => 'bar', 'attributes' =>
['p1' => 'v1', 'p2' => 'v2'
]])->
getContent());
} public function testRenderWithTwigAndDefaultText() { $twig =
new Environment($loader =
new ArrayLoader());
$strategy =
new HIncludeFragmentRenderer($twig);
$this->
assertEquals('<hx:include src="/foo">loading...</hx:include>',
$strategy->
render('/foo', Request::
create('/'
),
['default' => 'loading...'
])->
getContent());
}}