コード例 #1
0
 public function testInstance()
 {
     /** @var \Mockery\Mock|\Hitmeister\Component\Api\Transfers\ReportRequestBookingsTransfer $transfer */
     $transfer = \Mockery::mock('\\Hitmeister\\Component\\Api\\Transfers\\ReportRequestBookingsTransfer');
     $transfer->shouldReceive('toArray')->once()->andReturn(['date_from' => '2015-06-01', 'date_to' => '2015-07-01']);
     $post = new Bookings($this->transport);
     $post->setTransfer($transfer);
     $this->assertInstanceOf('\\Hitmeister\\Component\\Api\\Transfers\\ReportRequestBookingsTransfer', $post->getTransfer());
     $this->assertEquals([], $post->getParamWhiteList());
     $this->assertEquals('POST', $post->getMethod());
     $this->assertEquals('reports/bookings/', $post->getURI());
     $body = $post->getBody();
     $this->assertArrayHasKey('date_from', $body);
     $this->assertArrayHasKey('date_to', $body);
 }
コード例 #2
0
 /**
  * @param \DateTime|int|string $dateFrom
  * @param \DateTime|int|string $dateTo
  * @return int
  */
 public function bookings($dateFrom, $dateTo)
 {
     $data = new ReportRequestBookingsTransfer();
     $data->date_from = Request::formatDate($dateFrom);
     $data->date_to = Request::formatDate($dateTo);
     $endpoint = new Bookings($this->getTransport());
     $endpoint->setTransfer($data);
     $resultRequest = $endpoint->performRequest();
     return Response::extractId($resultRequest, '/reports/%d/');
 }