Skip to content
Permalink
Browse files

Refactor to use helper method + test coverage.

Refs #9842
Refs #9847
  • Loading branch information...
markstory committed Dec 8, 2016
1 parent 9b3a191 commit fc2d1f4fc8924a261d28670ce16f42d583f983dc
Showing with 26 additions and 2 deletions.
  1. +2 −2 src/TestSuite/IntegrationTestCase.php
  2. +24 −0 tests/TestCase/TestSuite/IntegrationTestCaseTest.php
@@ -879,7 +879,7 @@ public function assertResponseRegExp($pattern, $message = '')
if (!$this->_response) {
$this->fail('No response set, cannot assert content. ' . $message);
}
$this->assertRegExp($pattern, (string)$this->_response->body(), $message);
$this->assertRegExp($pattern, $this->_getBodyAsString(), $message);
}
/**
@@ -894,7 +894,7 @@ public function assertResponseNotRegExp($pattern, $message = '')
if (!$this->_response) {
$this->fail('No response set, cannot assert content. ' . $message);
}
$this->assertNotRegExp($pattern, (string)$this->_response->body(), $message);
$this->assertNotRegExp($pattern, $this->_getBodyAsString(), $message);
}
/**
@@ -762,6 +762,18 @@ public function testAssertResponseRegExp()
$this->assertResponseRegExp('/cont/');
}
/**
* Test the content regexp assertion failing
*
* @expectedException \PHPUnit_Framework_AssertionFailedError
* @expectedExceptionMessage No response set
* @return void
*/
public function testAssertResponseRegExpNoResponse()
{
$this->assertResponseRegExp('/cont/');
}
/**
* Test the negated content regexp assertion.
*
@@ -775,6 +787,18 @@ public function testAssertResponseNotRegExp()
$this->assertResponseNotRegExp('/cant/');
}
/**
* Test negated content regexp assertion failing
*
* @expectedException \PHPUnit_Framework_AssertionFailedError
* @expectedExceptionMessage No response set
* @return void
*/
public function testAssertResponseNotRegExpNoResponse()
{
$this->assertResponseNotRegExp('/cont/');
}
/**
* Test that works in tandem with testEventManagerReset2 to
* test the EventManager reset.

0 comments on commit fc2d1f4

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