Пример #1
0
 /**
  * @expectedException \RequestLab\Estat\EstatException
  */
 public function testQueryWithJsonError()
 {
     $this->clientMock->expects($this->once())->method('getAccessToken')->will($this->returnValue('token'));
     $this->queryMock->expects($this->once())->method('build')->with($this->equalTo('token'))->will($this->returnValue(array('content')));
     $this->httpAdapterMock->expects($this->once())->method('postContent')->with('https://ws.estat.com/gosu/rest/data/json', array('Content-Type' => 'application/json'), $this->equalTo(array('content')))->will($this->returnValue(json_encode(array('gosuResponse' => array('errorCode' => '999', 'errorMessage' => 'error')))));
     $this->service->query($this->queryMock);
 }
Пример #2
0
 public function testBuild()
 {
     $this->query->setSerial('serial');
     $this->query->setStartDate($startDate = new \DateTime('2015-08-02'));
     $this->query->setEndDate($endDate = new \DateTime('2015-08-02'));
     $this->query->setIndicator('INDICATOR');
     $expected = ['{"gosuRequest":{"tokenId":"token","page":1,"pageSize":10000,"startDate":"2015-08-02","endDate":"2015-08-02","indicator":"INDICATOR","serial":"serial","periodType":"D","top":{"unit":"LECTURES","order":"DESC"}}}'];
     $this->assertSame($expected, $this->query->build('token'));
 }