This commit is contained in:
Nicolas Grekas
2015-09-10 11:05:53 +02:00
parent 37c006f7a7
commit ff9afa0dc3
2 changed files with 5 additions and 48 deletions
+5 -3
View File
@@ -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 }}
//