PhroznTest\Processor\TwigTest::testRenderConstructorInjection PHP Method

testRenderConstructorInjection() public method

    public function testRenderConstructorInjection()
    {
        $cache_dir = dirname(__FILE__) . '/templates/cache/';
        $processor = $this->getProcessor($this->path . 'tpl1.twig', array('cache' => $cache_dir));
        $template = file_get_contents($this->path . 'tpl1.twig');
        $rendered = $processor->render($template, array('a_variable' => 'Aha!', 'navigation' => array(array('href' => 'link1', 'caption' => 'caption1'), array('href' => 'link1', 'caption' => 'caption1'))));
        $static = file_get_contents(dirname(__FILE__) . '/templates/tpl1.html');
        $this->assertSame(trim($static), trim($rendered));
        $processor->cleanup();
        // purge cache
        `touch {$cache_dir}README`;
        // cache clears all files
    }