本文整理汇总了PHP中JRouter::setVars方法的典型用法代码示例。如果您正苦于以下问题:PHP JRouter::setVars方法的具体用法?PHP JRouter::setVars怎么用?PHP JRouter::setVars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRouter
的用法示例。
在下文中一共展示了JRouter::setVars方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreateUriGeneratesUriFromUrlAndPreset
/**
* Tests createUri() method
*
* @param array $url valid inputs to the createUri() method
* @param array $preset global Vars that should be merged into the URL
* @param string $expected expected URI string
*
* @dataProvider casesCreateUri
* @testdox createUri() generates URI combining URL and preset variables
* @since 3.4
*/
public function testCreateUriGeneratesUriFromUrlAndPreset($url, $preset, $expected)
{
$this->object->setVars($preset, false);
$createUriMethod = new ReflectionMethod('JRouter', 'createUri');
$createUriMethod->setAccessible(true);
$this->assertEquals($expected, (string) $createUriMethod->invoke($this->object, $url));
}
示例2: testCreateURI
/**
* Tests createURI() method
*
* @param array $url valid inputs to the createURI() method
* @param array $globalVars global Vars that should be merged into the URL
* @param string $expected expected URI string
*
* @dataProvider casesCreateURI
*
* @return void
*
* @since 3.4
*/
public function testCreateURI($url, $globalVars, $expected)
{
$this->object->setVars($globalVars, false);
$juri = $this->object->runCreateURI($url);
$this->assertTrue(is_a($juri, 'JUri'));
$this->assertEquals($juri->toString(), $expected);
}
示例3: testGetVars
/**
* Tests the getVars() method
*
* @return void
*
* @since 3.4
*/
public function testGetVars()
{
$this->assertEquals($this->object->getVars(), array());
$this->object->setVars(array('var1' => 'value1'));
$this->assertEquals($this->object->getVars(), array('var1' => 'value1'));
$this->object->setVars(array('var2' => 'value2'));
$this->assertEquals($this->object->getVars(), array('var1' => 'value1', 'var2' => 'value2'));
$this->object->setVars(array('var3' => 'value3'), false);
$this->assertEquals($this->object->getVars(), array('var3' => 'value3'));
$this->object->setVars(array(), false);
$this->assertEquals($this->object->getVars(), array());
}
示例4: testSetVar
/**
* Tests the setVar method
*
* @param array $vars An associative array with variables
* @param string $var The name of the variable
* @param mixed $value The value of the variable
* @param boolean $create If True, the variable will be created if it doesn't exist yet
* @param string $expected Expected return value
*
* @return void
*
* @dataProvider casesSetVar
* @since 3.1
*/
public function testSetVar($vars, $var, $value, $create, $expected)
{
$this->object->setVars($vars, false);
$this->object->setVar($var, $value, $create);
$this->assertEquals($this->object->getVar($var), $expected, __METHOD__ . ':' . __LINE__ . ': value is not expected');
}