Unit tests: cleaned up outdated / unused / commented out code.
This commit is contained in:
parent
d08c010ae1
commit
35562d3a4d
@ -25,20 +25,6 @@ class DriverMock implements \Doctrine\DBAL\Driver
|
||||
return new DriverConnectionMock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the Sqlite PDO DSN.
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string The DSN.
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
protected function _constructPdoDsn(array $params)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -38,11 +38,6 @@ class EntityManagerMock extends \Doctrine\ORM\EntityManager
|
||||
*/
|
||||
private $_proxyFactoryMock;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $_idGenerators = array();
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -103,21 +98,4 @@ class EntityManagerMock extends \Doctrine\ORM\EntityManager
|
||||
|
||||
return new EntityManagerMock($conn, $config, $eventManager);
|
||||
}
|
||||
/*
|
||||
public function setIdGenerator($className, $generator)
|
||||
{
|
||||
$this->_idGenerators[$className] = $generator;
|
||||
}
|
||||
*/
|
||||
/** @override */
|
||||
/* public function getIdGenerator($className)
|
||||
{
|
||||
|
||||
if (isset($this->_idGenerators[$className])) {
|
||||
return $this->_idGenerators[$className];
|
||||
}
|
||||
|
||||
return parent::getIdGenerator($className);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -42,25 +42,6 @@ class EntityPersisterMock extends \Doctrine\ORM\Persisters\BasicEntityPersister
|
||||
*/
|
||||
private $existsCalled = false;
|
||||
|
||||
/**
|
||||
* @param object $entity
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
public function insert($entity)
|
||||
{
|
||||
$this->inserts[] = $entity;
|
||||
if ( ! is_null($this->mockIdGeneratorType) && $this->mockIdGeneratorType == \Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_IDENTITY
|
||||
|| $this->class->isIdGeneratorIdentity()) {
|
||||
$id = $this->identityColumnValueCounter++;
|
||||
$this->postInsertIds[$id] = $entity;
|
||||
return $id;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $entity
|
||||
*
|
||||
|
@ -68,21 +68,6 @@ class HydratorMockStatement implements \IteratorAggregate, \Doctrine\DBAL\Driver
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $resultSet
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setResultSet(array $resultSet)
|
||||
{
|
||||
reset($resultSet);
|
||||
$this->_resultSet = $resultSet;
|
||||
}
|
||||
|
||||
public function bindColumn($column, &$param, $type = null)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -93,7 +78,7 @@ class HydratorMockStatement implements \IteratorAggregate, \Doctrine\DBAL\Driver
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bindParam($column, &$variable, $type = null, $length = null, $driverOptions = array())
|
||||
public function bindParam($column, &$variable, $type = null)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
/**
|
||||
* Mock class for IdentityGenerator.
|
||||
*/
|
||||
class IdentityIdGeneratorMock extends \Doctrine\ORM\Id\IdentityGenerator
|
||||
{
|
||||
private $_mockPostInsertId;
|
||||
|
||||
public function setMockPostInsertId($id)
|
||||
{
|
||||
$this->_mockPostInsertId = $id;
|
||||
}
|
||||
}
|
@ -22,30 +22,6 @@ class SequenceMock extends \Doctrine\ORM\Id\SequenceGenerator
|
||||
return $this->_sequenceNumber++;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function nextId($seqName, $ondemand = true)
|
||||
{
|
||||
return $this->_sequenceNumber++;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function lastInsertId($table = null, $field = null)
|
||||
{
|
||||
return $this->_sequenceNumber - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function currId($seqName)
|
||||
{
|
||||
return $this->_sequenceNumber;
|
||||
}
|
||||
|
||||
/* Mock API */
|
||||
|
||||
/**
|
||||
@ -55,12 +31,4 @@ class SequenceMock extends \Doctrine\ORM\Id\SequenceGenerator
|
||||
{
|
||||
$this->_sequenceNumber = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function autoinc()
|
||||
{
|
||||
$this->_sequenceNumber++;
|
||||
}
|
||||
}
|
||||
|
@ -52,28 +52,6 @@ class UnitOfWorkMock extends \Doctrine\ORM\UnitOfWork
|
||||
$this->_persisterMock[$entityName] = $persister;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $entity
|
||||
* @param array $mockChangeSet
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setDataChangeSet($entity, array $mockChangeSet)
|
||||
{
|
||||
$this->_mockDataChangeSets[spl_object_hash($entity)] = $mockChangeSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $entity
|
||||
* @param mixed $state
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setEntityState($entity, $state)
|
||||
{
|
||||
$this->_entityStates[spl_object_hash($entity)] = $state;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -7,7 +7,6 @@ use Doctrine\Tests\Mocks\ConnectionMock;
|
||||
use Doctrine\Tests\Mocks\EntityManagerMock;
|
||||
use Doctrine\Tests\Mocks\UnitOfWorkMock;
|
||||
use Doctrine\Tests\Mocks\EntityPersisterMock;
|
||||
use Doctrine\Tests\Mocks\IdentityIdGeneratorMock;
|
||||
use Doctrine\Tests\Models\Forum\ForumUser;
|
||||
use Doctrine\Tests\Models\Forum\ForumAvatar;
|
||||
|
||||
@ -54,8 +53,6 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
|
||||
// Setup fake persister and id generator for identity generation
|
||||
$userPersister = new EntityPersisterMock($this->_emMock, $this->_emMock->getClassMetadata("Doctrine\Tests\Models\Forum\ForumUser"));
|
||||
$this->_unitOfWork->setEntityPersister('Doctrine\Tests\Models\Forum\ForumUser', $userPersister);
|
||||
//$idGeneratorMock = new IdentityIdGeneratorMock($this->_emMock);
|
||||
//$this->_emMock->setIdGenerator('Doctrine\Tests\Models\Forum\ForumUser', $idGeneratorMock);
|
||||
$userPersister->setMockIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_IDENTITY);
|
||||
|
||||
// Test
|
||||
@ -96,14 +93,10 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
|
||||
//ForumUser
|
||||
$userPersister = new EntityPersisterMock($this->_emMock, $this->_emMock->getClassMetadata("Doctrine\Tests\Models\Forum\ForumUser"));
|
||||
$this->_unitOfWork->setEntityPersister('Doctrine\Tests\Models\Forum\ForumUser', $userPersister);
|
||||
//$userIdGeneratorMock = new IdentityIdGeneratorMock($this->_emMock);
|
||||
//$this->_emMock->setIdGenerator('Doctrine\Tests\Models\Forum\ForumUser', $userIdGeneratorMock);
|
||||
$userPersister->setMockIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_IDENTITY);
|
||||
// ForumAvatar
|
||||
$avatarPersister = new EntityPersisterMock($this->_emMock, $this->_emMock->getClassMetadata("Doctrine\Tests\Models\Forum\ForumAvatar"));
|
||||
$this->_unitOfWork->setEntityPersister('Doctrine\Tests\Models\Forum\ForumAvatar', $avatarPersister);
|
||||
//$avatarIdGeneratorMock = new IdentityIdGeneratorMock($this->_emMock);
|
||||
//$this->_emMock->setIdGenerator('Doctrine\Tests\Models\Forum\ForumAvatar', $avatarIdGeneratorMock);
|
||||
$avatarPersister->setMockIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_IDENTITY);
|
||||
|
||||
// Test
|
||||
|
Loading…
Reference in New Issue
Block a user