Require config file in class
This 'problem' of yours can be solved using Separation of concern. Your Database class should not know about config and how it is loaded. It should simply ask for the stuff it needs. Neither should your Test class know how to connect. Your test class should test the Database class. And your database class should handle the 'connection failed' error of whatever library you are using.

For instance:

class DatabaseConnection
{
    public function __construct($host, $username, $password, $port='22'){
        if connection failed throw new ConnetionFailedException
    }
}


Your would then also have a config class that loads the correct config file. e.g.:

class Config
{
    public function __construct($enviroment)
    {
        $this-&gt;data = include __path_to_config_files_.'/'.$enviroment.'.inc';
    }
}


Your could for instance use a __get method to retrieve the data instead of having a getParameter.

your config file would look something like this:

__path_to_config_files_/development.inc

&lt;?php

return array(
    'key' =&gt; 'value'
);


And your test class would then:

$config = new Config('development'); //or whatever enviroment you are in
try {
    $connection = new DatabaseConnection($config-&gt;db['host'], $config-&gt;db['username'], $config-&gt;db['password']);
} catch(ConnetionFailedException) {
    //connection failed
}
//connection success