Vendor update && Started using DoctrineMigrations
This commit is contained in:
92
vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/ConnectionMock.php
vendored
Normal file
92
vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/ConnectionMock.php
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
class ConnectionMock extends \Doctrine\DBAL\Connection
|
||||
{
|
||||
private $_fetchOneResult;
|
||||
private $_platformMock;
|
||||
private $_lastInsertId = 0;
|
||||
private $_inserts = array();
|
||||
|
||||
public function __construct(array $params, $driver, $config = null, $eventManager = null)
|
||||
{
|
||||
$this->_platformMock = new DatabasePlatformMock();
|
||||
|
||||
parent::__construct($params, $driver, $config, $eventManager);
|
||||
|
||||
// Override possible assignment of platform to database platform mock
|
||||
$this->_platform = $this->_platformMock;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return $this->_platformMock;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function insert($tableName, array $data, array $types = array())
|
||||
{
|
||||
$this->_inserts[$tableName][] = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function lastInsertId($seqName = null)
|
||||
{
|
||||
return $this->_lastInsertId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function fetchColumn($statement, array $params = array(), $colnum = 0)
|
||||
{
|
||||
return $this->_fetchOneResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function quote($input, $type = null)
|
||||
{
|
||||
if (is_string($input)) {
|
||||
return "'" . $input . "'";
|
||||
}
|
||||
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();
|
||||
$this->_lastInsertId = 0;
|
||||
}
|
||||
}
|
98
vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/DatabasePlatformMock.php
vendored
Normal file
98
vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/DatabasePlatformMock.php
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
class DatabasePlatformMock extends \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
{
|
||||
private $_sequenceNextValSql = "";
|
||||
private $_prefersIdentityColumns = true;
|
||||
private $_prefersSequences = false;
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getNativeDeclaration(array $field) {}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getPortableDeclaration(array $field) {}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function prefersIdentityColumns()
|
||||
{
|
||||
return $this->_prefersIdentityColumns;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function prefersSequences()
|
||||
{
|
||||
return $this->_prefersSequences;
|
||||
}
|
||||
|
||||
/** @override */
|
||||
public function getSequenceNextValSQL($sequenceName)
|
||||
{
|
||||
return $this->_sequenceNextValSql;
|
||||
}
|
||||
|
||||
/** @override */
|
||||
public function getBooleanTypeDeclarationSQL(array $field) {}
|
||||
|
||||
/** @override */
|
||||
public function getIntegerTypeDeclarationSQL(array $field) {}
|
||||
|
||||
/** @override */
|
||||
public function getBigIntTypeDeclarationSQL(array $field) {}
|
||||
|
||||
/** @override */
|
||||
public function getSmallIntTypeDeclarationSQL(array $field) {}
|
||||
|
||||
/** @override */
|
||||
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) {}
|
||||
|
||||
/** @override */
|
||||
public function getVarcharTypeDeclarationSQL(array $field) {}
|
||||
|
||||
/** @override */
|
||||
public function getClobTypeDeclarationSQL(array $field) {}
|
||||
|
||||
/* MOCK API */
|
||||
|
||||
public function setPrefersIdentityColumns($bool)
|
||||
{
|
||||
$this->_prefersIdentityColumns = $bool;
|
||||
}
|
||||
|
||||
public function setPrefersSequences($bool)
|
||||
{
|
||||
$this->_prefersSequences = $bool;
|
||||
}
|
||||
|
||||
public function setSequenceNextValSql($sql)
|
||||
{
|
||||
$this->_sequenceNextValSql = $sql;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'mock';
|
||||
}
|
||||
protected function initializeDoctrineTypeMappings() {
|
||||
}
|
||||
protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
* Gets the SQL Snippet used to declare a BLOB column type.
|
||||
*/
|
||||
public function getBlobTypeDeclarationSQL(array $field)
|
||||
{
|
||||
throw DBALException::notSupported(__METHOD__);
|
||||
}
|
||||
}
|
17
vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/DriverConnectionMock.php
vendored
Normal file
17
vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/DriverConnectionMock.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
class DriverConnectionMock implements \Doctrine\DBAL\Driver\Connection
|
||||
{
|
||||
public function prepare($prepareString) {}
|
||||
public function query() {}
|
||||
public function quote($input, $type=\PDO::PARAM_STR) {}
|
||||
public function exec($statement) {}
|
||||
public function lastInsertId($name = null) {}
|
||||
public function beginTransaction() {}
|
||||
public function commit() {}
|
||||
public function rollBack() {}
|
||||
public function errorCode() {}
|
||||
public function errorInfo() {}
|
||||
}
|
72
vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/DriverMock.php
vendored
Normal file
72
vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/DriverMock.php
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
|
||||
class DriverMock implements \Doctrine\DBAL\Driver
|
||||
{
|
||||
private $_platformMock;
|
||||
|
||||
private $_schemaManagerMock;
|
||||
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
return new DriverConnectionMock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the Sqlite PDO DSN.
|
||||
*
|
||||
* @return string The DSN.
|
||||
* @override
|
||||
*/
|
||||
protected function _constructPdoDsn(array $params)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
if ( ! $this->_platformMock) {
|
||||
$this->_platformMock = new DatabasePlatformMock;
|
||||
}
|
||||
return $this->_platformMock;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
if($this->_schemaManagerMock == null) {
|
||||
return new SchemaManagerMock($conn);
|
||||
} else {
|
||||
return $this->_schemaManagerMock;
|
||||
}
|
||||
}
|
||||
|
||||
/* MOCK API */
|
||||
|
||||
public function setDatabasePlatform(\Doctrine\DBAL\Platforms\AbstractPlatform $platform)
|
||||
{
|
||||
$this->_platformMock = $platform;
|
||||
}
|
||||
|
||||
public function setSchemaManager(\Doctrine\DBAL\Schema\AbstractSchemaManager $sm)
|
||||
{
|
||||
$this->_schemaManagerMock = $sm;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'mock';
|
||||
}
|
||||
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
101
vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php
vendored
Normal file
101
vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
/**
|
||||
* This class is a mock of the Statement interface that can be passed in to the Hydrator
|
||||
* to test the hydration standalone with faked result sets.
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
|
||||
{
|
||||
private $_resultSet;
|
||||
|
||||
/**
|
||||
* Creates a new mock statement that will serve the provided fake result set to clients.
|
||||
*
|
||||
* @param array $resultSet The faked SQL result set.
|
||||
*/
|
||||
public function __construct(array $resultSet)
|
||||
{
|
||||
$this->_resultSet = $resultSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches all rows from the result set.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fetchAll($fetchStyle = null, $columnIndex = null, array $ctorArgs = null)
|
||||
{
|
||||
return $this->_resultSet;
|
||||
}
|
||||
|
||||
public function fetchColumn($columnNumber = 0)
|
||||
{
|
||||
$row = current($this->_resultSet);
|
||||
if ( ! is_array($row)) return false;
|
||||
$val = array_shift($row);
|
||||
return $val !== null ? $val : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the next row in the result set.
|
||||
*
|
||||
*/
|
||||
public function fetch($fetchStyle = null)
|
||||
{
|
||||
$current = current($this->_resultSet);
|
||||
next($this->_resultSet);
|
||||
return $current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the cursor, enabling the statement to be executed again.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function closeCursor()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setResultSet(array $resultSet)
|
||||
{
|
||||
reset($resultSet);
|
||||
$this->_resultSet = $resultSet;
|
||||
}
|
||||
|
||||
public function bindColumn($column, &$param, $type = null)
|
||||
{
|
||||
}
|
||||
|
||||
public function bindValue($param, $value, $type = null)
|
||||
{
|
||||
}
|
||||
|
||||
public function bindParam($column, &$variable, $type = null, $length = null, $driverOptions = array())
|
||||
{
|
||||
}
|
||||
|
||||
public function columnCount()
|
||||
{
|
||||
}
|
||||
|
||||
public function errorCode()
|
||||
{
|
||||
}
|
||||
|
||||
public function errorInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public function execute($params = array())
|
||||
{
|
||||
}
|
||||
|
||||
public function rowCount()
|
||||
{
|
||||
}
|
||||
}
|
13
vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php
vendored
Normal file
13
vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
class SchemaManagerMock extends \Doctrine\DBAL\Schema\AbstractSchemaManager
|
||||
{
|
||||
public function __construct(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
parent::__construct($conn);
|
||||
}
|
||||
|
||||
protected function _getPortableTableColumnDefinition($tableColumn) {}
|
||||
}
|
81
vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/TaskMock.php
vendored
Normal file
81
vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/TaskMock.php
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
use Doctrine\Common\Cli\AbstractNamespace;
|
||||
|
||||
/**
|
||||
* TaskMock used for testing the CLI interface.
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
*/
|
||||
class TaskMock extends \Doctrine\Common\Cli\Tasks\AbstractTask
|
||||
{
|
||||
/**
|
||||
* Since instances of this class can be created elsewhere all instances
|
||||
* register themselves in this array for later inspection.
|
||||
*
|
||||
* @var array(TaskMock)
|
||||
*/
|
||||
static public $instances = array();
|
||||
|
||||
private $runCounter = 0;
|
||||
|
||||
/**
|
||||
* Constructor of Task Mock Object.
|
||||
* Makes sure the object can be inspected later.
|
||||
*
|
||||
* @param AbstractNamespace CLI Namespace, passed to parent constructor
|
||||
*/
|
||||
function __construct(AbstractNamespace $namespace)
|
||||
{
|
||||
self::$instances[] = $this;
|
||||
|
||||
parent::__construct($namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of times run() was called on this object.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRunCounter()
|
||||
{
|
||||
return $this->runCounter;
|
||||
}
|
||||
|
||||
/* Mock API */
|
||||
|
||||
/**
|
||||
* Method invoked by CLI to run task.
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->runCounter++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method supposed to generate the CLI Task Documentation
|
||||
*/
|
||||
public function buildDocumentation()
|
||||
{
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user