本文整理汇总了PHP中JRouter::setMenu方法的典型用法代码示例。如果您正苦于以下问题:PHP JRouter::setMenu方法的具体用法?PHP JRouter::setMenu怎么用?PHP JRouter::setMenu使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRouter
的用法示例。
在下文中一共展示了JRouter::setMenu方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testParseSefRoute
/**
* Tests the parseSefRoute method
*
* @param string $url An associative array with variables
* @param integer $menubool JROUTER_MODE_RAW or JROUTER_MODE_SEF
* @param array $appConfig An associative array with app config vars
* @param array $expected An associative array with $_SERVER vars
* @param array $expectedGlobals An associative array with $_SERVER vars
* @param boolean $activeMenu Flag if the item is the active menu
*
* @return void
*
* @dataProvider casesParseSefRoute
* @since 3.4
*/
public function testParseSefRoute($url, $menubool, $appConfig, $expected, $expectedGlobals, $activeMenu = false)
{
$uri = new JUri($url);
$app = $this->object->getApp();
if (isset($expected['Itemid'])) {
$app->input->set('Itemid', $expected['Itemid']);
}
if (isset($appConfig['languagefilter'])) {
$app->expects($this->any())->method('getLanguageFilter')->will($this->returnValue(true));
unset($appConfig['languagefilter']);
}
$app->expects($this->any())->method('get')->will($this->returnValueMap($appConfig));
$this->object->setApp($app);
if ($menubool) {
$menu = TestMockMenu::create($this, false, $activeMenu);
$menu->expects($this->any())->method('getDefault')->will($this->returnValue(null));
$this->object->setMenu($menu);
} else {
$menu = TestMockMenu::create($this, true, $activeMenu);
$this->object->setMenu($menu);
}
// The method should return an array of variables
$vars = $this->object->runParseSefRoute($uri);
$this->assertEquals($expected, $vars);
$this->assertEquals($expectedGlobals, $this->object->getVars(), 'global vars');
}