Skip to content
Permalink
Browse files

Add IntegrationTestCase::_getBodyAsString()

  • Loading branch information...
ravage84 committed Dec 5, 2016
1 parent 966d3b7 commit 92e001abe6554e8189cea4141b2624815496a114
Showing with 15 additions and 5 deletions.
  1. +15 −5 src/TestSuite/IntegrationTestCase.php
@@ -591,6 +591,16 @@ protected function _url($url)
return [$url, $query];
}
/**
* Get the response body as string
*
* @return string The response body.
*/
protected function _getBodyAsString()
{
return (string)$this->_response->getBody();
}
/**
* Fetches a view variable by name.
*
@@ -824,7 +834,7 @@ public function assertResponseEquals($content, $message = '')
if (!$this->_response) {
$this->fail('No response set, cannot assert content. ' . $message);
}
$this->assertEquals($content, (string)$this->_response->getBody(), $message);
$this->assertEquals($content, $this->_getBodyAsString(), $message);
}
/**
@@ -839,7 +849,7 @@ public function assertResponseContains($content, $message = '')
if (!$this->_response) {
$this->fail('No response set, cannot assert content. ' . $message);
}
$this->assertContains($content, (string)$this->_response->getBody(), $message);
$this->assertContains($content, $this->_getBodyAsString(), $message);
}
/**
@@ -854,7 +864,7 @@ public function assertResponseNotContains($content, $message = '')
if (!$this->_response) {
$this->fail('No response set, cannot assert content. ' . $message);
}
$this->assertNotContains($content, (string)$this->_response->getBody(), $message);
$this->assertNotContains($content, $this->_getBodyAsString(), $message);
}
/**
@@ -868,7 +878,7 @@ public function assertResponseNotEmpty($message = '')
if (!$this->_response) {
$this->fail('No response set, cannot assert content. ' . $message);
}
$this->assertNotEmpty((string)$this->_response->getBody(), $message);
$this->assertNotEmpty($this->_getBodyAsString(), $message);
}
/**
* Assert response content is empty.
@@ -881,7 +891,7 @@ public function assertResponseEmpty($message = '')
if (!$this->_response) {
$this->fail('No response set, cannot assert content. ' . $message);
}
$this->assertEmpty((string)$this->_response->getBody(), $message);
$this->assertEmpty($this->_getBodyAsString(), $message);
}
/**

0 comments on commit 92e001a

Please sign in to comment.
You can’t perform that action at this time.