cvs: php4 /pear/DB/tests db_parsedsn.phpt

From: Date: Sun, 13 Jan 2002 18:28:10 +0000
Subject: cvs: php4 /pear/DB/tests db_parsedsn.phpt
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1924@lists.php.net to get a copy of this message
cox Sun Jan 13 13:28:10 2002 EDT Modified files: /php4/pear/DB/tests db_parsedsn.phpt Log: Test update Index: php4/pear/DB/tests/db_parsedsn.phpt diff -u php4/pear/DB/tests/db_parsedsn.phpt:1.4 php4/pear/DB/tests/db_parsedsn.phpt:1.5 --- php4/pear/DB/tests/db_parsedsn.phpt:1.4 Sat Apr 21 21:09:14 2001 +++ php4/pear/DB/tests/db_parsedsn.phpt Sun Jan 13 13:28:10 2002 @@ -5,36 +5,246 @@ --FILE-- <?php // -*- C++ -*- -// Test for: DB.php -// Parts tested: DB_Error, DB_Warning +// Test for: DB::parseDSN() require_once "DB.php"; function test($dsn) { - print implode(",", DB::parseDSN($dsn))."\n"; + echo "DSN: $dsn\n"; + print_r(DB::parseDSN($dsn)); } -print "testing DB::parseDSN...\n"; +print "testing DB::parseDSN...\n\n"; + test("mysql"); test("odbc(mssql)"); test("mysql://localhost"); test("mysql://remote.host.com/db"); -test("mysql://testuser:testpw@"); +test("oci8://system:manager@"); test("oci8://user:pass@tns-name"); -test("odbc(solid)://foo:bar@tcp+localhost+1313"); -test("ibase://user%40domain:password@database"); +test("odbc(solid)://foo:bar@tcp+localhost+1313"); // deprecated +test("pgsql://user@unix+localhost/pear"); // deprecated +test("ibase://user%40domain:password@host"); +test("ibase://user@domain:pass@word@/database"); // also supported -/* phptype,dbsyntax,protocol,hostspec,database,username,password */ +// new formats +test("odbc(solid)://foo:bar@localhost:1313"); +test("pgsql://user@unix()/pear"); +test("mysql://user@unix(/path/to/socket)/pear"); +test("pgsql://user@tcp()/pear"); +test("pgsql://user@tcp(somehost)/pear"); +test("pgsql://user:pass@word@tcp(somehost:7777)/pear"); ?> --GET-- --POST-- --EXPECT-- testing DB::parseDSN... -mysql,mysql,,,,, -odbc,mssql,,,,, -mysql,mysql,,localhost,,, -mysql,mysql,,remote.host.com,db,, -mysql,mysql,,,,testuser,testpw -oci8,oci8,,tns-name,,user,pass -odbc,solid,tcp,localhost 1313,,foo,bar -ibase,ibase,,database,,user@domain,password + +DSN: mysql +Array +( + [phptype] => mysql + [dbsyntax] => mysql + [username] => + [password] => + [protocol] => + [hostspec] => + [port] => + [socket] => + [database] => +) +DSN: odbc(mssql) +Array +( + [phptype] => odbc + [dbsyntax] => mssql + [username] => + [password] => + [protocol] => + [hostspec] => + [port] => + [socket] => + [database] => +) +DSN: mysql://localhost +Array +( + [phptype] => mysql + [dbsyntax] => mysql + [username] => + [password] => + [protocol] => tcp + [hostspec] => localhost + [port] => + [socket] => + [database] => +) +DSN: mysql://remote.host.com/db +Array +( + [phptype] => mysql + [dbsyntax] => mysql + [username] => + [password] => + [protocol] => tcp + [hostspec] => remote.host.com + [port] => + [socket] => + [database] => db +) +DSN: oci8://system:manager@ +Array +( + [phptype] => oci8 + [dbsyntax] => oci8 + [username] => system + [password] => manager + [protocol] => tcp + [hostspec] => + [port] => + [socket] => + [database] => +) +DSN: oci8://user:pass@tns-name +Array +( + [phptype] => oci8 + [dbsyntax] => oci8 + [username] => user + [password] => pass + [protocol] => tcp + [hostspec] => tns-name + [port] => + [socket] => + [database] => +) +DSN: odbc(solid)://foo:bar@tcp+localhost+1313 +Array +( + [phptype] => odbc + [dbsyntax] => solid + [username] => foo + [password] => bar + [protocol] => tcp + [hostspec] => localhost 1313 + [port] => + [socket] => + [database] => +) +DSN: pgsql://user@unix+localhost/pear +Array +( + [phptype] => pgsql + [dbsyntax] => pgsql + [username] => user + [password] => + [protocol] => unix + [hostspec] => + [port] => + [socket] => localhost + [database] => pear +) +DSN: ibase://user%40domain:password@host +Array +( + [phptype] => ibase + [dbsyntax] => ibase + [username] => user@domain + [password] => password + [protocol] => tcp + [hostspec] => host + [port] => + [socket] => + [database] => +) +DSN: ibase://user@domain:pass@word@/database +Array +( + [phptype] => ibase + [dbsyntax] => ibase + [username] => user@domain + [password] => pass@word + [protocol] => tcp + [hostspec] => + [port] => + [socket] => + [database] => database +) +DSN: odbc(solid)://foo:bar@localhost:1313 +Array +( + [phptype] => odbc + [dbsyntax] => solid + [username] => foo + [password] => bar + [protocol] => tcp + [hostspec] => localhost + [port] => 1313 + [socket] => + [database] => +) +DSN: pgsql://user@unix()/pear +Array +( + [phptype] => pgsql + [dbsyntax] => pgsql + [username] => user + [password] => + [protocol] => unix + [hostspec] => + [port] => + [socket] => + [database] => pear +) +DSN: mysql://user@unix(/path/to/socket)/pear +Array +( + [phptype] => mysql + [dbsyntax] => mysql + [username] => user + [password] => + [protocol] => unix + [hostspec] => + [port] => + [socket] => /path/to/socket + [database] => pear +) +DSN: pgsql://user@tcp()/pear +Array +( + [phptype] => pgsql + [dbsyntax] => pgsql + [username] => user + [password] => + [protocol] => tcp + [hostspec] => + [port] => + [socket] => + [database] => pear +) +DSN: pgsql://user@tcp(somehost)/pear +Array +( + [phptype] => pgsql + [dbsyntax] => pgsql + [username] => user + [password] => + [protocol] => tcp + [hostspec] => somehost + [port] => + [socket] => + [database] => pear +) +DSN: pgsql://user:pass@word@tcp(somehost:7777)/pear +Array +( + [phptype] => pgsql + [dbsyntax] => pgsql + [username] => user + [password] => pass@word + [protocol] => tcp + [hostspec] => somehost + [port] => 7777 + [socket] => + [database] => pear +)

« previous php.pear.cvs (#1924) next »