From ff9afa0dc37c20a8b46ce6f74b40126b876b00be Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 10 Sep 2015 11:05:53 +0200 Subject: [PATCH] Fix test --- test/Twig/Tests/EnvironmentTest.php | 8 ++-- .../Tests/Fixtures/environment-compile.php | 45 ------------------- 2 files changed, 5 insertions(+), 48 deletions(-) delete mode 100644 test/Twig/Tests/Fixtures/environment-compile.php diff --git a/test/Twig/Tests/EnvironmentTest.php b/test/Twig/Tests/EnvironmentTest.php index 21a62ab1e..77b29c899 100644 --- a/test/Twig/Tests/EnvironmentTest.php +++ b/test/Twig/Tests/EnvironmentTest.php @@ -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')); - $expected = file_get_contents(dirname(__FILE__).'/Fixtures/environment-compile.php'); - $this->assertSame($expected, $twig->compileSource("{{ foo }}\n{{ bar }}\n", 'index')); + $source = "{{ foo }}\n{{ bar }}\n"; + $expected = "// {{ foo }}\n// {{ bar }}\n// \n"; + + $this->assertContains($expected, $twig->compileSource($source, 'index')); } public function testExtensionsAreNotInitializedWhenRenderingACompiledTemplate() diff --git a/test/Twig/Tests/Fixtures/environment-compile.php b/test/Twig/Tests/Fixtures/environment-compile.php deleted file mode 100644 index 169df8c41..000000000 --- a/test/Twig/Tests/Fixtures/environment-compile.php +++ /dev/null @@ -1,45 +0,0 @@ -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 }} -//