本文整理汇总了PHP中Rest::request方法的典型用法代码示例。如果您正苦于以下问题:PHP Rest::request方法的具体用法?PHP Rest::request怎么用?PHP Rest::request使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rest
的用法示例。
在下文中一共展示了Rest::request方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_request_false
/**
* @expectedException \Exception
*/
public function test_request_false()
{
/** === Test Data === */
$PARAMS = 'params';
$PARAMS_JSON = 'JSON encoded params';
$ROUTE = 'route';
$SESS_ID = 'session id';
$CONTEXT_OPTS_JSON = 'JSON encoded context options';
$RESULT = 'result';
/** === Setup Mocks === */
// $sessId = $this->_login->getSessionId();
$this->mLogin->shouldReceive('getSessionId')->once()->andReturn($SESS_ID);
// $request = $this->_adapter->encodeJson($params);
$this->mAdapter->shouldReceive('encodeJson')->once()->with($PARAMS)->andReturn($PARAMS_JSON);
// $context = $this->_adapter->createContext($contextOpts);
$this->mAdapter->shouldReceive('createContext')->once()->andReturn($PARAMS_JSON);
// this->_logger->debug("Request URI:\t$uri");
$this->mLogger->shouldReceive('debug');
// $jsonContextOpt = $this->_adapter->encodeJson($contextOpts);
$this->mAdapter->shouldReceive('encodeJson')->once()->andReturn($CONTEXT_OPTS_JSON);
// $contents = $this->_adapter->getContents($uri, $context);
$this->mAdapter->shouldReceive('getContents')->once()->andReturn(false);
// $this->_logger->critical($msg);
$this->mLogger->shouldReceive('critical')->once();
/** === Call and asserts === */
$res = $this->obj->request($PARAMS, $ROUTE);
$this->assertEquals($RESULT, $res);
}