test_case = $test_case; } public function get_database_config() { if (!file_exists('test_config.php')) { trigger_error("You have to create a test_config.php like this: $dbms, 'dbhost' => $dbhost, 'dbport' => $dbport, 'dbname' => $dbname, 'dbuser' => $dbuser, 'dbpasswd' => $dbpasswd, ); } public function new_dbal() { global $phpbb_root_path, $phpEx; $config = $this->get_database_config(); require_once '../phpBB/includes/db/' . $config['dbms'] . '.php'; $dbal = 'dbal_' . $config['dbms']; $db = new $dbal(); $db->sql_connect($config['dbhost'], $config['dbuser'], $config['dbpasswd'], $config['dbname'], $config['dbport']); return $db; } public function setExpectedTriggerError($errno, $message = '') { $exceptionName = ''; switch ($errno) { case E_NOTICE: case E_STRICT: PHPUnit_Framework_Error_Notice::$enabled = true; $exceptionName = 'PHPUnit_Framework_Error_Notice'; break; case E_WARNING: PHPUnit_Framework_Error_Warning::$enabled = true; $exceptionName = 'PHPUnit_Framework_Error_Warning'; break; default: $exceptionName = 'PHPUnit_Framework_Error'; break; } $this->expectedTriggerError = true; $this->test_case->setExpectedException($exceptionName, (string) $message, $errno); } }