本文整理汇总了PHP中Mage_Core_Controller_Request_Http::setRequestUri方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Controller_Request_Http::setRequestUri方法的具体用法?PHP Mage_Core_Controller_Request_Http::setRequestUri怎么用?PHP Mage_Core_Controller_Request_Http::setRequestUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Controller_Request_Http
的用法示例。
在下文中一共展示了Mage_Core_Controller_Request_Http::setRequestUri方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetRequestString
public function testGetRequestString()
{
$this->assertEmpty($this->_model->getRequestString());
$this->_model->setRequestUri('test');
$this->_model->setPathInfo();
$this->assertEquals('test', $this->_model->getRequestString());
}
示例2: testIsAllowed
/**
* @dataProvider dataProviderIsAllowed
* @param string $config
* @param string $module
* @param string $controller
* @param string $action
* @param array $issuersWithJobs
* @param bool $isAllowed
* @param string $urn
*/
public function testIsAllowed($config, $module, $controller, $action, $issuersWithJobs, $isAllowed, $urn = '')
{
$configMock = $this->getMock('Mage_Core_Model_Config', array('getNode'));
$configMock->expects($this->any())->method('getNode')->with($this->equalTo('default/xcom/initializer_acl'))->will($this->returnValue(new Varien_Simplexml_Element($config)));
$request = new Mage_Core_Controller_Request_Http();
$request->setControllerModule($module)->setControllerName($controller)->setActionName($action);
$request->setRequestUri($urn)->setPathInfo();
$fabricHelper = $this->mockHelper('xcom_xfabric', array('getNodeByXpath'));
$fabricHelper->expects($this->any())->method('getNodeByXpath')->will($this->returnValue(1));
$jobResource = $this->mockResource('xcom_initializer/job', array('hasJobsLeft', 'isDataCollected'));
$jobResource->expects($this->any())->method('isDataCollected')->will($this->returnValue(empty($issuersWithJobs)));
if (empty($issuersWithJobs)) {
$jobResource->expects($this->never())->method('hasJobsLeft');
} else {
$i = 1;
foreach (array('xcom_mapping', 'xcom_other') as $issuer) {
$jobResource->expects($this->at($i))->method('hasJobsLeft')->with($this->equalTo($issuer))->will($this->returnValue((int) in_array($issuer, $issuersWithJobs)));
$i++;
}
}
Mage::setConfigMock($configMock);
$result = $this->_object->isAllowed($request);
Mage::setUseMockConfig(false);
$this->assertEquals($isAllowed, $result);
}
示例3: run
/**
* Runs the WebApplication
*
* @param \AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest The request instance
*
* @return string The web applications content
*/
public function run(HttpServletRequestInterface $servletRequest)
{
try {
// cleanup mage registry
foreach ($this->registryCleanKeys as $registryCleanKey) {
\Mage::unregister($registryCleanKey);
}
error_log("Successfully reset Magento");
// set headers sent to false and start output caching
appserver_set_headers_sent(false);
ob_start();
// reset and run Magento
$appRequest = new \Mage_Core_Controller_Request_Http();
$appResponse = new \Mage_Core_Controller_Response_Http();
$appRequest->setRequestUri();
error_log("Set request URI: " . $_SERVER['REQUEST_URI']);
$this->app->setRequest($appRequest);
$this->app->setResponse($appResponse);
// store or website code
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
// run store or run website
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
$this->app->run(array('scope_code' => $mageRunCode, 'scope_type' => $mageRunType, 'options' => array()));
// write the session back after the request
session_write_close();
// We need to init the session anew, so PHP session handling will work like it would in a clean environment
appserver_session_init();
// grab the contents generated by Magento
$content = ob_get_clean();
} catch (\Exception $e) {
error_log($content = $e->__toString());
}
// return the content
return $content;
}