I want to use the variables that have been declared in a config.php file in a class for testing. I am not sure if this is the right way like I have done it.I have a configuration file, config.php:class Config {    public $hosts = array(        'a' => '192.168.1.10'        'b' => '192.168.1.11',    );    public $ports = array(        'a' => 22,        'b' => 22,    );}These are the variables I want to include in a file called Tests.php:require_once 'config.php';    class Test extends PHPUnit_Framework_TestCase    {        protected $hosts;        protected $ports;        ...        public function __setUp()        {            $config = new Config();            $this->hosts = $config->hosts;            $this->portsSsh = $config->ports;            ...        }        public function testConnect()        {            $session = $this->connect($this->hosts['a'], $this->ports['a']);            $this->closeConnection($session);        }    ...    }Is it right doing it like this? I have the impression it is too complicated. I have to make a class for the config.php file and in the test class I have to do like a mapping $this->hosts = $config->hosts. That I don't like so much, because I have about 14 variables and first I have to declare them all and later I have to assign them all in the setUp() method. Isn't there a shorter or simpler way? I was thinking of using a loop and I don't want to use globals.I wonder if I should do it like this:require_once 'config.php';        class Test extends PHPUnit_Framework_TestCase        {            protected $hosts;            protected $ports;            ...            public function __setUp()            {                $this->config = new Config();            }            public function testConnect()            {                $session = $this->connect($this->config->hosts['a'], $this->config->ports['a']);                $this->closeConnection($session);            }        ...        }
Require config file in class
php;unit testing