mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
28 lines
797 B
PHP
28 lines
797 B
PHP
<?php
|
|
|
|
// Test defaults, assumes the following:
|
|
//
|
|
// Username: SYSDBA
|
|
// Password: phpfi
|
|
// Database: <nothing>
|
|
//
|
|
// A DSN must be specified by using PDO_FIREBIRD_TEST_DSN
|
|
|
|
define('PDO_FIREBIRD_TEST_USER', getenv('PDO_FIREBIRD_TEST_USER') ?: 'SYSDBA');
|
|
define('PDO_FIREBIRD_TEST_PASS', getenv('PDO_FIREBIRD_TEST_PASS') ?: 'phpfi');
|
|
define('PDO_FIREBIRD_TEST_DSN', getenv('PDO_FIREBIRD_TEST_DSN') ?: '');
|
|
|
|
if(!PDO_FIREBIRD_TEST_DSN)
|
|
{
|
|
die('Error: PDO_FIREBIRD_TEST_DSN must be set');
|
|
}
|
|
|
|
function getDbConnection($class = PDO::class): PDO {
|
|
return new $class(PDO_FIREBIRD_TEST_DSN, PDO_FIREBIRD_TEST_USER, PDO_FIREBIRD_TEST_PASS);
|
|
}
|
|
|
|
function connectToDb(): Pdo\Firebird {
|
|
return Pdo\Firebird::connect(PDO_FIREBIRD_TEST_DSN, PDO_FIREBIRD_TEST_USER, PDO_FIREBIRD_TEST_PASS);
|
|
}
|
|
|
|
?>
|