cvs: smarty /unit_test test_cases.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1081772499@cvsserver>
messju		Mon Apr 12 08:21:39 2004 EDT

  Modified files:              
    /smarty/unit_test	test_cases.php 
  Log:
  added test-cases for smarty_core_is_secure()
  
  
http://cvs.php.net/diff.php/smarty/unit_test/test_cases.php?r1=1.6&r2=1.7&ty=u
Index: smarty/unit_test/test_cases.php
diff -u smarty/unit_test/test_cases.php:1.6 smarty/unit_test/test_cases.php:1.7
--- smarty/unit_test/test_cases.php:1.6	Tue Mar 23 05:47:06 2004
+++ smarty/unit_test/test_cases.php	Mon Apr 12 08:21:39 2004
@@ -307,6 +307,45 @@
         $this->assertEquals('\\r\\n\\\\', $string);
     }
 
+
+    function test_core_is_secure_file_exists() {
+        $file = SMARTY_DIR . 'core/core.is_secure.php';
+        $this->assertTrue(file_exists($file));
+    }
+
+    function test_core_is_secure_file_include() {
+        $file = SMARTY_DIR . 'core/core.is_secure.php';
+        $this->assertTrue(include($file));
+    }
+
+    function test_core_is_secure_function_exists() {
+        $this->assertTrue(function_exists('smarty_core_is_secure'));
+    }
+
+    function test_core_is_secure_function_is_secure_true() {
+        $security = $this->smarty->security;
+        $this->smarty->security = true;
+
+        /* check if index.tpl is secure (should be true) */
+        $params = array('resource_type' => 'file',
+                        'resource_base_path' => dirname(__FILE__) . '/templates',
+                        'resource_name' => dirname(__FILE__) . '/templates/index.tpl');
+        $this->assertTrue(smarty_core_is_secure($params, $this->smarty));
+        $this->smarty->security = $security;
+    }
+
+    function test_core_is_secure_function_is_secure_false() {
+        $security = $this->smarty->security;
+        $this->smarty->security = true;
+        /* check if test_cases.php is secure (should be false) */
+        $params = array('resource_type' => 'file',
+                        'resource_base_path' => dirname(__FILE__) . '/templates',
+                        'resource_name' => __FILE__);
+        $this->assertFalse(smarty_core_is_secure($params, $this->smarty));
+        $this->smarty->security = $security;
+
+    }
     
   }
+
 ?>

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.