diff options
author | Aleksander Machniak <alec@alec.pl> | 2017-04-22 09:14:56 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2017-04-22 09:14:56 +0300 |
commit | ce61c8210e5d419ae03395dd7be7ea87ab931b93 (patch) | |
tree | d69ddff6d7bd084f5d612692deff46aa7b11d73e /tests | |
parent | 757ba8b81acac2a625c49b5f6671099efb8afef8 (diff) |
Added test for rcube_db::parse_dsn()
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Framework/DB.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/Framework/DB.php b/tests/Framework/DB.php index 23febfc10..2d27a0893 100644 --- a/tests/Framework/DB.php +++ b/tests/Framework/DB.php @@ -123,6 +123,20 @@ class Framework_DB extends PHPUnit_Framework_TestCase $this->assertSame($expected, implode("\n", $db->queries), "Query parsing [2]"); } + + function test_parse_dsn() + { + $dsn = "mysql://USERNAME:PASSWORD@HOST:3306/DATABASE"; + + $result = rcube_db::parse_dsn($dsn); + + $this->assertSame('mysql', $result['phptype'], "DSN parser: phptype"); + $this->assertSame('USERNAME', $result['username'], "DSN parser: username"); + $this->assertSame('PASSWORD', $result['password'], "DSN parser: password"); + $this->assertSame('3306', $result['port'], "DSN parser: port"); + $this->assertSame('HOST', $result['hostspec'], "DSN parser: hostspec"); + $this->assertSame('DATABASE', $result['database'], "DSN parser: database"); + } } /** |