mirror of
				https://github.com/smarty-php/smarty.git
				synced 2025-10-31 20:31:41 +01:00 
			
		
		
		
	* Removed unneeded files and replace dummy.txt with .gitignore files * Synced unit tests with master codebase, noted TODO's, fixed phpunit scripts and travis config * fix php7.4 deprecation and remove php7.4 from travis allow_failures since php7.4 is current stable Co-authored-by: Uwe Tews <uwe.tews@googlemail.com> Co-authored-by: Uwe Tews <uwe.tews@gmail.com> Co-authored-by: AnrDaemon <anrdaemon@yandex.ru>
		
			
				
	
	
		
			68 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			68 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| /**
 | |
|  * Smarty PHPunit tests for File resources
 | |
|  *
 | |
|  * @package                PHPunit
 | |
|  * @author                 Rodney Rehm
 | |
|  * @runTestsInSeparateProcess
 | |
|  * @preserveGlobalState disabled
 | |
|  * @backupStaticAttributes enabled
 | |
|  */
 | |
| class FileIncludePathTest extends PHPUnit_Smarty
 | |
| {
 | |
|     public function setUp()
 | |
|     {
 | |
|         $this->setUpSmarty(dirname(__FILE__));
 | |
|         $this->smarty->use_include_path = true;
 | |
|         $this->smarty->setTemplateDir(array('./templates', './templates_2', './include'));
 | |
|         $this->smarty->enableSecurity();
 | |
|         $ds = DIRECTORY_SEPARATOR;
 | |
|         set_include_path($this->smarty->_realpath(dirname(__FILE__) . "{$ds}..{$ds}..{$ds}..{$ds}Include_Path{$ds}Tpl{$ds}", true) . PATH_SEPARATOR . get_include_path());
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Tears down the fixture
 | |
|      * This method is called after a test is executed.
 | |
|      *
 | |
|      */
 | |
|     protected function tearDown()
 | |
|     {
 | |
|         ini_restore('include_path');
 | |
|         $this->smarty->disableSecurity();
 | |
|         parent::tearDown();
 | |
|      }
 | |
|     public function testInit()
 | |
|     {
 | |
|         $this->cleanDirs();
 | |
|     }
 | |
|     public function testInclude1()
 | |
|     {
 | |
|         $this->assertContains('include_test1', $this->smarty->fetch('test1.tpl'));
 | |
|     }
 | |
|     public function testInclude2()
 | |
|     {
 | |
|         $this->assertContains('include_test2', $this->smarty->fetch('test2.tpl'));
 | |
|     }
 | |
|     public function testInclude3()
 | |
|     {
 | |
|         $this->assertContains('include_test3', $this->smarty->fetch('test3.tpl'));
 | |
|     }
 | |
|     public function testInclude31()
 | |
|     {
 | |
|         $this->smarty->use_include_path = false;
 | |
|         $this->smarty->security_policy->secure_dir = getcwd();
 | |
|         $this->assertContains('include_test3', $this->smarty->fetch('test3.tpl'));
 | |
|     }
 | |
|     public function testInclude4()
 | |
|     {
 | |
|         $this->assertContains('include_test4', $this->smarty->fetch('test4.tpl'));
 | |
|     }
 | |
|     public function testInclude5()
 | |
|     {
 | |
|         $this->smarty->setTemplateDir(array('./'));
 | |
|         $this->assertContains('include path root', $this->smarty->fetch('test5.tpl'));
 | |
|     }
 | |
| 
 | |
|  }
 |