From f8b4c669063b49acd658b1d85194632b57350e68 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 1 Nov 2008 07:55:48 +0000 Subject: 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. --- index.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 839fe876..ff3c5dda 100644 --- a/index.php +++ b/index.php @@ -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 -- cgit v1.2.3