1
0
mirror of synced 2025-01-18 22:41:43 +03:00
doctrine2/tests/lib/Doctrine_TestUtil.php

17 lines
583 B
PHP
Raw Normal View History

2008-02-10 19:08:31 +00:00
<?php
class Doctrine_TestUtil
{
public static function getConnection()
{
if (isset($GLOBALS['db_type'], $GLOBALS['db_username'], $GLOBALS['db_password'],
$GLOBALS['db_host'], $GLOBALS['db_name'])) {
$dsn = "{$GLOBALS['db_type']}://{$GLOBALS['db_username']}:{$GLOBALS['db_password']}@{$GLOBALS['db_host']}/{$GLOBALS['db_name']}";
return Doctrine_Manager::connection($dsn, 'testconn');
} else {
return Doctrine_Manager::connection(new PDO('sqlite::memory:'), 'testconn');
}
}
}