コード例 #1
0
ファイル: RangeTest.php プロジェクト: bradley-holt/zf2
 public function testRangeFromStringCreatesValidRangeHeader()
 {
     $rangeHeader = Range::fromString('Range: xxx');
     $this->assertInstanceOf('Zend\\Http\\Header\\HeaderDescription', $rangeHeader);
     $this->assertInstanceOf('Zend\\Http\\Header\\Range', $rangeHeader);
 }
コード例 #2
0
 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());
 }