xref: /PHP-8.4/ext/pdo_firebird/tests/testdb.inc (revision 6ec42201)
1<?php
2
3// Test defaults, assumes the following:
4//
5// Username: 	SYSDBA
6// Password:	phpfi
7// Database:	<nothing>
8//
9// A DSN must be specified by using PDO_FIREBIRD_TEST_DSN
10
11define('PDO_FIREBIRD_TEST_USER', getenv('PDO_FIREBIRD_TEST_USER') ?: 'SYSDBA');
12define('PDO_FIREBIRD_TEST_PASS', getenv('PDO_FIREBIRD_TEST_PASS') ?: 'phpfi');
13define('PDO_FIREBIRD_TEST_DSN', getenv('PDO_FIREBIRD_TEST_DSN') ?: '');
14
15if(!PDO_FIREBIRD_TEST_DSN)
16{
17        die('Error: PDO_FIREBIRD_TEST_DSN must be set');
18}
19
20function getDbConnection($class = PDO::class): PDO {
21    return new $class(PDO_FIREBIRD_TEST_DSN, PDO_FIREBIRD_TEST_USER, PDO_FIREBIRD_TEST_PASS);
22}
23
24function connectToDb(): Pdo\Firebird {
25    return Pdo\Firebird::connect(PDO_FIREBIRD_TEST_DSN, PDO_FIREBIRD_TEST_USER, PDO_FIREBIRD_TEST_PASS);
26}
27
28?>
29