mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 11:27:00 +00:00
Fix test
This commit is contained in:
@@ -138,12 +138,14 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCompileSource()
|
public function testCompileSourceInlinesSource()
|
||||||
{
|
{
|
||||||
$twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'));
|
$twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'));
|
||||||
|
|
||||||
$expected = file_get_contents(dirname(__FILE__).'/Fixtures/environment-compile.php');
|
$source = "{{ foo }}\n{{ bar }}\n";
|
||||||
$this->assertSame($expected, $twig->compileSource("{{ foo }}\n{{ bar }}\n", 'index'));
|
$expected = "// {{ foo }}\n// {{ bar }}\n// \n";
|
||||||
|
|
||||||
|
$this->assertContains($expected, $twig->compileSource($source, 'index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testExtensionsAreNotInitializedWhenRenderingACompiledTemplate()
|
public function testExtensionsAreNotInitializedWhenRenderingACompiledTemplate()
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/* index */
|
|
||||||
class __TwigTemplate_e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 extends Twig_Template
|
|
||||||
{
|
|
||||||
public function __construct(Twig_Environment $env)
|
|
||||||
{
|
|
||||||
parent::__construct($env);
|
|
||||||
|
|
||||||
$this->parent = false;
|
|
||||||
|
|
||||||
$this->blocks = array(
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function doDisplay(array $context, array $blocks = array())
|
|
||||||
{
|
|
||||||
// line 1
|
|
||||||
echo twig_escape_filter($this->env, (isset($context["foo"]) ? $context["foo"] : null), "html", null, true);
|
|
||||||
echo "
|
|
||||||
";
|
|
||||||
// line 2
|
|
||||||
echo twig_escape_filter($this->env, (isset($context["bar"]) ? $context["bar"] : null), "html", null, true);
|
|
||||||
echo "
|
|
||||||
";
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTemplateName()
|
|
||||||
{
|
|
||||||
return "index";
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isTraitable()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDebugInfo()
|
|
||||||
{
|
|
||||||
return array ( 23 => 2, 19 => 1,);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// {{ foo }}
|
|
||||||
// {{ bar }}
|
|
||||||
//
|
|
||||||
Reference in New Issue
Block a user