Skip to content

Commit

Permalink
Updated to 3.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Baldur Rensch committed Jan 31, 2012
1 parent 81cdcda commit 5896968
Show file tree
Hide file tree
Showing 656 changed files with 88,783 additions and 21,217 deletions.
40 changes: 20 additions & 20 deletions development/PHPunit/AppendByRefTests.php
@@ -1,9 +1,9 @@
<?php
/**
* Smarty PHPunit tests appendByRef methode
*
*
* @package PHPunit
* @author Uwe Tews
* @author Uwe Tews
*/

/**
Expand All @@ -13,14 +13,14 @@ class AppendByRefTests extends PHPUnit_Framework_TestCase {
public function setUp()
{
$this->smarty = SmartyTests::$smarty;
$this->smartyBC = SmartyTests::$smartyBC;
SmartyTests::init();
$this->smarty->deprecation_notices = false;
}
}

public static function isRunnable()
{
return true;
}
}

/**
* test appendByRef
Expand All @@ -34,17 +34,17 @@ public function testAppendByRef()
$bar = 'newbar';
$bar2 = 'newbar2';
$this->assertEquals('newbar newbar2', $this->smarty->fetch('eval:{$foo[0]} {$foo[1]}'));
}
}
public function testSmarty2AppendByRef()
{
$bar = 'bar';
$bar2 = 'bar2';
$this->smarty->append_by_ref('foo', $bar);
$this->smarty->append_by_ref('foo', $bar2);
$this->smartyBC->append_by_ref('foo', $bar);
$this->smartyBC->append_by_ref('foo', $bar2);
$bar = 'newbar';
$bar2 = 'newbar2';
$this->assertEquals('newbar newbar2', $this->smarty->fetch('eval:{$foo[0]} {$foo[1]}'));
}
$this->assertEquals('newbar newbar2', $this->smartyBC->fetch('eval:{$foo[0]} {$foo[1]}'));
}
/**
* test appendByRef to unassigned variable
*/
Expand All @@ -54,30 +54,30 @@ public function testAppendByRefUnassigned()
$this->smarty->appendByRef('foo', $bar2);
$bar2 = 'newbar2';
$this->assertEquals('newbar2', $this->smarty->fetch('eval:{$foo[0]}'));
}
}
public function testSmarty2AppendByRefUnassigned()
{
$bar2 = 'bar2';
$this->smarty->append_by_ref('foo', $bar2);
$this->smartyBC->append_by_ref('foo', $bar2);
$bar2 = 'newbar2';
$this->assertEquals('newbar2', $this->smarty->fetch('eval:{$foo[0]}'));
}
$this->assertEquals('newbar2', $this->smartyBC->fetch('eval:{$foo[0]}'));
}
/**
* test appendByRef merge
*
*
* @todo fix testAppendByRefMerge
*/
public function testAppendByRefMerge()
{
/*
$foo = array('a' => 'a', 'b' => 'b', 'c' => 'c');
$bar = array('b' => 'd');
$this->smarty->assign('foo', array('a' => 'a', 'b' => 'b', 'c' => 'c'));
$this->smarty->assignByRef('foo', $foo);
$this->smarty->appendByRef('foo', $bar, true);
$this->assertEquals('a d c', $this->smarty->fetch('eval:{$foo["a"]} {$foo["b"]} {$foo["c"]}'));
$bar = array('b' => 'newd');
$this->smarty->appendByRef('foo', $bar, true);
$this->assertEquals('a newd c', $this->smarty->fetch('eval:{$foo["a"]} {$foo["b"]} {$foo["c"]}'));
*/
}
}
}
}

?>
20 changes: 10 additions & 10 deletions development/PHPunit/AssignByRefTests.php
@@ -1,9 +1,9 @@
<?php
/**
* Smarty PHPunit tests assignByRef methode
*
*
* @package PHPunit
* @author Uwe Tews
* @author Uwe Tews
*/

/**
Expand All @@ -13,14 +13,14 @@ class AssignByRefTests extends PHPUnit_Framework_TestCase {
public function setUp()
{
$this->smarty = SmartyTests::$smarty;
$this->smartyBC = SmartyTests::$smartyBC;
SmartyTests::init();
$this->smarty->deprecation_notices = false;
}
}

public static function isRunnable()
{
return true;
}
}

/**
* test simple assignByRef
Expand All @@ -31,17 +31,17 @@ public function testSimpleAssignByRef()
$this->smarty->assignByRef('foo', $bar);
$bar = 'newbar';
$this->assertEquals('newbar', $this->smarty->fetch('eval:{$foo}'));
}
}
/**
* test Smarty2 assign_By_Ref
*/
public function testSmarty2AssignByRef()
{
$bar = 'bar';
$this->smarty->assign_by_ref('foo', $bar);
$this->smartyBC->assign_by_ref('foo', $bar);
$bar = 'newbar';
$this->assertEquals('newbar', $this->smarty->fetch('eval:{$foo}'));
}
}
$this->assertEquals('newbar', $this->smartyBC->fetch('eval:{$foo}'));
}
}

