public function testForward()
 {
     $route = $this->getMock('IRoute');
     $route->expects($this->once())->method('setPackage')->will($this->returnValue($route));
     $route->expects($this->once())->method('setController')->will($this->returnValue($route));
     $route->expects($this->once())->method('setAction')->will($this->returnValue($route));
     $route->expects($this->once())->method('setParameters')->will($this->returnValue($route));
     $request = $this->getMock('IRequest');
     $runner = $this->getMock('IControllerRunner');
     $runner->expects($this->once())->method('run')->with($this->equalTo($route))->will($this->returnValue('ok'));
     $this->container->expects($this->exactly(3))->method('getInstanceOf')->will($this->onConsecutiveCalls($route, $request, $runner));
     $this->assertThat($this->object->forward('package', 'controller', 'action', array('params')), $this->equalTo('ok'));
 }
Example #2
0
    mosRedirect('index2.php', T_('You are not authorized to view this resource.'));
}
require_once mamboCore::get('rootPath') . '/includes/phpgettext/error.php';
require_once mamboCore::get('rootPath') . '/includes/phpgettext/phpgettext.catalog.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'admin.languages.class.php';
$include_path = ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . dirname(__FILE__));
$request =& Request::getInstance('com_languages');
$session =& $request->session();
if (isset($session['mosmsg'])) {
    $request->set('mosmsg', $session['mosmsg']);
    unset($session['mosmsg']);
}
$lang = $session['lang'] = mosGetParam($_POST, 'lang', isset($session['lang']) ? $session['lang'] : mamboCore::get('mosConfig_locale'));
$mamboLanguage =& new mamboLanguage($lang);
$languages = $mamboLanguage->getLanguages();
$task = mosGetParam($_REQUEST, 'task', 'index');
$act = mosGetParam($_REQUEST, 'act', 'language');
$search = trim(mosGetParam($_POST, 'search', ''));
$request->set('task', $task);
$request->set('act', $act);
$request->set('lang', $lang);
$request->set('languages', $languages);
$request->set('search', $search);
$renderer =& Renderer::getInstance();
foreach ($request->get() as $key => $value) {
    $renderer->addvar($key, $value);
}
$controller = new Controller('com_languages');
$controller->forward($task);
ini_set('include_path', $include_path);
#dump($_REQUEST);