1
0
mirror of synced 2024-12-13 14:56:01 +03:00
doctrine2/tests/Doctrine/Tests/TestUtil.php

28 lines
848 B
PHP
Raw Normal View History

2008-02-10 22:08:31 +03:00
<?php
namespace Doctrine\Tests;
2009-01-04 19:15:32 +03:00
class TestUtil
2008-02-11 22:56:26 +03:00
{
2008-02-10 22:08:31 +03:00
public static function getConnection()
{
if (isset($GLOBALS['db_type'], $GLOBALS['db_username'], $GLOBALS['db_password'],
$GLOBALS['db_host'], $GLOBALS['db_name'], $GLOBALS['db_port'])) {
$params = array(
'driver' => $GLOBALS['db_type'],
'user' => $GLOBALS['db_username'],
'password' => $GLOBALS['db_password'],
'host' => $GLOBALS['db_host'],
'dbname' => $GLOBALS['db_name'],
'port' => $GLOBALS['db_port']
);
2008-02-10 22:08:31 +03:00
} else {
$params = array(
2008-09-12 21:25:38 +04:00
'driver' => 'pdo_sqlite',
'memory' => true
);
}
return \Doctrine\DBAL\DriverManager::getConnection($params);
2008-02-10 22:08:31 +03:00
}
}