Skip to content

Commit

Permalink
Added regression test for smarty-php#639
Browse files Browse the repository at this point in the history
Modified include inline unit test to catch evaluation error.
  • Loading branch information
AnrDaemon committed Mar 22, 2021
1 parent 5c00724 commit 9ef9398
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 2 deletions.
Expand Up @@ -330,6 +330,6 @@ public function dataTestSpacing()
*/
public function testInlineStringInclude()
{
$this->assertEquals('include-inline', $this->smarty->fetch('inline_string_include.tpl'));
$this->assertEquals("include-inline\n", $this->smarty->fetch('inline_string_include.tpl'));
}
}
@@ -1 +1 @@
{include "string:include-inline" inline}
{include "string:include-inline\n" inline}
@@ -0,0 +1,38 @@
<?php
/**
* Smarty PHPunit tests compiler errors
*
* @package PHPunit
* @author Uwe Tews
*/

/**
* class for compiler tests
*
* @runTestsInSeparateProcess
* @preserveGlobalState disabled
* @backupStaticAttributes enabled
*
* Switching from block to inline include crashes render
*/
class IncludeBlockToInlineIssue639Test extends PHPUnit_Smarty
{
public function setUp()
{
$this->setUpSmarty(dirname(__FILE__));
}

public function testInit()
{
$this->cleanDirs();
}

public function testInlineFirst()
{
$this->assertEquals("include-inline\ninclude-regular\n", $this->smarty->fetch('001_inline_first.tpl'));
}
public function testInlineLast()
{
$this->assertEquals("include-regular\ninclude-inline\n", $this->smarty->fetch('002_inline_last.tpl'));
}
}
2 changes: 2 additions & 0 deletions tests/UnitTests/TemplateSource/_Issues/639/cache/.gitignore
@@ -0,0 +1,2 @@
# Ignore anything in here, but keep this directory
*
@@ -0,0 +1,2 @@
{include "string:include-inline\n" inline}
{include "string:include-regular\n"}
@@ -0,0 +1,2 @@
{include "string:include-regular\n"}
{include "string:include-inline\n" inline}
@@ -0,0 +1,2 @@
# Ignore anything in here, but keep this directory
*

0 comments on commit 9ef9398

Please sign in to comment.