Exemplo n.º 1
0
 /**
  * @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);
 }