?>
35 changes: 35 additions & 0 deletions development/PHPunit/AutoEscapeTests.php
@@ -0,0 +1,35 @@
<?php
/**
* Smarty PHPunit tests for escape_html property
*
* @package PHPunit
* @author Uwe Tews
*/

/**
* class for escape_html property tests
*/
class AutoEscapeTests extends PHPUnit_Framework_TestCase {
public function setUp()
{
$this->smarty = SmartyTests::$smarty;
SmartyTests::init();
$this->smarty->escape_html = true;
}

public static function isRunnable()
{
return true;
}

/**
* test escape_html property
*/
public function testAutoEscape()
{
$tpl = $this->smarty->createTemplate('eval:{$foo}');
$tpl->assign('foo','<a@b.c>');
$this->assertEquals("&lt;a@b.c&gt;", $this->smarty->fetch($tpl));
}
}
?>
29 changes: 29 additions & 0 deletions development/PHPunit/CacheResourceCustomApcTests.php
@@ -0,0 +1,29 @@
<?php
/**
* Smarty PHPunit tests for cache resource file
*
* @package PHPunit
* @author Uwe Tews
*/

require_once( dirname(__FILE__) . "/CacheResourceCustomMemcacheTests.php" );

/**
* class for cache resource file tests
*/
class CacheResourceCustomApcTests extends CacheResourceCustomMemcacheTests {
public function setUp()
{
$this->smarty = SmartyTests::$smarty;
SmartyTests::init();
$this->smarty->caching_type = 'apctest';
$this->smarty->addPluginsDir(dirname(__FILE__)."/PHPunitplugins/");
}

public static function isRunnable()
{
return function_exists('apc_cache_info') && ini_get('apc.enable_cli');
}
}

?>
76 changes: 76 additions & 0 deletions development/PHPunit/CacheResourceCustomMemcacheTests.php
@@ -0,0 +1,76 @@
<?php
/**
* Smarty PHPunit tests for cache resource file
*
* @package PHPunit
* @author Uwe Tews
*/

require_once( dirname(__FILE__) . "/CacheResourceCustomMysqlTests.php" );

/**
* class for cache resource file tests
*/
class CacheResourceCustomMemcacheTests extends CacheResourceCustomMysqlTests {
public function setUp()
{
$this->smarty = SmartyTests::$smarty;
SmartyTests::init();
$this->smarty->caching_type = 'memcachetest';
$this->smarty->addPluginsDir(dirname(__FILE__)."/PHPunitplugins/");
}

public static function isRunnable()
{
return class_exists('Memcache');
}

protected function doClearCacheAssertion($a, $b)
{
$this->assertEquals(-1, $b);
}

public function testGetCachedFilepathSubDirs()
{
$this->smarty->caching = true;
$this->smarty->cache_lifetime = 1000;
$tpl = $this->smarty->createTemplate('helloworld.tpl');
$sha1 = $tpl->source->uid . '#helloworld_tpl##';
$this->assertEquals($sha1, $tpl->cached->filepath);
}
/**
* test getCachedFilepath with cache_id
*/
public function testGetCachedFilepathCacheId()
{
$this->smarty->caching = true;
$this->smarty->cache_lifetime = 1000;
$tpl = $this->smarty->createTemplate('helloworld.tpl', 'foo|bar');
$sha1 = $tpl->source->uid . '#helloworld_tpl#foo|bar#';
$this->assertEquals($sha1, $tpl->cached->filepath);
}
/**
* test getCachedFilepath with compile_id
*/
public function testGetCachedFilepathCompileId()
{
$this->smarty->caching = true;
$this->smarty->cache_lifetime = 1000;
$tpl = $this->smarty->createTemplate('helloworld.tpl', null, 'blar');
$sha1 = $tpl->source->uid . '#helloworld_tpl##blar';
$this->assertEquals($sha1, $tpl->cached->filepath);
}
/**
* test getCachedFilepath with cache_id and compile_id
*/
public function testGetCachedFilepathCacheIdCompileId()
{
$this->smarty->caching = true;
$this->smarty->cache_lifetime = 1000;
$tpl = $this->smarty->createTemplate('helloworld.tpl', 'foo|bar', 'blar');
$sha1 = $tpl->source->uid . '#helloworld_tpl#foo|bar#blar';
$this->assertEquals($sha1, $tpl->cached->filepath);
}
}

?>

0 comments on commit 5896968

Please sign in to comment.