Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit de83270

Browse files
author
Jurian Sluiman
committed
Update Zend\View to latest Zend\Http changes
22 parents 7969827 + 0090b4d + 806df8a + 4e7ff23 + 409b768 + 1b97191 + d2649e3 + f0162d1 + 6f01416 + a2b3753 + 1786961 + d157fcb + 4444c37 + 192d20c + 811122b + 3a2cf9b + eb2029b + 7a6edab + ef80e35 + 22e9606 + 8d8a05d + f81b55d commit de83270

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

src/Helper/Json.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class Json extends AbstractHelper
4141

4242
/**
4343
* Set the response object
44-
*
45-
* @param Response $response
44+
*
45+
* @param Response $response
4646
* @return Json
4747
*/
4848
public function setResponse(Response $response)
@@ -63,7 +63,7 @@ public function __invoke($data, array $jsonOptions = array())
6363
$data = JsonFormatter::encode($data, null, $jsonOptions);
6464

6565
if ($this->response instanceof Response) {
66-
$headers = $this->response->headers();
66+
$headers = $this->response->getHeaders();
6767
$headers->addHeaderLine('Content-Type', 'application/json');
6868
}
6969

src/Strategy/FeedStrategy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function selectRenderer(ViewEvent $e)
110110
return;
111111
}
112112

113-
$headers = $request->headers();
113+
$headers = $request->getHeaders();
114114
if ($headers->has('accept')) {
115115
$accept = $headers->get('accept');
116116
foreach ($accept->getPrioritized() as $mediaType) {
@@ -165,7 +165,7 @@ public function injectResponse(ViewEvent $e)
165165
// Populate response
166166
$response = $e->getResponse();
167167
$response->setContent($result);
168-
$headers = $response->headers();
168+
$headers = $response->getHeaders();
169169
$headers->addHeaderLine('content-type', $feedType);
170170
}
171171
}

src/Strategy/JsonStrategy.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function selectRenderer(ViewEvent $e)
109109
return;
110110
}
111111

