Using my-ciunit.
- Grab a copy of https://bitbucket.org/kenjis/my-ciunit
- Install PHPUnit 3.7.x
- Run the installation instructions.
- Presumably you didn't name the dadabase on the command line so go to
application/config/testing.database.php
and name your database with _test
- Create your database.
- Go to the
tests
folder and delete all the folders except controllers
. All these files are examples and obviously you won't have those fixtures.
- You only need the
SomeControllerTest.php
as a starting point. Edit it to hit a controller you actually have. I wanted to just add a basic access test.
class HomepageControllerTest extends CIUnit_TestCase {
public function setUp() {
$this->CI = set_controller('homepage');
}
public function testIndexController() {
$this->CI->index();
$out = output();
$this->assertNotEmpty($out);
}
}