From b4fb1748093f8e13c458f9266c76f5593bca54b8 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 5 Jun 2012 14:22:00 +0200 Subject: [PATCH] MINOR Fixed PjaxResponseNegotiatorTest --- tests/control/PjaxResponseNegotiatorTest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/control/PjaxResponseNegotiatorTest.php b/tests/control/PjaxResponseNegotiatorTest.php index 32633b223e5..c1162b622f9 100644 --- a/tests/control/PjaxResponseNegotiatorTest.php +++ b/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); } -} +} \ No newline at end of file