add test for config variable overloading

This commit is contained in:
uwetews
2016-10-27 05:28:23 +02:00
parent 8e42150426
commit 6c5e729c9c
5 changed files with 21 additions and 3 deletions

View File

@@ -104,12 +104,22 @@ class CompileConfigLoadTest extends PHPUnit_Smarty
} }
/** /**
* @runInSeparateProcess * @run InSeparateProcess
* @preserveGlobalState disabled * @preserveGlobalState disabled
*/ */
public function testConfigVariableOverwrite_006() public function testConfigVariableOverwrite_006()
{ {
$this->assertEquals("Overwrite3", $this->smarty->fetch('006_overwrite.tpl')); $this->assertEquals("Welcome to Smarty! Overwrite3", $this->smarty->fetch('006_overwrite.tpl'));
}
/**
* @run InSeparateProcess
* @preserveGlobalState disabled
*/
public function testConfigVariableOverwrite_0061()
{
$this->smarty->configLoad('test.conf', 'default');
$this->smarty->configLoad('test2.conf', 'default');
$this->assertEquals('Welcome to overwrite test! this overwitten', $this->smarty->fetch('0061_overwrite.tpl'));
} }
/** /**

View File

@@ -29,6 +29,10 @@ sec = section foo/bar
[section1] [section1]
sec1 = Hello Section1 sec1 = Hello Section1
[default]
title = Welcome to overwrite test!
over = shall not show
[section2] [section2]
sec2 = 'Hello Section2' sec2 = 'Hello Section2'

View File

@@ -1,2 +1,5 @@
overwrite = Overwrite3 overwrite = Overwrite3
[default]
over = this overwitten

View File

@@ -0,0 +1 @@
{#title#} {#over#}

View File

@@ -1 +1 @@
{config_load 'test.conf'}{config_load 'test2.conf'}{#overwrite#} {config_load 'test.conf'}{config_load 'test2.conf'}{#title#} {#overwrite#}