@@ -39,6 +39,7 @@ public function testXml()
3939 */
4040 public function testXmlPhpQuote ()
4141 {
42+ $ this ->smarty ->compile_id = 'PHP_QUOTE ' ;
4243 $ this ->smarty ->security_policy ->php_handling = Smarty::PHP_QUOTE ;
4344 $ tpl = $ this ->smarty ->createTemplate ('xml.tpl ' );
4445 $ this ->assertEquals ('<?xml version="1.0" encoding="UTF-8"?> ' , $ this ->smarty ->fetch ($ tpl ));
@@ -49,13 +50,14 @@ public function testXmlPhpQuote()
4950 */
5051 public function testXmlPhpAllow ()
5152 {
53+ $ this ->smarty ->compile_id = 'PHP_ALLOW ' ;
5254 $ this ->smarty ->security_policy ->php_handling = Smarty::PHP_ALLOW ;
5355 $ tpl = $ this ->smarty ->createTemplate ('xml.tpl ' );
5456 $ this ->assertEquals ('<?xml version="1.0" encoding="UTF-8"?> ' , $ this ->smarty ->fetch ($ tpl ));
5557 }
5658
5759 /**
58- * test standard xml
60+ * test xml caching
5961 */
6062 public function testXmlCaching ()
6163 {
@@ -66,27 +68,57 @@ public function testXmlCaching()
6668 $ this ->assertEquals ('<?xml version="1.0" encoding="UTF-8"?> ' , $ content );
6769 }
6870
69- /*
70- * test standard xml
71- */
71+ /**
72+ * test xml caching PhpQuote
73+ */
7274 public function testXmlCachingPhpQuote ()
7375 {
76+ $ this ->smarty ->compile_id = 'PHP_QUOTE ' ;
7477 $ this ->smarty ->security_policy ->php_handling = Smarty::PHP_QUOTE ;
7578 $ this ->smarty ->caching = true ;
7679 $ this ->smarty ->cache_lifetime = 1000 ;
7780 $ content = $ this ->smarty ->fetch ('xml.tpl ' );
7881 $ this ->assertEquals ('<?xml version="1.0" encoding="UTF-8"?> ' , $ content );
7982 }
8083
81- /*
82- * test standard xml
83- */
84+ /**
85+ * test xml caching PhpAllow
86+ */
8487 public function testXmlCachingPhpAllow ()
8588 {
89+ $ this ->smarty ->compile_id = 'PHP_ALLOW ' ;
8690 $ this ->smarty ->security_policy ->php_handling = Smarty::PHP_ALLOW ;
8791 $ this ->smarty ->caching = true ;
8892 $ this ->smarty ->cache_lifetime = 1000 ;
8993 $ content = $ this ->smarty ->fetch ('xml.tpl ' );
9094 $ this ->assertEquals ('<?xml version="1.0" encoding="UTF-8"?> ' , $ content );
9195 }
96+ /**
97+ * test xml with variable
98+ */
99+ public function testXmlVariable ()
100+ {
101+ $ this ->smarty ->assign ('foo ' ,'bar ' );
102+ $ content = $ this ->smarty ->fetch ('xmlvar.tpl ' );
103+ $ this ->assertEquals ('<?xml version="1.0" encoding="bar"?> ' , $ content );
104+ }
105+ /**
106+ * test xml with nocache variable
107+ */
108+ public function testXmlVariableNocache1 ()
109+ {
110+ $ this ->smarty ->caching = true ;
111+ $ this ->smarty ->cache_lifetime = 1000 ;
112+ $ this ->smarty ->assign ('foo ' ,'bar ' ,true );
113+ $ content = $ this ->smarty ->fetch ('xmlvar.tpl ' );
114+ $ this ->assertEquals ('<?xml version="1.0" encoding="bar"?> ' , $ content );
115+ }
116+ public function testXmlVariableNocache2 ()
117+ {
118+ $ this ->smarty ->caching = true ;
119+ $ this ->smarty ->cache_lifetime = 1000 ;
120+ $ this ->smarty ->assign ('foo ' ,'foo ' ,true );
121+ $ content = $ this ->smarty ->fetch ('xmlvar.tpl ' );
122+ $ this ->assertEquals ('<?xml version="1.0" encoding="foo"?> ' , $ content );
123+ }
92124}
0 commit comments