1
0
mirror of synced 2024-12-15 15:46:02 +03:00
doctrine2/tests/lib/mocks/Doctrine_ConnectionMock.php
2008-08-16 19:40:59 +00:00

65 lines
1.2 KiB
PHP

<?php
require_once 'lib/mocks/Doctrine_SequenceMock.php';
require_once 'lib/mocks/Doctrine_DatabasePlatformMock.php';
class Doctrine_ConnectionMock extends Doctrine_Connection
{
protected $_driverName = 'Mock';
private $_sequenceModuleMock;
private $_platformMock;
private $_inserts = array();
public function __construct(array $params)
{
parent::__construct($params);
}
/**
* @override
*/
public function getSequenceManager()
{
return $this->_sequenceModuleMock;
}
/**
* @override
*/
public function getDatabasePlatform()
{
return $this->_platformMock;
}
/**
* @override
*/
public function insert($tableName, array $data)
{
$this->_inserts[$tableName][] = $data;
}
/* Mock API */
public function setDatabasePlatform($platform)
{
$this->_platformMock = $platform;
}
public function setSequenceManager($seqManager)
{
$this->_sequenceModuleMock = $seqManager;
}
public function getInserts()
{
return $this->_inserts;
}
public function reset()
{
$this->_inserts = array();
}
}
?>