1
0
mirror of synced 2024-12-14 07:06:04 +03:00
doctrine2/tests/Doctrine/Tests/DBAL/DriverManagerTest.php

52 lines
1.3 KiB
PHP
Raw Normal View History

2009-07-15 02:36:09 +04:00
<?php
namespace Doctrine\Tests\DBAL;
require_once __DIR__ . '/../TestInit.php';
class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
{
/**
* @expectedException \Doctrine\Common\DoctrineException
*/
public function testCantInstantiateDriverManager()
{
$test = new \Doctrine\DBAL\DriverManager();
}
/**
* @expectedException \Doctrine\Common\DoctrineException
*/
public function testInvalidPdoInstance()
{
$options = array(
'pdo' => 'test'
);
$test = \Doctrine\DBAL\DriverManager::getConnection($options);
}
public function testValidPdoInstance()
{
$options = array(
'pdo' => new \PDO('sqlite::memory:')
);
$conn = \Doctrine\DBAL\DriverManager::getConnection($options);
$this->assertEquals('sqlite', $conn->getDatabasePlatform()->getName());
}
/**
* @expectedException \Doctrine\Common\DoctrineException
*/
public function testCheckParams()
{
$conn = \Doctrine\DBAL\DriverManager::getConnection(array());
}
/**
* @expectedException \Doctrine\Common\DoctrineException
*/
public function testInvalidDriver()
{
$conn = \Doctrine\DBAL\DriverManager::getConnection(array('driver' => 'invalid_driver'));
}
}