Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MINOR Fixed PjaxResponseNegotiatorTest

  • Loading branch information...
commit b4fb1748093f8e13c458f9266c76f5593bca54b8 1 parent 12f2e1e
@chillu chillu authored
Showing with 7 additions and 4 deletions.
  1. +7 −4 tests/control/PjaxResponseNegotiatorTest.php
View
11 tests/control/PjaxResponseNegotiatorTest.php
@@ -6,7 +6,8 @@ function testDefaultCallbacks() {
'default' => function() {return 'default response';},
));
$request = new SS_HTTPRequest('GET', '/'); // not setting pjax header
- $this->assertEquals('default response', $negotiator->respond($request));
+ $response = $negotiator->respond($request);
+ $this->assertEquals('default response', $response->getBody());
}
function testSelectsFragmentByHeader() {
@@ -16,7 +17,8 @@ function testSelectsFragmentByHeader() {
));
$request = new SS_HTTPRequest('GET', '/');
$request->addHeader('X-Pjax', 'myfragment');
- $this->assertEquals('myfragment response', $negotiator->respond($request));
+ $response = $negotiator->respond($request);
+ $this->assertEquals('{"myfragment":"myfragment response"}', $response->getBody());
}
function testMultipleFragments() {
@@ -28,11 +30,12 @@ function testMultipleFragments() {
$request = new SS_HTTPRequest('GET', '/');
$request->addHeader('X-Pjax', 'myfragment,otherfragment');
$request->addHeader('Accept', 'text/json');
- $json = json_decode($negotiator->respond($request));
+ $response = $negotiator->respond($request);
+ $json = json_decode( $response->getBody());
$this->assertObjectHasAttribute('myfragment', $json);
$this->assertEquals('myfragment response', $json->myfragment);
$this->assertObjectHasAttribute('otherfragment', $json);
$this->assertEquals('otherfragment response', $json->otherfragment);
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.