xref: /PHP-8.4/ext/pgsql/tests/02connection.phpt (revision 4f450b62)
1--TEST--
2PostgreSQL connection
3--EXTENSIONS--
4pgsql
5--SKIPIF--
6<?php include("inc/skipif.inc"); ?>
7--FILE--
8<?php
9// connection function tests
10
11include('inc/config.inc');
12
13$db = pg_pconnect($conn_str);
14var_dump($db);
15
16if (pg_connection_status($db) != PGSQL_CONNECTION_OK)
17{
18    echo "pg_connection_status() error\n";
19}
20if (!pg_connection_reset($db))
21{
22    echo "pg_connection_reset() error\n";
23}
24if (pg_connection_busy($db))
25{
26    echo "pg_connection_busy() error\n";
27}
28if (pg_transaction_status($db) != PGSQL_TRANSACTION_IDLE)
29{
30    echo "pg_transaction_status() error\n";
31}
32if (false === pg_host($db))
33{
34    echo "pg_host() error\n";
35}
36if (!pg_dbname($db))
37{
38    echo "pg_dbname() error\n";
39}
40if (!pg_port($db))
41{
42    echo "pg_port() error\n";
43}
44if (pg_tty($db))
45{
46    echo "pg_tty() error\n";
47}
48if (pg_options($db))
49{
50    echo "pg_options() error\n";
51}
52
53pg_close($db);
54
55?>
56--EXPECTF--
57object(PgSql\Connection)#%d (0) {
58}
59