From b08b8f1d3a007458cebcfc3d0c3bb538d89f72be Mon Sep 17 00:00:00 2001 From: uwetews Date: Sun, 27 Mar 2016 18:34:13 +0200 Subject: [PATCH] Update capture test --- .../TemplateSource/TagTests/Capture/CompileCaptureTest.php | 7 +++++++ .../TagTests/Capture/templates/009_capture.tpl | 2 ++ .../TagTests/Capture/templates/009_capture_include.tpl | 1 + 3 files changed, 10 insertions(+) create mode 100644 tests/UnitTests/TemplateSource/TagTests/Capture/templates/009_capture.tpl create mode 100644 tests/UnitTests/TemplateSource/TagTests/Capture/templates/009_capture_include.tpl diff --git a/tests/UnitTests/TemplateSource/TagTests/Capture/CompileCaptureTest.php b/tests/UnitTests/TemplateSource/TagTests/Capture/CompileCaptureTest.php index 9d20f313..c2e9b30a 100644 --- a/tests/UnitTests/TemplateSource/TagTests/Capture/CompileCaptureTest.php +++ b/tests/UnitTests/TemplateSource/TagTests/Capture/CompileCaptureTest.php @@ -78,6 +78,13 @@ class CompileCaptureTest extends PHPUnit_Smarty $tpl = $this->smarty->createTemplate('eval:{capture assign=foo}hello {capture assign=bar}this is my {/capture}world{/capture}{$foo} {$bar}'); $this->assertEquals("hello world this is my ", $this->smarty->fetch($tpl), 'This failure pops up only during PHPunit test ?????'); } + /* + * Test that capture results are global + */ + public function testCapture9() + { + $this->assertContains('-->hello world<--', $this->smarty->fetch('009_capture.tpl')); + } public function testCompileCaptureNocache1() { diff --git a/tests/UnitTests/TemplateSource/TagTests/Capture/templates/009_capture.tpl b/tests/UnitTests/TemplateSource/TagTests/Capture/templates/009_capture.tpl new file mode 100644 index 00000000..9526623d --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/Capture/templates/009_capture.tpl @@ -0,0 +1,2 @@ +{capture name='test'}hello world{/capture} +{include '009_capture_include.tpl'} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Capture/templates/009_capture_include.tpl b/tests/UnitTests/TemplateSource/TagTests/Capture/templates/009_capture_include.tpl new file mode 100644 index 00000000..f88ac6a2 --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/Capture/templates/009_capture_include.tpl @@ -0,0 +1 @@ +-->{$smarty.capture.test}<-- \ No newline at end of file