112-
$headers = $request->headers();
112+
$headers = $request->getHeaders();
113113
if ($headers->has('accept')) {
114114
$accept = $headers->get('Accept');
115115
foreach ($accept->getPrioritized() as $mediaType) {
@@ -119,7 +119,7 @@ public function selectRenderer(ViewEvent $e)
119119
}
120120
if (0 === strpos($mediaType, 'application/javascript')) {
121121
// application/javascript Accept header found
122-
if (false != ($callback = $request->query()->get('callback'))) {
122+
if (false != ($callback = $request->getQuery()->get('callback'))) {
123123
$this->renderer->setJsonpCallback($callback);
124124
}
125125
return $this->renderer;
@@ -154,7 +154,7 @@ public function injectResponse(ViewEvent $e)
154154
// Populate response
155155
$response = $e->getResponse();
156156
$response->setContent($result);
157-
$headers = $response->headers();
157+
$headers = $response->getHeaders();
158158
if ($this->renderer->hasJsonpCallback()) {
159159
$headers->addHeaderLine('content-type', 'application/javascript');
160160
} else {

test/Helper/JsonTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function setUp()
5555

5656
public function verifyJsonHeader()
5757
{
58-
$headers = $this->response->headers();
58+
$headers = $this->response->getHeaders();
5959
$this->assertTrue($headers->has('Content-Type'));
6060
$header = $headers->get('Content-Type');
6161
$this->assertEquals('application/json', $header->getFieldValue());

test/Strategy/FeedStrategyTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function testFeedModelSelectsFeedStrategy()
6060
public function testRssAcceptHeaderSelectsFeedStrategy()
6161
{
6262
$request = new HttpRequest();
63-
$request->headers()->addHeaderLine('Accept', 'application/rss+xml');
63+
$request->getHeaders()->addHeaderLine('Accept', 'application/rss+xml');
6464
$this->event->setRequest($request);
6565
$result = $this->strategy->selectRenderer($this->event);
6666
$this->assertSame($this->renderer, $result);
@@ -69,7 +69,7 @@ public function testRssAcceptHeaderSelectsFeedStrategy()
6969
public function testAtomAcceptHeaderSelectsFeedStrategy()
7070
{
7171
$request = new HttpRequest();
72-
$request->headers()->addHeaderLine('Accept', 'application/atom+xml');
72+
$request->getHeaders()->addHeaderLine('Accept', 'application/atom+xml');
7373
$this->event->setRequest($request);
7474
$result = $this->strategy->selectRenderer($this->event);
7575
$this->assertSame($this->renderer, $result);
@@ -85,7 +85,7 @@ public function testLackOfFeedModelOrAcceptHeaderDoesNotSelectFeedStrategy()
8585
protected function assertResponseNotInjected()
8686
{
8787
$content = $this->response->getContent();
88-
$headers = $this->response->headers();
88+
$headers = $this->response->getHeaders();
8989
$this->assertTrue(empty($content));
9090
$this->assertFalse($headers->has('content-type'));
9191
}
@@ -125,7 +125,7 @@ public function testMatchingRendererAndStringResultInjectsResponse()
125125

126126
$this->strategy->injectResponse($this->event);
127127
$content = $this->response->getContent();
128-
$headers = $this->response->headers();
128+
$headers = $this->response->getHeaders();
129129
$this->assertEquals($expected, $content);
130130
$this->assertTrue($headers->has('content-type'));
131131
$this->assertEquals('application/atom+xml', $headers->get('content-type')->getFieldValue());
@@ -182,7 +182,7 @@ public function testMatchingRendererAndFeedResultInjectsResponse()
182182

183183
$this->strategy->injectResponse($this->event);
184184
$content = $this->response->getContent();
185-
$headers = $this->response->headers();
185+
$headers = $this->response->getHeaders();
186186
$this->assertEquals($expected->export('atom'), $content);
187187
$this->assertTrue($headers->has('content-type'));
188188
$this->assertEquals('application/atom+xml', $headers->get('content-type')->getFieldValue());
@@ -198,7 +198,7 @@ public function testResponseContentTypeIsBasedOnFeedType()
198198

199199
$this->strategy->injectResponse($this->event);
200200
$content = $this->response->getContent();
201-
$headers = $this->response->headers();
201+
$headers = $this->response->getHeaders();
202202
$this->assertEquals($expected->export('rss'), $content);
203203
$this->assertTrue($headers->has('content-type'));
204204
$this->assertEquals('application/rss+xml', $headers->get('content-type')->getFieldValue());

test/Strategy/JsonStrategyTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function testJsonModelSelectsJsonStrategy()
6060
public function testJsonAcceptHeaderSelectsJsonStrategy()
6161
{
6262
$request = new HttpRequest();
63-
$request->headers()->addHeaderLine('Accept', 'application/json');
63+
$request->getHeaders()->addHeaderLine('Accept', 'application/json');
6464
$this->event->setRequest($request);
6565
$result = $this->strategy->selectRenderer($this->event);
6666
$this->assertSame($this->renderer, $result);
@@ -69,7 +69,7 @@ public function testJsonAcceptHeaderSelectsJsonStrategy()
6969
public function testJavascriptAcceptHeaderSelectsJsonStrategy()
7070
{
7171
$request = new HttpRequest();
72-
$request->headers()->addHeaderLine('Accept', 'application/javascript');
72+
$request->getHeaders()->addHeaderLine('Accept', 'application/javascript');
7373
$this->event->setRequest($request);
7474
$result = $this->strategy->selectRenderer($this->event);
7575
$this->assertSame($this->renderer, $result);
@@ -79,7 +79,7 @@ public function testJavascriptAcceptHeaderSelectsJsonStrategy()
7979
public function testJavascriptAcceptHeaderSelectsJsonStrategyAndSetsJsonpCallback()
8080
{
8181
$request = new HttpRequest();
82-
$request->headers()->addHeaderLine('Accept', 'application/javascript');
82+
$request->getHeaders()->addHeaderLine('Accept', 'application/javascript');
8383
$request->setQuery(new Parameters(array('callback' => 'foo')));
8484
$this->event->setRequest($request);
8585
$result = $this->strategy->selectRenderer($this->event);
@@ -97,7 +97,7 @@ public function testLackOfJsonModelOrAcceptHeaderDoesNotSelectJsonStrategy()
9797
protected function assertResponseNotInjected()
9898
{
9999
$content = $this->response->getContent();
100-
$headers = $this->response->headers();
100+
$headers = $this->response->getHeaders();
101101
$this->assertTrue(empty($content));
102102
$this->assertFalse($headers->has('content-type'));
103103
}
@@ -136,7 +136,7 @@ public function testMatchingRendererAndStringResultInjectsResponse()
136136

137137
$this->strategy->injectResponse($this->event);
138138
$content = $this->response->getContent();
139-
$headers = $this->response->headers();
139+
$headers = $this->response->getHeaders();
140140
$this->assertEquals($expected, $content);
141141
$this->assertTrue($headers->has('content-type'));
142142
$this->assertEquals('application/json', $headers->get('content-type')->getFieldValue());
@@ -152,7 +152,7 @@ public function testMatchingRendererAndStringResultInjectsResponseJsonp()
152152

153153
$this->strategy->injectResponse($this->event);
154154
$content = $this->response->getContent();
155-
$headers = $this->response->headers();
155+
$headers = $this->response->getHeaders();
156156
$this->assertEquals($expected, $content);
157157
$this->assertTrue($headers->has('content-type'));
158158
$this->assertEquals('application/javascript', $headers->get('content-type')->getFieldValue());

test/Strategy/PhpRendererStrategyTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function testSelectRendererAlwaysSelectsPhpRenderer()
6060
protected function assertResponseNotInjected()
6161
{
6262
$content = $this->response->getContent();
63-
$headers = $this->response->headers();
63+
$headers = $this->response->getHeaders();
6464
$this->assertTrue(empty($content));
6565
$this->assertFalse($headers->has('content-type'));
6666
}
@@ -79,7 +79,7 @@ public function testNonMatchingRendererDoesNotInjectResponse()
7979
$this->strategy->injectResponse($this->event);
8080
$this->assertResponseNotInjected();
8181
}
82-
82+
8383
public function testResponseContentSetToContentPlaceholderWhenResultAndArticlePlaceholderAreEmpty()
8484
{
8585
$this->renderer->placeholder('content')->set('Content');
@@ -152,7 +152,7 @@ public function testAttachesListenersAtExpectedPriorities()
152152
$this->assertTrue($found, 'Listener not found');
153153
}
154154
}
155-
155+
156156
public function testCanAttachListenersAtSpecifiedPriority()
157157
{
158158
$events = new EventManager();

0 commit comments

Comments
 (0)