diff --git a/tests/TestCase/TestSuite/IntegrationTestCaseTest.php b/tests/TestCase/TestSuite/IntegrationTestCaseTest.php index a9c1b9046f3..6999f0cb166 100644 --- a/tests/TestCase/TestSuite/IntegrationTestCaseTest.php +++ b/tests/TestCase/TestSuite/IntegrationTestCaseTest.php @@ -180,11 +180,11 @@ public function testGet() $this->get('/request_action/test_request_action'); $this->assertNotEmpty($this->_response); $this->assertInstanceOf('Cake\Http\Response', $this->_response); - $this->assertEquals('This is a test', $this->_response->body()); + $this->assertEquals('This is a test', $this->_response->getBody()); $this->_response = null; $this->get('/get/request_action/test_request_action'); - $this->assertEquals('This is a test', $this->_response->body()); + $this->assertEquals('This is a test', $this->_response->getBody()); } /** @@ -197,7 +197,7 @@ public function testGetSpecificRouteHttpServer() $this->useHttpServer(true); $this->get('/get/request_action/test_request_action'); $this->assertResponseOk(); - $this->assertEquals('This is a test', $this->_response->body()); + $this->assertEquals('This is a test', $this->_response->getBody()); } /** @@ -229,7 +229,7 @@ public function testGetHttpServer() $this->get('/request_action/test_request_action'); $this->assertNotEmpty($this->_response); $this->assertInstanceOf('Cake\Http\Response', $this->_response); - $this->assertEquals('This is a test', $this->_response->body()); + $this->assertEquals('This is a test', $this->_response->getBody()); $this->assertHeader('X-Middleware', 'true'); } @@ -276,7 +276,7 @@ public function testPostDataHttpServer() $this->useHttpServer(true); $this->post('/request_action/post_pass', ['title' => 'value']); - $data = json_decode($this->_response->body()); + $data = json_decode($this->_response->getBody()); $this->assertEquals('value', $data->title); $this->assertHeader('X-Middleware', 'true'); } @@ -291,7 +291,10 @@ public function testInputDataHttpServer() $this->useHttpServer(true); $this->post('/request_action/input_test', '{"hello":"world"}'); - $this->assertSame('world', $this->_response->body()); + if ($this->_response->getBody()->isSeekable()) { + $this->_response->getBody()->rewind(); + } + $this->assertSame('world', $this->_response->getBody()->getContents()); $this->assertHeader('X-Middleware', 'true'); } @@ -627,34 +630,34 @@ public function testAssertResponseStatusCodes() { $this->_response = new Response(); - $this->_response->statusCode(200); + $this->_response = $this->_response->withStatus(200); $this->assertResponseOk(); - $this->_response->statusCode(201); + $this->_response = $this->_response->withStatus(201); $this->assertResponseOk(); - $this->_response->statusCode(204); + $this->_response = $this->_response->withStatus(204); $this->assertResponseOk(); - $this->_response->statusCode(202); + $this->_response = $this->_response->withStatus(202); $this->assertResponseSuccess(); - $this->_response->statusCode(302); + $this->_response = $this->_response->withStatus(302); $this->assertResponseSuccess(); - $this->_response->statusCode(400); + $this->_response = $this->_response->withStatus(400); $this->assertResponseError(); - $this->_response->statusCode(417); + $this->_response = $this->_response->withStatus(417); $this->assertResponseError(); - $this->_response->statusCode(500); + $this->_response = $this->_response->withStatus(500); $this->assertResponseFailure(); - $this->_response->statusCode(505); + $this->_response = $this->_response->withStatus(505); $this->assertResponseFailure(); - $this->_response->statusCode(301); + $this->_response = $this->_response->withStatus(301); $this->assertResponseCode(301); } @@ -666,7 +669,7 @@ public function testAssertResponseStatusCodes() public function testAssertRedirect() { $this->_response = new Response(); - $this->_response->header('Location', 'http://localhost/tasks/index'); + $this->_response = $this->_response->withHeader('Location', 'http://localhost/tasks/index'); $this->assertRedirect(); $this->assertRedirect('/tasks/index'); @@ -709,7 +712,7 @@ public function testAssertNoRedirectFail() public function testAssertRedirectContains() { $this->_response = new Response(); - $this->_response->header('Location', 'http://localhost/tasks/index'); + $this->_response = $this->_response->withHeader('Location', 'http://localhost/tasks/index'); $this->assertRedirectContains('/tasks/index'); } @@ -722,7 +725,7 @@ public function testAssertRedirectContains() public function testAssertHeader() { $this->_response = new Response(); - $this->_response->header('Etag', 'abc123'); + $this->_response = $this->_response->withHeader('Etag', 'abc123'); $this->assertHeader('Etag', 'abc123'); } @@ -735,7 +738,7 @@ public function testAssertHeader() public function testAssertHeaderContains() { $this->_response = new Response(); - $this->_response->header('Etag', 'abc123'); + $this->_response = $this->_response->withHeader('Etag', 'abc123'); $this->assertHeaderContains('Etag', 'abc'); } @@ -775,7 +778,9 @@ public function testContentTypeInAction() public function testAssertResponseContains() { $this->_response = new Response(); - $this->_response->body('Some content'); + $body = $this->_response->getBody(); + $body->write('Some content'); + $this->_response = $this->_response->withBody($body); $this->assertResponseContains('content'); } @@ -788,7 +793,9 @@ public function testAssertResponseContains() public function testAssertResponseNotContains() { $this->_response = new Response(); - $this->_response->body('Some content'); + $body = $this->_response->getBody(); + $body->write('Some content'); + $this->_response = $this->_response->withBody($body); $this->assertResponseNotContains('contents'); } @@ -801,7 +808,9 @@ public function testAssertResponseNotContains() public function testAssertResponseRegExp() { $this->_response = new Response(); - $this->_response->body('Some content'); + $body = $this->_response->getBody(); + $body->write('Some content'); + $this->_response = $this->_response->withBody($body); $this->assertResponseRegExp('/cont/'); } @@ -826,7 +835,9 @@ public function testAssertResponseRegExpNoResponse() public function testAssertResponseNotRegExp() { $this->_response = new Response(); - $this->_response->body('Some content'); + $body = $this->_response->getBody(); + $body->write('Some content'); + $this->_response = $this->_response->withBody($body); $this->assertResponseNotRegExp('/cant/'); }