Example #1
0
 public function testProtoUserPassHostPortName()
 {
     $connections = array(array('mysql', 'root', 'pass', 'localhost', '3306', 'dbname'), array('mysql', 'user', '&*3jxsS', 'my-mysql.com.pl', '3307', 'database_name'));
     foreach ($connections as $connection) {
         list($driver, $user, $password, $host, $port, $dbname) = $connection;
         $dsn = "{$driver}://{$user}:{$password}@{$host}:{$port}/{$dbname}";
         $settings = new Settings($dsn);
         $this->assertEquals($settings->getDriver(), $driver);
         $this->assertEquals($settings->getUsername(), $user);
         $this->assertEquals($settings->getPassword(), $password);
         $this->assertEquals($settings->getHost(), $host);
         $this->assertEquals($settings->getPort(), $port);
         $this->assertEquals($settings->getDatabase(), $dbname);
     }
 }