2013-06-03 15:34:57 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
2013-06-25 09:43:55 +02:00
|
|
|
require_once('Zend/View/Helper/Abstract.php');
|
|
|
|
require_once('Zend/View.php');
|
2013-06-03 15:34:57 +02:00
|
|
|
|
2013-06-03 16:23:37 +02:00
|
|
|
require('../../application/views/helpers/Qlink.php');
|
2013-06-03 15:34:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Test class for Zend_View_Helper_Qlink
|
|
|
|
* Created Thu, 24 Jan 2013 12:56:08 +0000
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
class Zend_View_Helper_QlinkTest extends \PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
public function testURLPathParameter()
|
|
|
|
{
|
2013-06-25 09:43:55 +02:00
|
|
|
$view = new Zend_View();
|
|
|
|
|
2013-06-03 15:34:57 +02:00
|
|
|
$helper = new Zend_View_Helper_Qlink();
|
2013-06-25 09:43:55 +02:00
|
|
|
$helper->setView($view);
|
|
|
|
$pathTpl = "/path/%s/to/%s";
|
2013-06-03 15:34:57 +02:00
|
|
|
$this->assertEquals(
|
2013-06-25 09:43:55 +02:00
|
|
|
"/path/param1/to/param2",
|
2013-06-03 15:34:57 +02:00
|
|
|
$helper->getFormattedURL($pathTpl,array('param1','param2'))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testUrlGETParameter()
|
|
|
|
{
|
2013-06-25 09:43:55 +02:00
|
|
|
$view = new Zend_View();
|
2013-06-03 15:34:57 +02:00
|
|
|
$helper = new Zend_View_Helper_Qlink();
|
2013-06-25 09:43:55 +02:00
|
|
|
$helper->setView($view);
|
2013-06-03 15:34:57 +02:00
|
|
|
$pathTpl = 'path';
|
|
|
|
$this->assertEquals(
|
2013-06-25 09:43:55 +02:00
|
|
|
'/path?param1=value1&param2=value2',
|
2013-06-03 15:34:57 +02:00
|
|
|
$helper->getFormattedURL($pathTpl,array('param1'=>'value1','param2'=>'value2'))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testMixedParameters()
|
|
|
|
{
|
2013-06-25 09:43:55 +02:00
|
|
|
$view = new Zend_View();
|
2013-06-03 15:34:57 +02:00
|
|
|
$helper = new Zend_View_Helper_Qlink();
|
2013-06-25 09:43:55 +02:00
|
|
|
$helper->setView($view);
|
2013-06-03 15:34:57 +02:00
|
|
|
$pathTpl = 'path/%s/to/%s';
|
|
|
|
$this->assertEquals(
|
2013-06-25 09:43:55 +02:00
|
|
|
'/path/path1/to/path2?param1=value1&param2=value2',
|
2013-06-03 15:34:57 +02:00
|
|
|
$helper->getFormattedURL($pathTpl,array(
|
|
|
|
'path1','path2',
|
|
|
|
'param1'=>'value1',
|
|
|
|
'param2'=>'value2'))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Test error case
|
|
|
|
public function testWrongUrl() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|