testRenderView example

->expects(static::once())
            ->method('render')
            ->with('storefront-view.html.twig', ['foo' => 'bar'])
            ->willReturn('<html lang="en">test</html>');

        $container = new ContainerBuilder();
        $container->set(TemplateFinder::class$templateFinder);

        $this->controller->setContainer($container);
        $this->controller->setTwig($twig);

        $response = $this->controller->testRenderView('test.html.twig', ['foo' => 'bar']);

        static::assertSame('<html lang="en">test</html>', $response);
    }

    public function testRenderViewWithoutTwigThrows(): void
    {
        $templateFinder = static::createMock(TemplateFinder::class);
        $templateFinder
            ->expects(static::once())
            ->method('find')
            ->with('test.html.twig')
            
Home | Imprint | This part of the site doesn't use cookies.