Fix QlinkTest

refs #4301
This commit is contained in:
Eric Lippmann 2013-06-28 11:16:28 +02:00
parent 2245f65224
commit 9d0d11418a
1 changed files with 51 additions and 45 deletions

View File

@ -15,51 +15,57 @@ require_once('../../application/views/helpers/Qlink.php');
**/
class Zend_View_Helper_QlinkTest extends \PHPUnit_Framework_TestCase
{
public function testURLPathParameter()
public function testQlink()
{
$view = new Zend_View();
$helper = new Zend_View_Helper_Qlink();
$helper->setView($view);
$pathTpl = "/path/%s/to/%s";
$this->assertEquals(
"/path/param1/to/param2",
$helper->getFormattedURL($pathTpl,array('param1','param2'))
);
$this->markTestIncomplete('testQlink is not implemented yet');
}
public function testUrlGETParameter()
{
$view = new Zend_View();
$helper = new Zend_View_Helper_Qlink();
$helper->setView($view);
$pathTpl = 'path';
$this->assertEquals(
'/path?param1=value1&param2=value2',
$helper->getFormattedURL($pathTpl,array('param1'=>'value1','param2'=>'value2'))
);
}
public function testMixedParameters()
{
$view = new Zend_View();
$helper = new Zend_View_Helper_Qlink();
$helper->setView($view);
$pathTpl = 'path/%s/to/%s';
$this->assertEquals(
'/path/path1/to/path2?param1=value1&param2=value2',
$helper->getFormattedURL($pathTpl,array(
'path1','path2',
'param1'=>'value1',
'param2'=>'value2'))
);
}
// TODO: Test error case
public function testWrongUrl() {
}
/*
* TODO: Url handling has benn moved to `library\Icinga\Web\Url`. Replace following tests.
*/
// public function testURLPathParameter()
// {
// $view = new Zend_View();
//
// $helper = new Zend_View_Helper_Qlink();
// $helper->setView($view);
// $pathTpl = "/path/%s/to/%s";
// $this->assertEquals(
// "/path/param1/to/param2",
// $helper->getFormattedURL($pathTpl,array('param1','param2'))
// );
// }
//
// public function testUrlGETParameter()
// {
// $view = new Zend_View();
// $helper = new Zend_View_Helper_Qlink();
// $helper->setView($view);
// $pathTpl = 'path';
// $this->assertEquals(
// '/path?param1=value1&param2=value2',
// $helper->getFormattedURL($pathTpl,array('param1'=>'value1','param2'=>'value2'))
// );
// }
//
// public function testMixedParameters()
// {
// $view = new Zend_View();
// $helper = new Zend_View_Helper_Qlink();
// $helper->setView($view);
// $pathTpl = 'path/%s/to/%s';
// $this->assertEquals(
// '/path/path1/to/path2?param1=value1&param2=value2',
// $helper->getFormattedURL($pathTpl,array(
// 'path1','path2',
// 'param1'=>'value1',
// 'param2'=>'value2'))
// );
// }
//
// // TODO: Test error case
// public function testWrongUrl() {
//
// }
}