Reputation: 19325
How do I go about integrating Simpletest with Kohana 3? I have checked out this answer but I like to use the autorun.php functionality from SimpleTest.
Upvotes: 1
Views: 843
Reputation: 19325
After some hours of looking over the code, I have discovered how to do it
My example:
<?php
include_once ("../../test_index.php");
include_once ("../simpletest/autorun.php");
class kohana_init_test extends UnitTestCase
{
function testTrue()
{
$this->assertTrue(true);
}
function testWelcome()
{
$response = Request::factory('main/index')->execute()->response;
$this->assertEqual($response->content, 'testing');
}
}
?>
Some notes: the $response variable depends on if you are using a View or pure text output. If you are using the template controller or a view, then $response is the view which you have used to render the content. Variables in the view are avaliable , as shown above (the variable content is defined inside the view).
Upvotes: 1