示例#1
0
 public function testRangeToStringReturnsHeaderFormattedString()
 {
     $this->markTestIncomplete('Range needs to be completed');
     $rangeHeader = new Range();
     // @todo set some values, then test output
     $this->assertEmpty('Range: xxx', $rangeHeader->toString());
 }
 public function testGetEmbeddedListWithSortAndRange()
 {
     $accept = new Accept();
     $accept->addMediaType('application/json');
     $this->getRequest()->setMethod('GET')->getHeaders()->addHeaders([$accept, Range::fromString('Range: items=1-2')]);
     $this->dispatch('/rest/game/feed-the-kitty/components?' . urlencode('sort(-type)'));
     $result = json_decode($this->getResponse()->getContent(), true);
     $this->assertResponseStatusCode(200);
     $this->assertCount(2, $result);
     $this->assertEquals('die', $result[0]['type']);
     $this->assertEquals('bowl', $result[1]['type']);
     $this->assertEquals('Content-Range: 1-2/3', $this->getResponse()->getHeaders()->get('Content-Range')->toString());
 }