From: Robert Treat Date: Sat, 22 Nov 2008 04:51:56 +0000 (-0500) Subject: clean up directory lists, fix warnings when directory traversing, allow users to... X-Git-Tag: REL_5-0-BETA-1~129 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=5a8939c73a7d11345714a2fa646003b89149f355;p=phppgadmin.git clean up directory lists, fix warnings when directory traversing, allow users to specify list of dbs to test, fix spelling on notice, clean up documentation, rewrite examples to be clearer, and set them using databases given in config.inc.php-dist. --- diff --git a/build_tests.php b/build_tests.php index fec74448..91a4d96c 100755 --- a/build_tests.php +++ b/build_tests.php @@ -8,19 +8,21 @@ require('./conf/config.inc.php'); $test_dir = './tests/selenium/'; - $test_src_dir = "{$test_dir}/src/"; - $test_static_dir = "{$test_dir}/static/"; - $testsuite_file = "{$test_static_dir}/TestSuite.html"; + $test_src_dir = "{$test_dir}src/"; + $test_static_dir = "{$test_dir}static/"; + $testsuite_file = "{$test_static_dir}TestSuite.html"; if(isset($argv[1]) && ($argv[1] == 'clean')) { echo "Cleaning..."; /* delete server directories */ foreach ($conf['servers'] as $server) { - $dir = "{$test_static_dir}/{$server['desc']}"; - $dh = opendir($dir); - while($file = readdir($dh)) - if (($file != '.') && ($file != '..')) unlink("{$dir}/{$file}"); - rmdir($dir); + $dir = "{$test_static_dir}{$server['desc']}"; + while(is_dir($dir)) { + $dh = opendir($dir); + while($file = readdir($dh)) + if (($file != '.') && ($file != '..')) unlink("{$dir}/{$file}"); + rmdir($dir); + } } /* delete the TestSuite.html file */ @unlink($testsuite_file); @@ -49,6 +51,10 @@ /* Loop on the servers given in the conf/config.inc.conf file */ foreach ($conf['servers'] as $server) { + // Is this server in our list of configured servers? + if (!in_array($server['desc'],$test_servers)) + continue; + /* connect to the server to get its version * and test its feature along the tests */ $_c = new Connection($server['host'], @@ -61,7 +67,7 @@ $_type = $data = null; if (! $_c->conn->isConnected()) - die ("Connexion to {$server['desc']} failed !\n"); + die ("Connection to {$server['desc']} failed !\n"); else { if (($_type = $_c->getDriver($platform)) === null) { die( printf($lang['strpostgresqlversionnotsupported'], $postgresqlMinVer)); diff --git a/tests/selenium/config.test.php-dist b/tests/selenium/config.test.php-dist index 328988fb..28817ea4 100644 --- a/tests/selenium/config.test.php-dist +++ b/tests/selenium/config.test.php-dist @@ -1,34 +1,55 @@ the super user name, -* ... -* ) -* These profiles are only used to create the admin test role (or user) on each server. +/* An Array of the servers you want to use for testing, based on the entries + found in your conf/config.inc.php file, matching the $server[n]['desc'] + field. Once you have listed the server here, you need to make a + corresponding entry in the $super_user and $super_pass arrays that follow. */ -$super_user['7.3'] = $super_user['7.4'] = $super_user['8.0'] = -$super_user['8.1'] = $super_user['8.2'] = $super_user['8.3'] = 'postgres'; - -/* Associative array with the super user passwords for each configured server in your conf/config.inc.php : - * $superpass = array( - * the 'desc' part of the server in your conf/config.inc.php => the super user password, - * ... - * ) - */ -$super_pass['7.3'] = $super_pass['7.4'] = $super_pass['8.0'] = -$super_pass['8.1'] = $super_pass['8.2'] = $super_pass['8.3'] = 'pgpass'; - -/* name and pass of the admin user to create for tests*/ + +$test_servers = array('PostgreSQL','Test Server'); + +/* Associative array with the super user names for each configured server in + your conf/config.inc.php : + * $super_user = array( + * the 'desc' part of the server in your conf/config.inc.php => the + super user name, + * ... + * ) + These profiles are only used to create the admin test role (or user) on + each server. +*/ + +$super_user= array( + 'PostgreSQL' => 'ppa_user', + 'Test Server' => 'ppa_user', +); + + +/* Associative array with the super user passwords for each configured server + in your conf/config.inc.php : + * $super_pass = array( + * the 'desc' part of the server in your conf/config.inc.php => the + super user password, + * ... + * ) +*/ +$super_pass= array( + 'PostgreSQL' => 'secret', + 'Test Server' => 'password', +); + + +// name and pass of the admin user to create for tests $admin_user = 'admin_user'; $admin_user_pass = 'super'; -/* name and pass of the user to create for tests*/ +// name and pass of the user to create for tests $user = 'ppa_tests_user'; $user_pass = 'ppa_tests_user_pass'; -/* name of the database to create for tests */ +// name of the database to create for tests $testdb = 'ppatests_db'; -?> \ No newline at end of file + +?>