public function testRangeFromStringCreatesValidRangeHeader() { $rangeHeader = Range::fromString('Range: xxx'); $this->assertInstanceOf('Zend\\Http\\Header\\HeaderDescription', $rangeHeader); $this->assertInstanceOf('Zend\\Http\\Header\\Range', $rangeHeader); }
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()); }