本文整理汇总了PHP中Bluz\Proxy\Request::setMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::setMethod方法的具体用法?PHP Request::setMethod怎么用?PHP Request::setMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bluz\Proxy\Request
的用法示例。
在下文中一共展示了Request::setMethod方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testErrorController
/**
* Test run Error Controller
*/
public function testErrorController()
{
// setup Request
Request::setRequestUri(uniqid('module') . '/' . uniqid('controller'));
Request::setMethod(Request::METHOD_GET);
// run Application
$this->getApp()->process();
$this->assertEquals(Router::getErrorModule(), $this->getApp()->getModule());
$this->assertEquals(Router::getErrorController(), $this->getApp()->getController());
}
示例2: prepareRequest
/**
* prepareRequest
*
* @param string $uri in format "module/controllers"
* @param array $params of request
* @param string $method HTTP
* @param bool $ajax
* @return Http\Request
*/
private function prepareRequest($uri, array $params = null, $method = Http\Request::METHOD_GET, $ajax = false)
{
Request::setRequestUri($uri);
Request::setOptions(Config::getData('request'));
Request::setMethod($method);
// process $_GET params
if ($query = stristr($uri, '?')) {
$query = substr($query, 1);
// remove `?` sign
parse_str($query, $_GET);
// fill $_GET
}
// process custom params
if ($params) {
Request::setParams($params);
}
if ($ajax) {
$_SERVER['HTTP_ACCEPT'] = 'application/json';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
} else {
$_SERVER['HTTP_ACCEPT'] = 'text/html';
}
}
示例3: testNotImplementedException
/**
* HEAD should return EXCEPTION
* @expectedException \Bluz\Application\Exception\NotImplementedException
*/
public function testNotImplementedException()
{
Request::setMethod(Request::METHOD_TRACE);
$this->processRest();
}
示例4: testNotImplementedException
/**
* HEAD should return EXCEPTION
* @expectedException \Bluz\Application\Exception\NotImplementedException
*/
public function testNotImplementedException()
{
Request::setMethod(Request::METHOD_HEAD);
$this->processCrud();
}