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