Files
smarty/tests/UnitTests/A_Core/LoadPlugin/IncludePathTest.php
Simon Wisselink 17d4d43624 Feature/merge smarty-phpunit into tests subfolder (#580)
* 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>
2020-04-13 15:30:52 +02:00

52 lines
1.5 KiB
PHP

<?php
/**
* Smarty PHPunit tests for File resources
*
* @package PHPunit
* @author Rodney Rehm
* @runTestsInSeparateProcess
* @preserveGlobalState disabled
* @backupStaticAttributes enabled
*/
class IncludePathTest extends PHPUnit_Smarty
{
public function setUp()
{
$this->setUpSmarty(dirname(__FILE__));
$this->smarty->use_include_path = true;
$this->smarty->setPluginsDir(array('./include','./include1'));
$this->smarty->enableSecurity();
$ds = DIRECTORY_SEPARATOR;
set_include_path($this->smarty->_realpath(dirname(__FILE__) . "{$ds}..{$ds}..{$ds}..{$ds}Include_Path{$ds}Plugins{$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('plugin1', $this->smarty->fetch('test_include_path1.tpl'));
}
public function testInclude2()
{
$this->assertContains('plugin2', $this->smarty->fetch('test_include_path2.tpl'));
}
public function testInclude3()
{
$this->assertContains('plugin3', $this->smarty->fetch('test_include_path3.tpl'));
}
}