[feature/dbal-tests] Only output the missing config error message once.

The error message was also not properly escaping the variables, thus
producing an incorrect example configuration file.
This commit is contained in:
Nils Adermann 2010-04-01 19:15:34 +02:00
parent 53ab8886b1
commit 2bbfa9c29f

View file

@ -20,16 +20,28 @@ class phpbb_test_case_helpers
public function get_database_config() public function get_database_config()
{ {
static $show_error = true;
if (!file_exists('test_config.php')) if (!file_exists('test_config.php'))
{ {
if ($show_error)
{
$show_error = false;
}
else
{
$this->test_case->markTestSkipped('Missing test_config.php: See first error.');
return;
}
trigger_error("You have to create a test_config.php like this: trigger_error("You have to create a test_config.php like this:
\"<?php \"<?php
$dbms = 'mysqli'; \$dbms = 'mysqli';
$dbhost = 'localhost'; \$dbhost = 'localhost';
$dbport = ''; \$dbport = '';
$dbname = 'database'; \$dbname = 'database';
$dbuser = 'user'; \$dbuser = 'user';
$dbpasswd = 'password'; \$dbpasswd = 'password';
\" \"
NOTE: The database is dropped and recreated with the phpbb-db-schema! Do NOT specify a database with important data.", E_USER_ERROR); NOTE: The database is dropped and recreated with the phpbb-db-schema! Do NOT specify a database with important data.", E_USER_ERROR);