2008-02-10 19:08:31 +00:00
|
|
|
<?php
|
|
|
|
|
2009-01-04 16:15:32 +00:00
|
|
|
#namespace Doctrine\Tests;
|
|
|
|
|
2008-02-10 19:08:31 +00:00
|
|
|
class Doctrine_TestUtil
|
2008-02-11 19:56:26 +00:00
|
|
|
{
|
2008-02-10 19:08:31 +00:00
|
|
|
public static function getConnection()
|
|
|
|
{
|
|
|
|
if (isset($GLOBALS['db_type'], $GLOBALS['db_username'], $GLOBALS['db_password'],
|
2009-01-12 13:34:41 +00:00
|
|
|
$GLOBALS['db_host'], $GLOBALS['db_name'], $GLOBALS['db_port'])) {
|
2008-06-15 15:56:28 +00:00
|
|
|
$params = array(
|
|
|
|
'driver' => $GLOBALS['db_type'],
|
|
|
|
'user' => $GLOBALS['db_username'],
|
|
|
|
'password' => $GLOBALS['db_password'],
|
|
|
|
'host' => $GLOBALS['db_host'],
|
2009-01-12 13:34:41 +00:00
|
|
|
'dbname' => $GLOBALS['db_name'],
|
|
|
|
'port' => $GLOBALS['db_port']
|
2008-06-15 15:56:28 +00:00
|
|
|
);
|
2008-02-10 19:08:31 +00:00
|
|
|
} else {
|
2008-06-15 15:56:28 +00:00
|
|
|
$params = array(
|
2008-09-12 17:25:38 +00:00
|
|
|
'driver' => 'pdo_sqlite',
|
2008-07-04 16:32:19 +00:00
|
|
|
'memory' => true
|
2008-06-15 15:56:28 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-09-13 10:28:29 +00:00
|
|
|
return Doctrine_DBAL_DriverManager::getConnection($params);
|
2008-02-10 19:08:31 +00:00
|
|
|
}
|
|
|
|
}
|