HIncludeFragmentRenderer example

use Symfony\Component\HttpKernel\Controller\ControllerReference;
use Symfony\Component\HttpKernel\Fragment\HIncludeFragmentRenderer;
use Symfony\Component\HttpKernel\UriSigner;
use Twig\Environment;
use Twig\Loader\ArrayLoader;

class HIncludeFragmentRendererTest extends TestCase
{
    public function testRenderExceptionWhenControllerAndNoSigner()
    {
        $this->expectException(\LogicException::class);
        $strategy = new HIncludeFragmentRenderer();
        $strategy->render(new ControllerReference('main_controller', [][]), Request::create('/'));
    }

    public function testRenderWithControllerAndSigner()
    {
        $strategy = new HIncludeFragmentRenderer(null, new UriSigner('foo'));

        $this->assertEquals('<hx:include src="/_fragment?_hash=BP%2BOzCD5MRUI%2BHJpgPDOmoju00FnzLhP3TGcSHbbBLs%3D&amp;_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dmain_controller"></hx:include>', $strategy->render(new ControllerReference('main_controller', [][]), Request::create('/'))->getContent());
    }

    public function testRenderWithUri()
    {
Home | Imprint | This part of the site doesn't use cookies.