Assertions
Here's the list of current assertions:
###AssertContains Checks the response body for a match against the given term
<?php
$this->get('/foo.php','remote-host.com')
->assertContains('find this text')
?>
Additionally, for those more technically minded, you can also use XPath expressions to check for values:
<?php
$this->get('/foo.php','remote-host.com')
->assertContains("//*[@name='find this text']",TEST::TYPE_XPATH);
?>
Just be sure to pass that TEST:TYPE_XPATH as a second parameter.
There's also a more specific kind of searching you can do on JSON results:
<?php
$this->get('/foo.php','remote-host.com','json')
->assertContains('find this text','myresponse/messages/message1')
?>
In this example, we tell the get() to handle the response it gets as a JSON object. In that object we have an object like $jsonObject->myresponse->messages->message. The second parameter on the assertContains allows us to specify the "path" to search on.
###AssertCookieIsSet Checks the response message to see if a specific cookie is set.
<?php
$this->get('/foo.php','remote-host.com')
->assertCookieIsSet('my_cookie');
?>
###AssertEquals Checks to ensure that the returned value is an exact match for the given term.
<?php
$this->get('/foo.php','remote-host.com')
->assertEquals('must be exact');
?>
###AssertPageTitle Checks the page title of the returned data (the HTML title) for an exact match.
<?php
$this->get('/foo.php','remote-host.com')
->assertPageTitle('Page Title');
?>
###AssertResponseCode Checks the HTTP return code for the response.
<?php
$this->get('/foo.php','remote-host.com')
->assertResponseCode(200);
?>