NoTemplatingEntryKernel example

use Symfony\Bundle\TwigBundle\Tests\TestCase;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\Kernel;

class NoTemplatingEntryTest extends TestCase
{
    public function test()
    {
        $kernel = new NoTemplatingEntryKernel('dev', true);
        $kernel->boot();

        $container = $kernel->getContainer();
        $content = $container->get('twig.alias')->render('index.html.twig');
        $this->assertStringContainsString('{ a: b }', $content);
    }

    protected function setUp(): void
    {
        $this->deleteTempDir();
    }

    
Home | Imprint | This part of the site doesn't use cookies.