2008-09-12 21:25:38 +04:00
|
|
|
<?php
|
2008-09-13 10:34:47 +04:00
|
|
|
|
2009-01-22 22:38:10 +03:00
|
|
|
namespace Doctrine\Tests\Mocks;
|
2009-01-04 19:15:32 +03:00
|
|
|
|
2008-09-13 10:34:47 +04:00
|
|
|
|
2009-01-22 22:38:10 +03:00
|
|
|
class DriverMock implements \Doctrine\DBAL\Driver
|
2008-09-12 21:25:38 +04:00
|
|
|
{
|
2009-02-17 15:25:03 +03:00
|
|
|
private $_platformMock;
|
|
|
|
|
2008-09-12 21:25:38 +04:00
|
|
|
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
|
|
|
{
|
2009-01-22 22:38:10 +03:00
|
|
|
return new DriverConnectionMock();
|
2008-09-12 21:25:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructs the Sqlite PDO DSN.
|
|
|
|
*
|
|
|
|
* @return string The DSN.
|
|
|
|
* @override
|
|
|
|
*/
|
|
|
|
protected function _constructPdoDsn(array $params)
|
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
2009-02-17 15:25:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @override
|
|
|
|
*/
|
2008-09-12 21:25:38 +04:00
|
|
|
public function getDatabasePlatform()
|
|
|
|
{
|
2009-02-17 15:25:03 +03:00
|
|
|
if ( ! $this->_platformMock) {
|
|
|
|
$this->_platformMock = new DatabasePlatformMock;
|
|
|
|
}
|
|
|
|
return $this->_platformMock;
|
2008-09-12 21:25:38 +04:00
|
|
|
}
|
2009-02-17 15:25:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @override
|
|
|
|
*/
|
2009-01-22 22:38:10 +03:00
|
|
|
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
2008-09-12 21:25:38 +04:00
|
|
|
{
|
2009-01-22 22:38:10 +03:00
|
|
|
return new SchemaManagerMock($conn);
|
2008-09-12 21:25:38 +04:00
|
|
|
}
|
2009-02-17 15:25:03 +03:00
|
|
|
|
|
|
|
/* MOCK API */
|
|
|
|
|
|
|
|
public function setDatabasePlatform(\Doctrine\DBAL\Platforms\AbstractPlatform $platform)
|
|
|
|
{
|
|
|
|
$this->_platformMock = $platform;
|
|
|
|
}
|
2009-05-27 22:54:40 +04:00
|
|
|
|
|
|
|
public function getName()
|
|
|
|
{
|
|
|
|
return 'mock';
|
|
|
|
}
|
2009-02-18 10:59:11 +03:00
|
|
|
}
|