summaryrefslogtreecommitdiff
path: root/tests/UnitTests/ResourceTests
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.uk>2026-05-09 20:22:12 +0100
committerGitHub <noreply@github.com>2026-05-09 20:22:12 +0100
commit83d593730b8cc305da96552307afb1d0c4e58883 (patch)
tree643997400b6beeace5f90cddedbbfb4137c7873a /tests/UnitTests/ResourceTests
parentdd391e1e8bada3f98c685f5e43289adc28ef684f (diff)
parentc139883770b12f92c9b21f69c35ad600d34f39e8 (diff)
downloadsmarty-83d593730b8cc305da96552307afb1d0c4e58883.tar.gz
smarty-83d593730b8cc305da96552307afb1d0c4e58883.tar.bz2
smarty-83d593730b8cc305da96552307afb1d0c4e58883.zip
Merge pull request #2 from smarty-php/master
Sync with master
Diffstat (limited to 'tests/UnitTests/ResourceTests')
-rw-r--r--tests/UnitTests/ResourceTests/Custom/Ambiguous/CustomResourceAmbiguousTest.php4
-rw-r--r--tests/UnitTests/ResourceTests/Custom/Ambiguous/cache/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/Custom/Ambiguous/templates_c/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/ResourceExtendsAllPluginTest.php6
-rw-r--r--tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/cache/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/resources/resource.extendsall.php66
-rw-r--r--tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/templates_c/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/Custom/DemoPluginMysql/ResourceMysqlPluginTest.php10
-rw-r--r--tests/UnitTests/ResourceTests/Custom/DemoPluginMysql/cache/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/Custom/DemoPluginMysql/templates_c/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/DefaultHandler/DefaultTemplateHandlerTest.php4
-rw-r--r--tests/UnitTests/ResourceTests/DefaultHandler/cache/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/DefaultHandler/templates_c/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/Eval/EvalResourceTest.php13
-rw-r--r--tests/UnitTests/ResourceTests/Eval/cache/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/Eval/templates_c/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/Extends/ExtendsResourceTest.php4
-rw-r--r--tests/UnitTests/ResourceTests/Extends/cache/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/Extends/templates_c/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/File/FileResourceTest.php57
-rw-r--r--tests/UnitTests/ResourceTests/File/cache/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/File/templates_c/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/FileIndexed/FileResourceIndexedTest.php5
-rw-r--r--tests/UnitTests/ResourceTests/FileIndexed/cache/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/FileIndexed/templates_c/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/Registered/RegisteredResourceTest.php4
-rw-r--r--tests/UnitTests/ResourceTests/Registered/cache/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/Registered/templates_c/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/ResourcePlugins/ResourcePluginTest.php4
-rw-r--r--tests/UnitTests/ResourceTests/ResourcePlugins/cache/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/ResourcePlugins/templates_c/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/Stream/StreamResourceTest.php13
-rw-r--r--tests/UnitTests/ResourceTests/Stream/cache/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/Stream/templates_c/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/String/StringResourceTest.php13
-rw-r--r--tests/UnitTests/ResourceTests/String/cache/.gitignore2
-rw-r--r--tests/UnitTests/ResourceTests/String/templates_c/.gitignore2
37 files changed, 92 insertions, 159 deletions
diff --git a/tests/UnitTests/ResourceTests/Custom/Ambiguous/CustomResourceAmbiguousTest.php b/tests/UnitTests/ResourceTests/Custom/Ambiguous/CustomResourceAmbiguousTest.php
index 610d8de3..d5413031 100644
--- a/tests/UnitTests/ResourceTests/Custom/Ambiguous/CustomResourceAmbiguousTest.php
+++ b/tests/UnitTests/ResourceTests/Custom/Ambiguous/CustomResourceAmbiguousTest.php
@@ -25,10 +25,6 @@ class CustomResourceAmbiguousTest extends PHPUnit_Smarty
// Smarty::$_resource_cache = array();
}
- public function testInit()
- {
- $this->cleanDirs();
- }
protected function relative($path)
{
diff --git a/tests/UnitTests/ResourceTests/Custom/Ambiguous/cache/.gitignore b/tests/UnitTests/ResourceTests/Custom/Ambiguous/cache/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/Custom/Ambiguous/cache/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/Custom/Ambiguous/templates_c/.gitignore b/tests/UnitTests/ResourceTests/Custom/Ambiguous/templates_c/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/Custom/Ambiguous/templates_c/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/ResourceExtendsAllPluginTest.php b/tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/ResourceExtendsAllPluginTest.php
index 0cbbfce0..2d586922 100644
--- a/tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/ResourceExtendsAllPluginTest.php
+++ b/tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/ResourceExtendsAllPluginTest.php
@@ -6,7 +6,7 @@
* @author Uwe Tews
*/
-require_once __DIR__ . '/../../../__shared/resources/resource.extendsall.php';
+require_once __DIR__ . '/resources/resource.extendsall.php';
/**
* class for demo resource plugin extendsall tests
@@ -22,10 +22,6 @@ class ResourceExtendsAllPluginTest extends PHPUnit_Smarty
$this->setUpSmarty(__DIR__);
}
- public function testInit()
- {
- $this->cleanDirs();
- }
/**
* test extendsall
diff --git a/tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/cache/.gitignore b/tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/cache/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/cache/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/resources/resource.extendsall.php b/tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/resources/resource.extendsall.php
new file mode 100644
index 00000000..14d37908
--- /dev/null
+++ b/tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/resources/resource.extendsall.php
@@ -0,0 +1,66 @@
+<?php
+
+use Smarty\Exception;
+use Smarty\Template;
+use Smarty\Template\Source;
+
+/**
+ * Extends All Resource
+ * Resource Implementation modifying the extends-Resource to walk
+ * through the template_dirs and inherit all templates of the same name
+ *
+
+ * @author Rodney Rehm
+ */
+class My_Resource_Extendsall extends \Smarty\Resource\ExtendsPlugin
+{
+ /**
+ * populate Source Object with meta data from Resource
+ *
+ * @param Source $source source object
+ * @param Template $_template template object
+ *
+ * @return void
+ */
+ public function populate(Source $source, ?Template $_template = null)
+ {
+ $uid = '';
+ $sources = array();
+ $timestamp = 0;
+ foreach ($source->getSmarty()->getTemplateDir() as $key => $directory) {
+ try {
+ $s = \Smarty\Template\Source::load(null, $source->getSmarty(),
+ 'file:' . '[' . $key . ']' . $source->name);
+ if (!$s->exists) {
+ continue;
+ }
+ $sources[ $s->uid ] = $s;
+ $uid .= $s->uid;
+ $timestamp = $s->timestamp > $timestamp ? $s->timestamp : $timestamp;
+ } catch (Exception $e) {
+ }
+ }
+ if (!$sources) {
+ $source->exists = false;
+ return;
+ }
+ $sources = array_reverse($sources, true);
+ reset($sources);
+ $s = current($sources);
+ $source->components = $sources;
+ $source->uid = sha1($uid . $source->getSmarty()->_joined_template_dir);
+ $source->exists = true;
+ $source->timestamp = $timestamp;
+ }
+
+ /**
+ * Disable timestamp checks for extendsall resource.
+ * The individual source components will be checked.
+ *
+ * @return bool false
+ */
+ public function checkTimestamps()
+ {
+ return false;
+ }
+}
diff --git a/tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/templates_c/.gitignore b/tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/templates_c/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/Custom/DemoPluginExtendsAll/templates_c/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/Custom/DemoPluginMysql/ResourceMysqlPluginTest.php b/tests/UnitTests/ResourceTests/Custom/DemoPluginMysql/ResourceMysqlPluginTest.php
index 16d85489..2c98fae4 100644
--- a/tests/UnitTests/ResourceTests/Custom/DemoPluginMysql/ResourceMysqlPluginTest.php
+++ b/tests/UnitTests/ResourceTests/Custom/DemoPluginMysql/ResourceMysqlPluginTest.php
@@ -24,17 +24,9 @@ if (MysqlResourceEnable == true) {
$this->getConnection();
}
$this->setUpSmarty(__DIR__);
- $this->smarty->addPluginsDir("./PHPunitplugins/");
- }
-
- /**
- *
- */
- public function testInit()
- {
- $this->cleanDirs();
$this->initMysqlResource();
PHPUnit_Smarty::$pdo->exec("REPLACE INTO templates (name, source) VALUES ('test.tpl', '{\$x = \'hello world\'}{\$x}')");
+ $this->smarty->addPluginsDir("./PHPunitplugins/");
}
/**
diff --git a/tests/UnitTests/ResourceTests/Custom/DemoPluginMysql/cache/.gitignore b/tests/UnitTests/ResourceTests/Custom/DemoPluginMysql/cache/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/Custom/DemoPluginMysql/cache/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/Custom/DemoPluginMysql/templates_c/.gitignore b/tests/UnitTests/ResourceTests/Custom/DemoPluginMysql/templates_c/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/Custom/DemoPluginMysql/templates_c/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/DefaultHandler/DefaultTemplateHandlerTest.php b/tests/UnitTests/ResourceTests/DefaultHandler/DefaultTemplateHandlerTest.php
index f2073507..ecd7d81b 100644
--- a/tests/UnitTests/ResourceTests/DefaultHandler/DefaultTemplateHandlerTest.php
+++ b/tests/UnitTests/ResourceTests/DefaultHandler/DefaultTemplateHandlerTest.php
@@ -23,10 +23,6 @@ class DefaultTemplateHandlerTest extends PHPUnit_Smarty
}
- public function testInit()
- {
- $this->cleanDirs();
- }
/**
* test error on unknow template
*/
diff --git a/tests/UnitTests/ResourceTests/DefaultHandler/cache/.gitignore b/tests/UnitTests/ResourceTests/DefaultHandler/cache/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/DefaultHandler/cache/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/DefaultHandler/templates_c/.gitignore b/tests/UnitTests/ResourceTests/DefaultHandler/templates_c/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/DefaultHandler/templates_c/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/Eval/EvalResourceTest.php b/tests/UnitTests/ResourceTests/Eval/EvalResourceTest.php
index f4bad162..a52ac764 100644
--- a/tests/UnitTests/ResourceTests/Eval/EvalResourceTest.php
+++ b/tests/UnitTests/ResourceTests/Eval/EvalResourceTest.php
@@ -21,10 +21,6 @@ class EvalResourceTest extends PHPUnit_Smarty
}
- public function testInit()
- {
- $this->cleanDirs();
- }
/**
* test template eval exits
*/
@@ -70,15 +66,6 @@ class EvalResourceTest extends PHPUnit_Smarty
}
/**
- * test usesCompiler
- */
- public function testUsesCompiler()
- {
- $tpl = $this->smarty->createTemplate('eval:hello world');
- $this->markTestIncomplete();
- }
-
- /**
* test isEvaluated
*/
public function testIsEvaluated()
diff --git a/tests/UnitTests/ResourceTests/Eval/cache/.gitignore b/tests/UnitTests/ResourceTests/Eval/cache/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/Eval/cache/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/Eval/templates_c/.gitignore b/tests/UnitTests/ResourceTests/Eval/templates_c/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/Eval/templates_c/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/Extends/ExtendsResourceTest.php b/tests/UnitTests/ResourceTests/Extends/ExtendsResourceTest.php
index 2ef17719..26edeac7 100644
--- a/tests/UnitTests/ResourceTests/Extends/ExtendsResourceTest.php
+++ b/tests/UnitTests/ResourceTests/Extends/ExtendsResourceTest.php
@@ -20,10 +20,6 @@ class ExtendsResourceTest extends PHPUnit_Smarty
}
- public function testInit()
- {
- $this->cleanDirs();
- }
public function compiledPrefilter($text, Template $tpl)
{
diff --git a/tests/UnitTests/ResourceTests/Extends/cache/.gitignore b/tests/UnitTests/ResourceTests/Extends/cache/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/Extends/cache/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/Extends/templates_c/.gitignore b/tests/UnitTests/ResourceTests/Extends/templates_c/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/Extends/templates_c/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/File/FileResourceTest.php b/tests/UnitTests/ResourceTests/File/FileResourceTest.php
index 44201d4b..68602827 100644
--- a/tests/UnitTests/ResourceTests/File/FileResourceTest.php
+++ b/tests/UnitTests/ResourceTests/File/FileResourceTest.php
@@ -23,10 +23,6 @@ class FileResourceTest extends PHPUnit_Smarty
$this->smarty->enableSecurity();
}
- public function testInit()
- {
- $this->cleanDirs();
- }
protected function relative($path)
{
@@ -90,12 +86,6 @@ class FileResourceTest extends PHPUnit_Smarty
$this->assertEquals('hello world', $tpl->getSource()->getContent());
}
- public function testUsesCompiler()
- {
- $tpl = $this->smarty->createTemplate('helloworld.tpl');
- $this->markTestIncomplete();
- }
-
public function testIsEvaluated()
{
$tpl = $this->smarty->createTemplate('helloworld.tpl');
@@ -171,8 +161,7 @@ class FileResourceTest extends PHPUnit_Smarty
$tpl->fetch();
$timestamp = $tpl->getCached()->timestamp;
-
- $this->smarty = new \Smarty\Smarty();
+ $this->setUpSmarty(__DIR__);
$this->smarty->caching = true;
$this->smarty->cache_lifetime = 1000;
@@ -271,8 +260,8 @@ class FileResourceTest extends PHPUnit_Smarty
$cwd = getcwd();
chdir(__DIR__ . '/templates/sub/');
$dn = __DIR__;
- $this->smarty->setCompileDir($dn . '/templates_c/');
- $this->smarty->setCacheDir($dn . '/cache/');
+ $this->smarty->setCompileDir(self::getTempBase() . 'templates_c/');
+ $this->smarty->setCacheDir(self::getTempBase() . 'cache/');
$this->smarty->setTemplateDir(array(
__DIR__ . '/does-not-exist/',
));
@@ -292,8 +281,8 @@ class FileResourceTest extends PHPUnit_Smarty
$cwd = getcwd();
chdir(__DIR__ . '/templates/sub/');
$dn = __DIR__;
- $this->smarty->setCompileDir($dn . '/templates_c/');
- $this->smarty->setCacheDir($dn . '/cache/');
+ $this->smarty->setCompileDir(self::getTempBase() . 'templates_c/');
+ $this->smarty->setCacheDir(self::getTempBase() . 'cache/');
$this->smarty->setTemplateDir(array(
__DIR__ . '/does-not-exist/',
));
@@ -348,8 +337,8 @@ class FileResourceTest extends PHPUnit_Smarty
$cwd = getcwd();
$dn = __DIR__;
- $this->smarty->setCompileDir($dn . '/templates_c/');
- $this->smarty->setCacheDir($dn . '/cache/');
+ $this->smarty->setCompileDir(self::getTempBase() . 'templates_c/');
+ $this->smarty->setCacheDir(self::getTempBase() . 'cache/');
$this->smarty->setTemplateDir(array($dn . '/templates/relativity/theory/',));
$map = array('foo.tpl' => 'theory', './foo.tpl' => 'theory', '././foo.tpl' => 'theory',
@@ -367,8 +356,8 @@ class FileResourceTest extends PHPUnit_Smarty
$cwd = getcwd();
$dn = __DIR__;
- $this->smarty->setCompileDir($dn . '/templates_c/');
- $this->smarty->setCacheDir($dn . '/cache/');
+ $this->smarty->setCompileDir(self::getTempBase() . 'templates_c/');
+ $this->smarty->setCacheDir(self::getTempBase() . 'cache/');
$this->smarty->setTemplateDir(array(
@@ -399,8 +388,8 @@ class FileResourceTest extends PHPUnit_Smarty
$cwd = getcwd();
$dn = __DIR__;
- $this->smarty->setCompileDir($dn . '/templates_c/');
- $this->smarty->setCacheDir($dn . '/cache/');
+ $this->smarty->setCompileDir(self::getTempBase() . 'templates_c/');
+ $this->smarty->setCacheDir(self::getTempBase() . 'cache/');
chdir($dn . '/templates/relativity/theory/');
$this->smarty->setTemplateDir(array(
$dn . '/templates/',
@@ -428,8 +417,8 @@ class FileResourceTest extends PHPUnit_Smarty
$cwd = getcwd();
$dn = __DIR__;
- $this->smarty->setCompileDir($dn . '/templates_c/');
- $this->smarty->setCacheDir($dn . '/cache/');
+ $this->smarty->setCompileDir(self::getTempBase() . 'templates_c/');
+ $this->smarty->setCacheDir(self::getTempBase() . 'cache/');
$this->smarty->setTemplateDir(array($dn . '/templates/relativity/theory/einstein/',));
$map = array('foo.tpl' => 'einstein', './foo.tpl' => 'einstein', '././foo.tpl' => 'einstein',
@@ -448,8 +437,8 @@ class FileResourceTest extends PHPUnit_Smarty
$cwd = getcwd();
$dn = __DIR__;
- $this->smarty->setCompileDir($dn . '/templates_c/');
- $this->smarty->setCacheDir($dn . '/cache/');
+ $this->smarty->setCompileDir(self::getTempBase() . 'templates_c/');
+ $this->smarty->setCacheDir(self::getTempBase() . 'cache/');
$this->smarty->setTemplateDir(array(
$dn . '/templates/relativity/theory/einstein/',
));
@@ -479,8 +468,8 @@ class FileResourceTest extends PHPUnit_Smarty
$cwd = getcwd();
$dn = __DIR__;
- $this->smarty->setCompileDir($dn . '/templates_c/');
- $this->smarty->setCacheDir($dn . '/cache/');
+ $this->smarty->setCompileDir(self::getTempBase() . 'templates_c/');
+ $this->smarty->setCacheDir(self::getTempBase() . 'cache/');
$this->smarty->setTemplateDir(array('../..',));
$map = array('foo.tpl' => 'relativity', './foo.tpl' => 'relativity', '././foo.tpl' => 'relativity',);
@@ -497,8 +486,8 @@ class FileResourceTest extends PHPUnit_Smarty
$cwd = getcwd();
$dn = __DIR__;
- $this->smarty->setCompileDir($dn . '/templates_c/');
- $this->smarty->setCacheDir($dn . '/cache/');
+ $this->smarty->setCompileDir(self::getTempBase() . 'templates_c/');
+ $this->smarty->setCacheDir(self::getTempBase() . 'cache/');
$this->smarty->setTemplateDir(array('../..',));
$map =
@@ -516,8 +505,8 @@ class FileResourceTest extends PHPUnit_Smarty
$cwd = getcwd();
$dn = __DIR__;
- $this->smarty->setCompileDir($dn . '/templates_c/');
- $this->smarty->setCacheDir($dn . '/cache/');
+ $this->smarty->setCompileDir(self::getTempBase() . 'templates_c/');
+ $this->smarty->setCacheDir(self::getTempBase() . 'cache/');
$this->smarty->setTemplateDir(array(
'../..',
));
@@ -549,8 +538,8 @@ class FileResourceTest extends PHPUnit_Smarty
$cwd = getcwd();
$dn = __DIR__;
- $this->smarty->setCompileDir($dn . '/templates_c/');
- $this->smarty->setCacheDir($dn . '/cache/');
+ $this->smarty->setCompileDir(self::getTempBase() . 'templates_c/');
+ $this->smarty->setCacheDir(self::getTempBase() . 'cache/');
$this->smarty->setTemplateDir(array(
'..',
));
diff --git a/tests/UnitTests/ResourceTests/File/cache/.gitignore b/tests/UnitTests/ResourceTests/File/cache/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/File/cache/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/File/templates_c/.gitignore b/tests/UnitTests/ResourceTests/File/templates_c/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/File/templates_c/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/FileIndexed/FileResourceIndexedTest.php b/tests/UnitTests/ResourceTests/FileIndexed/FileResourceIndexedTest.php
index 4bba6a27..45205fed 100644
--- a/tests/UnitTests/ResourceTests/FileIndexed/FileResourceIndexedTest.php
+++ b/tests/UnitTests/ResourceTests/FileIndexed/FileResourceIndexedTest.php
@@ -14,16 +14,13 @@ class FileResourceIndexedTest extends PHPUnit_Smarty
public function setUp(): void
{
$this->setUpSmarty(__DIR__);
+ $this->smarty->setTemplateDir(__DIR__ . '/templates');
$this->smarty->addTemplateDir(__DIR__ . '/templates_2');
// note that 10 is a string!
$this->smarty->addTemplateDir(__DIR__ . '/templates_3', '10');
$this->smarty->addTemplateDir(__DIR__ . '/templates_4', 'foo');
}
- public function testInit()
- {
- $this->cleanDirs();
- }
public function testFetch()
{
diff --git a/tests/UnitTests/ResourceTests/FileIndexed/cache/.gitignore b/tests/UnitTests/ResourceTests/FileIndexed/cache/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/FileIndexed/cache/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/FileIndexed/templates_c/.gitignore b/tests/UnitTests/ResourceTests/FileIndexed/templates_c/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/FileIndexed/templates_c/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/Registered/RegisteredResourceTest.php b/tests/UnitTests/ResourceTests/Registered/RegisteredResourceTest.php
index 407aa461..20300ccf 100644
--- a/tests/UnitTests/ResourceTests/Registered/RegisteredResourceTest.php
+++ b/tests/UnitTests/ResourceTests/Registered/RegisteredResourceTest.php
@@ -26,10 +26,6 @@ class RegisteredResourceTest extends PHPUnit_Smarty
}
- public function testInit()
- {
- $this->cleanDirs();
- }
/**
* test resource plugin rendering
*/
diff --git a/tests/UnitTests/ResourceTests/Registered/cache/.gitignore b/tests/UnitTests/ResourceTests/Registered/cache/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/Registered/cache/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/Registered/templates_c/.gitignore b/tests/UnitTests/ResourceTests/Registered/templates_c/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/Registered/templates_c/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/ResourcePlugins/ResourcePluginTest.php b/tests/UnitTests/ResourceTests/ResourcePlugins/ResourcePluginTest.php
index 5b1b3854..3a67ef21 100644
--- a/tests/UnitTests/ResourceTests/ResourcePlugins/ResourcePluginTest.php
+++ b/tests/UnitTests/ResourceTests/ResourcePlugins/ResourcePluginTest.php
@@ -20,10 +20,6 @@ class ResourcePluginTest extends PHPUnit_Smarty
$this->setUpSmarty(__DIR__);
}
- public function testInit()
- {
- $this->cleanDirs();
- }
/**
* test resource plugin rendering
diff --git a/tests/UnitTests/ResourceTests/ResourcePlugins/cache/.gitignore b/tests/UnitTests/ResourceTests/ResourcePlugins/cache/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/ResourcePlugins/cache/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/ResourcePlugins/templates_c/.gitignore b/tests/UnitTests/ResourceTests/ResourcePlugins/templates_c/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/ResourcePlugins/templates_c/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/Stream/StreamResourceTest.php b/tests/UnitTests/ResourceTests/Stream/StreamResourceTest.php
index e2a8ff70..c6caf4b5 100644
--- a/tests/UnitTests/ResourceTests/Stream/StreamResourceTest.php
+++ b/tests/UnitTests/ResourceTests/Stream/StreamResourceTest.php
@@ -27,10 +27,6 @@ class StreamResourceTest extends PHPUnit_Smarty
fclose($fp);
}
- public function testInit()
- {
- $this->cleanDirs();
- }
public function tearDown(): void
{
parent::tearDown();
@@ -65,15 +61,6 @@ class StreamResourceTest extends PHPUnit_Smarty
}
/**
- * test usesCompiler
- */
- public function testUsesCompiler()
- {
- $tpl = $this->smarty->createTemplate('global:mytest');
- $this->markTestIncomplete();
- }
-
- /**
* test isEvaluated
*/
public function testIsEvaluated()
diff --git a/tests/UnitTests/ResourceTests/Stream/cache/.gitignore b/tests/UnitTests/ResourceTests/Stream/cache/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/Stream/cache/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/Stream/templates_c/.gitignore b/tests/UnitTests/ResourceTests/Stream/templates_c/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/Stream/templates_c/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/String/StringResourceTest.php b/tests/UnitTests/ResourceTests/String/StringResourceTest.php
index a048d8b8..da047c02 100644
--- a/tests/UnitTests/ResourceTests/String/StringResourceTest.php
+++ b/tests/UnitTests/ResourceTests/String/StringResourceTest.php
@@ -21,10 +21,6 @@ class StringResourceTest extends PHPUnit_Smarty
}
- public function testInit()
- {
- $this->cleanDirs();
- }
protected function relative($path)
{
@@ -78,15 +74,6 @@ class StringResourceTest extends PHPUnit_Smarty
}
/**
- * test usesCompiler
- */
- public function testUsesCompiler()
- {
- $tpl = $this->smarty->createTemplate('string:hello world');
- $this->markTestIncomplete();
- }
-
- /**
* test isEvaluated
*/
public function testIsEvaluated()
diff --git a/tests/UnitTests/ResourceTests/String/cache/.gitignore b/tests/UnitTests/ResourceTests/String/cache/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/String/cache/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/ResourceTests/String/templates_c/.gitignore b/tests/UnitTests/ResourceTests/String/templates_c/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/ResourceTests/String/templates_c/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*