That's what I'm doing:
- Download Test.php
- Create the 't' directory in the root of my CI application
- Put Test.php in the t directory
- Create a bootstrap.php file (see below) to initiate testing
require_once bootstrap.php file in my tests.- Run
prove in the tests in the t directory
bootstrap.php :
<?php // Initialize CodeIgniter, suppressing output. ob_start(); require_once __DIR__ . '/../index.php'; ob_end_clean(); require_once __DIR__ . '/Test.php';
Test example:
t/000-sanity.t :
#!/usr/bin/env php <?php require_once 'bootstrap.php'; plan(1); is(true, true, 'Test.php works');
All CodeIgniter files available. For example, you can do $ci =& get_instance();
This setting works fine in CI 1.7.x and 2.x. Test.php is really easy to use.
duma
source share