Files
friendica/tests/template_test.php
T
Alexander Kampmann 355c42cb30 Merge branch 'master' of https://github.com/friendica/friendica
Conflicts:
	include/config.php
	update.php
2012-04-05 13:39:15 +02:00

224 lines
6.5 KiB
PHP

<?php
/**
* this file contains tests for the template engine
*
* @package test.util
*/
/** required, it is the file under test */
require_once('include/template_processor.php');
require_once('include/text.php');
class TemplateMockApp {
public $theme_info=array();
}
if(!function_exists('current_theme')) {
function current_theme() {
return 'clean';
}
}
if(!function_exists('x')) {
function x($s,$k = NULL) {
return false;
}
}
if(!function_exists('get_app')) {
function get_app() {
return new TemplateMockApp();
}
}
/**
* TestCase for the template engine
*
* @author Alexander Kampmann
* @package test.util
*/
class TemplateTest extends PHPUnit_Framework_TestCase {
public function setUp() {
global $t;
$t=new Template;
}
public function testListToShort() {
@list($first, $second)=array('first');
$this->assertTrue(is_null($second));
}
public function testSimpleVariableString() {
$tpl='Hello $name!';
$text=replace_macros($tpl, array('$name'=>'Anna'));
$this->assertEquals('Hello Anna!', $text);
}
public function testSimpleVariableInt() {
$tpl='There are $num new messages!';