当前位置: 首页>>代码示例>>PHP>>正文


PHP JRouter::getVars方法代码示例

本文整理汇总了PHP中JRouter::getVars方法的典型用法代码示例。如果您正苦于以下问题:PHP JRouter::getVars方法的具体用法?PHP JRouter::getVars怎么用?PHP JRouter::getVars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JRouter的用法示例。


在下文中一共展示了JRouter::getVars方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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');
 }
开发者ID:nirpan,项目名称:joomla-cms,代码行数:41,代码来源:JRouterSiteTest.php

示例2: testMultipleVariablesCanBeAddedAtOnceAndOptionallyReplaceExistingVariables

 /**
  * @see     https://github.com/joomla-projects/joomla-pythagoras/issues/3
  * @since   3.4
  */
 public function testMultipleVariablesCanBeAddedAtOnceAndOptionallyReplaceExistingVariables()
 {
     $this->assertEquals(array(), $this->object->getVars());
     $this->object->setVars(array('var1' => 'value1'));
     $this->assertEquals(array('var1' => 'value1'), $this->object->getVars());
     $this->object->setVars(array('var2' => 'value2'));
     $this->assertEquals(array('var1' => 'value1', 'var2' => 'value2'), $this->object->getVars());
     $this->object->setVars(array('var3' => 'value3'), false);
     $this->assertEquals(array('var3' => 'value3'), $this->object->getVars());
     $this->object->setVars(array(), false);
     $this->assertEquals(array(), $this->object->getVars());
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:16,代码来源:JRouterTest.php

示例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());
 }
开发者ID:nirpan,项目名称:joomla-cms,代码行数:19,代码来源:JRouterTest.php


注:本文中的JRouter::getVars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。