1
0
mirror of synced 2024-12-13 14:56:01 +03:00

Unit tests: cleaned up outdated / unused / commented out code.

This commit is contained in:
Benjamin Morel 2013-02-12 15:51:24 +00:00
parent d08c010ae1
commit 35562d3a4d
8 changed files with 1 additions and 148 deletions

View File

@ -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}
*/

View File

@ -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);
}
*/
}

View File

@ -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
*

View File

@ -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)
{
}

View File

@ -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;
}
}

View File

@ -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++;
}
}

View File

@ -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}
*/

View File

@ -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