Forward compatibility with DBAL master
This commit is contained in:
parent
a14ba1e561
commit
450d92872a
@ -8,7 +8,7 @@ class ConnectionMock extends \Doctrine\DBAL\Connection
|
||||
private $_platformMock;
|
||||
private $_lastInsertId = 0;
|
||||
private $_inserts = array();
|
||||
|
||||
|
||||
public function __construct(array $params, $driver, $config = null, $eventManager = null)
|
||||
{
|
||||
$this->_platformMock = new DatabasePlatformMock();
|
||||
@ -18,7 +18,7 @@ class ConnectionMock extends \Doctrine\DBAL\Connection
|
||||
// Override possible assignment of platform to database platform mock
|
||||
$this->_platform = $this->_platformMock;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
@ -26,15 +26,15 @@ class ConnectionMock extends \Doctrine\DBAL\Connection
|
||||
{
|
||||
return $this->_platformMock;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function insert($tableName, array $data)
|
||||
public function insert($tableName, array $data, array $types = array())
|
||||
{
|
||||
$this->_inserts[$tableName][] = $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
@ -50,7 +50,7 @@ class ConnectionMock extends \Doctrine\DBAL\Connection
|
||||
{
|
||||
return $this->_fetchOneResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
@ -61,29 +61,29 @@ class ConnectionMock extends \Doctrine\DBAL\Connection
|
||||
}
|
||||
return $input;
|
||||
}
|
||||
|
||||
|
||||
/* Mock API */
|
||||
|
||||
public function setFetchOneResult($fetchOneResult)
|
||||
{
|
||||
$this->_fetchOneResult = $fetchOneResult;
|
||||
}
|
||||
|
||||
|
||||
public function setDatabasePlatform($platform)
|
||||
{
|
||||
$this->_platformMock = $platform;
|
||||
}
|
||||
|
||||
|
||||
public function setLastInsertId($id)
|
||||
{
|
||||
$this->_lastInsertId = $id;
|
||||
}
|
||||
|
||||
|
||||
public function getInserts()
|
||||
{
|
||||
return $this->_inserts;
|
||||
}
|
||||
|
||||
|
||||
public function reset()
|
||||
{
|
||||
$this->_inserts = array();
|
||||
|
@ -57,7 +57,7 @@ class DatabasePlatformMock extends \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
|
||||
/** @override */
|
||||
public function getVarcharTypeDeclarationSQL(array $field) {}
|
||||
|
||||
|
||||
/** @override */
|
||||
public function getClobTypeDeclarationSQL(array $field) {}
|
||||
|
||||
@ -85,6 +85,13 @@ class DatabasePlatformMock extends \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
|
||||
protected function initializeDoctrineTypeMappings()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Gets the SQL Snippet used to declare a BLOB column type.
|
||||
*/
|
||||
public function getBlobTypeDeclarationSQL(array $field)
|
||||
{
|
||||
throw DBALException::notSupported(__METHOD__);
|
||||
}
|
||||
}
|
@ -8,10 +8,10 @@ namespace Doctrine\Tests\Mocks;
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
|
||||
class HydratorMockStatement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
|
||||
{
|
||||
private $_resultSet;
|
||||
|
||||
private $_resultSet;
|
||||
|
||||
/**
|
||||
* Creates a new mock statement that will serve the provided fake result set to clients.
|
||||
*
|
||||
@ -21,7 +21,7 @@ class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
|
||||
{
|
||||
$this->_resultSet = $resultSet;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches all rows from the result set.
|
||||
*
|
||||
@ -31,7 +31,7 @@ class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
|
||||
{
|
||||
return $this->_resultSet;
|
||||
}
|
||||
|
||||
|
||||
public function fetchColumn($columnNumber = 0)
|
||||
{
|
||||
$row = current($this->_resultSet);
|
||||
@ -39,10 +39,10 @@ class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
|
||||
$val = array_shift($row);
|
||||
return $val !== null ? $val : false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches the next row in the result set.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function fetch($fetchStyle = null)
|
||||
{
|
||||
@ -50,7 +50,7 @@ class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
|
||||
next($this->_resultSet);
|
||||
return $current;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Closes the cursor, enabling the statement to be executed again.
|
||||
*
|
||||
@ -60,13 +60,13 @@ class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function setResultSet(array $resultSet)
|
||||
{
|
||||
reset($resultSet);
|
||||
$this->_resultSet = $resultSet;
|
||||
}
|
||||
|
||||
|
||||
public function bindColumn($column, &$param, $type = null)
|
||||
{
|
||||
}
|
||||
@ -78,7 +78,7 @@ class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
|
||||
public function bindParam($column, &$variable, $type = null, $length = null, $driverOptions = array())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function columnCount()
|
||||
{
|
||||
}
|
||||
@ -86,16 +86,26 @@ class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
|
||||
public function errorCode()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function errorInfo()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function execute($params = array())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function rowCount()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public function getIterator()
|
||||
{
|
||||
return $this->_resultSet;
|
||||
}
|
||||
|
||||
public function setFetchMode($fetchMode)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user