Skip to content
This repository
Browse code

MINOR Fixed PjaxResponseNegotiatorTest

  • Loading branch information...
commit b4fb1748093f8e13c458f9266c76f5593bca54b8 1 parent 12f2e1e
Ingo Schommer authored June 05, 2012
11  tests/control/PjaxResponseNegotiatorTest.php
@@ -6,7 +6,8 @@ function testDefaultCallbacks() {
6 6
 			'default' => function() {return 'default response';},
7 7
 		));
8 8
 		$request = new SS_HTTPRequest('GET', '/'); // not setting pjax header
9  
-		$this->assertEquals('default response', $negotiator->respond($request));
  9
+		$response = $negotiator->respond($request);
  10
+		$this->assertEquals('default response', $response->getBody());
10 11
 	}
11 12
 
12 13
 	function testSelectsFragmentByHeader() {
@@ -16,7 +17,8 @@ function testSelectsFragmentByHeader() {
16 17
 		));
17 18
 		$request = new SS_HTTPRequest('GET', '/');
18 19
 		$request->addHeader('X-Pjax', 'myfragment');
19  
-		$this->assertEquals('myfragment response', $negotiator->respond($request));
  20
+		$response = $negotiator->respond($request);
  21
+		$this->assertEquals('{"myfragment":"myfragment response"}', $response->getBody());
20 22
 	}
21 23
 
22 24
 	function testMultipleFragments() {
@@ -28,11 +30,12 @@ function testMultipleFragments() {
28 30
 		$request = new SS_HTTPRequest('GET', '/');
29 31
 		$request->addHeader('X-Pjax', 'myfragment,otherfragment');
30 32
 		$request->addHeader('Accept', 'text/json');
31  
-		$json = json_decode($negotiator->respond($request));
  33
+		$response = $negotiator->respond($request);
  34
+		$json = json_decode( $response->getBody());
32 35
 		$this->assertObjectHasAttribute('myfragment', $json);
33 36
 		$this->assertEquals('myfragment response', $json->myfragment);
34 37
 		$this->assertObjectHasAttribute('otherfragment', $json);
35 38
 		$this->assertEquals('otherfragment response', $json->otherfragment);
36 39
 	}
37 40
 
38  
-}
  41
+}

0 notes on commit b4fb174

Please sign in to comment.
Something went wrong with that request. Please try again.