mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Added unit test for template lib
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Hello {{world}}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Appwrite\Tests;
|
||||
|
||||
use Template\Template;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class TemplateTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var Cron
|
||||
*/
|
||||
protected $object = null;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->object = new Template(__DIR__.'/../../resources/template.tpl');
|
||||
$this->object
|
||||
->setParam('{{world}}', 'WORLD')
|
||||
;
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
public function testRender()
|
||||
{
|
||||
$this->assertEquals($this->object->render(), 'Hello WORLD');
|
||||
}
|
||||
|
||||
public function testParseURL()
|
||||
{
|
||||
$url = $this->object->parseURL('https://appwrite.io/demo');
|
||||
|
||||
$this->assertEquals($url['scheme'], 'https');
|
||||
$this->assertEquals($url['host'], 'appwrite.io');
|
||||
$this->assertEquals($url['path'], '/demo');
|
||||
}
|
||||
|
||||
public function testUnParseURL()
|
||||
{
|
||||
$url = $this->object->parseURL('https://appwrite.io/demo');
|
||||
|
||||
$url['scheme'] = 'http';
|
||||
$url['host'] = 'example.com';
|
||||
$url['path'] = '/new';
|
||||
|
||||
$this->assertEquals($this->object->unParseURL($url), 'http://example.com/new');
|
||||
}
|
||||
|
||||
public function testMergeQuery()
|
||||
{
|
||||
$this->assertEquals($this->object->mergeQuery('key1=value1&key2=value2', ['key1' => 'value3', 'key4' => 'value4']), 'key1=value3&key2=value2&key4=value4');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user