public function init() { $this->_modelName = ucfirst($this->_modelName); Yii::app()->setComponent('request', Yii::createComponent(array('class' => 'ext.wrest.WHttpRequest'))); $this->request->parseJsonParams(); $this->request->getAllRestParams(); $this->request->setFormat($this->_responseFormat); $this->response = WRestResponse::factory($this->request->getFormat()); return parent::init(); }
public function testRestPesonseObj() { $response = WRestResponse::factory('json'); $this->assertTrue($response instanceof WRestResponse); $this->assertTrue($response instanceof JsonResponse); $this->assertTrue(static::$response instanceof WRestResponse); //test default param for new obj $this->assertEmpty(static::$response->getBody()); $this->assertEquals(static::$response->getStatus(), 200); }