From 880397ab9efbe0c394a3e81c10ca11f6e56ce083 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Thu, 14 Feb 2008 15:00:36 +0000 Subject: [PATCH] Test: Made test.php work if it was in a different directory than the current directory. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@305 44740490-163a-0410-bde0-09ae8108e29a --- bin/test.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/test.php b/bin/test.php index d5a788907..c0713b820 100755 --- a/bin/test.php +++ b/bin/test.php @@ -9,7 +9,18 @@ $tests = array(); -require_once('../config/test.php'); +/* The configuration file is relative to this script. */ +$configFile = dirname(dirname(__FILE__)) . '/config/test.php'; + +/* Check if the configuration file exists. */ +if(!file_exists($configFile)) { + echo('Missing configuration file: ' . $configFile . "\n"); + echo('Maybe you need to copy config/test-template.php to config/test.php and update it?.' . "\n"); + exit(1); +} + +/* Load the configuration file. */ +require_once($configFile); /** * This function creates a curl handle and initializes it. -- GitLab