Пример #1
0
 /**
  * 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');
 }