diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-11-01 07:55:48 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-11-01 07:55:48 +0000 |
commit | f8b4c669063b49acd658b1d85194632b57350e68 (patch) | |
tree | 5fe90ad082bea167d8fefb9a0ce4b05363063cea /index.php | |
parent | 146f34dc07c7c47505d8a6e4bdf9e535fcddfbb5 (diff) |
Set up unit test framework. Tweak configuration so that it only runs in
command line mode, and expects to put data into test/var. Create a module
to wrap it that generates a nice text-only view of the output.
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -33,20 +33,25 @@ ini_set('display_errors', true); define('EXT', '.php'); define('DOCROOT', getcwd().DIRECTORY_SEPARATOR); -define('GALLERY', basename(__FILE__)); // If the front controller is a symlink, change to the real docroot -is_link(GALLERY) and chdir(dirname(realpath(__FILE__))); +is_link(basename(__FILE__)) and chdir(dirname(realpath(__FILE__))); // Define application and system paths define('APPPATH', realpath('core') . "/"); -define('VARPATH', realpath('var') . "/"); define('MODPATH', realpath('modules') . "/"); define('THEMEPATH', realpath('themes') . "/"); define('SYSPATH', realpath('kohana') . "/"); -// Override any settings here in index.local.php -file_exists('index.local.php') and include('index.local.php'); +// Force a test run if we're in command line mode. +if (PHP_SAPI == 'cli') { + $_SERVER['argv'] = array($_SERVER['argv'][0], 'test'); + define('TEST_MODE', 1); + @system('mkdir -p test/var/logs'); + define('VARPATH', realpath('test/var') . '/'); +} else { + define('VARPATH', realpath('var') . '/'); +} // Initialize. require SYSPATH . 'core/Bootstrap' . EXT;
\ No newline at end of file |