Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Baldur Rensch
committed
Jan 31, 2012
1 parent
81cdcda
commit 5896968
Showing
656 changed files
with
88,783 additions
and
21,217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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("<a@b.c>", $this->smarty->fetch($tpl)); | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
|
||
?> |
Oops, something went wrong.