From 5fb73cd3c1b7bcf2108cc93157a5e62f97f78299 Mon Sep 17 00:00:00 2001 From: Uwe Tews Date: Wed, 21 Mar 2018 15:17:56 +0100 Subject: [PATCH] short form of {section} attributes did not work https://github.com/smarty-php/smarty/issues/428 --- ...ctionPropertiesShortSyntaxIssue428Test.php | 42 +++++++++++++++++++ .../_Issues/428/cache/dummy.txt | 1 + .../_Issues/428/templates/001_section.tpl | 1 + .../_Issues/428/templates/002_section.tpl | 1 + .../_Issues/428/templates_c/dummy.txt | 1 + 5 files changed, 46 insertions(+) create mode 100644 tests/UnitTests/TemplateSource/_Issues/428/SectionPropertiesShortSyntaxIssue428Test.php create mode 100644 tests/UnitTests/TemplateSource/_Issues/428/cache/dummy.txt create mode 100644 tests/UnitTests/TemplateSource/_Issues/428/templates/001_section.tpl create mode 100644 tests/UnitTests/TemplateSource/_Issues/428/templates/002_section.tpl create mode 100644 tests/UnitTests/TemplateSource/_Issues/428/templates_c/dummy.txt diff --git a/tests/UnitTests/TemplateSource/_Issues/428/SectionPropertiesShortSyntaxIssue428Test.php b/tests/UnitTests/TemplateSource/_Issues/428/SectionPropertiesShortSyntaxIssue428Test.php new file mode 100644 index 00000000..7c900349 --- /dev/null +++ b/tests/UnitTests/TemplateSource/_Issues/428/SectionPropertiesShortSyntaxIssue428Test.php @@ -0,0 +1,42 @@ +setUpSmarty(dirname(__FILE__)); + } + + public function testInit() + { + $this->cleanDirs(); + } + + public function testSection_001() + { + $this->smarty->assign('foo', array('a', 'b', 'c')); + $this->assertEquals('abc', $this->smarty->fetch('001_section.tpl')); + } + public function testSection_002() + { + $this->smarty->assign('foo', array('a', 'b', 'c')); + $this->assertEquals('abc', $this->smarty->fetch('002_section.tpl')); + } + + +} diff --git a/tests/UnitTests/TemplateSource/_Issues/428/cache/dummy.txt b/tests/UnitTests/TemplateSource/_Issues/428/cache/dummy.txt new file mode 100644 index 00000000..2995a4d0 --- /dev/null +++ b/tests/UnitTests/TemplateSource/_Issues/428/cache/dummy.txt @@ -0,0 +1 @@ +dummy \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/_Issues/428/templates/001_section.tpl b/tests/UnitTests/TemplateSource/_Issues/428/templates/001_section.tpl new file mode 100644 index 00000000..ea6dc9ab --- /dev/null +++ b/tests/UnitTests/TemplateSource/_Issues/428/templates/001_section.tpl @@ -0,0 +1 @@ +{section name=bar loop=$foo}{$foo[bar.index]}{sectionelse} else {/section} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/_Issues/428/templates/002_section.tpl b/tests/UnitTests/TemplateSource/_Issues/428/templates/002_section.tpl new file mode 100644 index 00000000..4a49fc9e --- /dev/null +++ b/tests/UnitTests/TemplateSource/_Issues/428/templates/002_section.tpl @@ -0,0 +1 @@ +{section name=bar loop=$foo}{$foo[bar]}{sectionelse} else {/section} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/_Issues/428/templates_c/dummy.txt b/tests/UnitTests/TemplateSource/_Issues/428/templates_c/dummy.txt new file mode 100644 index 00000000..2995a4d0 --- /dev/null +++ b/tests/UnitTests/TemplateSource/_Issues/428/templates_c/dummy.txt @@ -0,0 +1 @@ +dummy \ No newline at end of file