Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 35562d3a4d70a2bc0f215ed8fcccfa76b1c66064 1 parent d08c010
@BenMorel authored
View
14 tests/Doctrine/Tests/Mocks/DriverMock.php
@@ -26,20 +26,6 @@ public function connect(array $params, $username = null, $password = null, array
}
/**
- * Constructs the Sqlite PDO DSN.
- *
- * @param array $params
- *
- * @return string The DSN.
- *
- * @override
- */
- protected function _constructPdoDsn(array $params)
- {
- return "";
- }
-
- /**
* {@inheritdoc}
*/
public function getDatabasePlatform()
View
22 tests/Doctrine/Tests/Mocks/EntityManagerMock.php
@@ -39,11 +39,6 @@ class EntityManagerMock extends \Doctrine\ORM\EntityManager
private $_proxyFactoryMock;
/**
- * @var array
- */
- private $_idGenerators = array();
-
- /**
* {@inheritdoc}
*/
public function getUnitOfWork()
@@ -103,21 +98,4 @@ public static function create($conn, \Doctrine\ORM\Configuration $config = null,
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
19 tests/Doctrine/Tests/Mocks/EntityPersisterMock.php
@@ -46,25 +46,6 @@ class EntityPersisterMock extends \Doctrine\ORM\Persisters\BasicEntityPersister
* @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
- *
- * @return mixed
*/
public function addInsert($entity)
{
View
17 tests/Doctrine/Tests/Mocks/HydratorMockStatement.php
@@ -69,21 +69,6 @@ public function closeCursor()
}
/**
- * @param array $resultSet
- *
- * @return void
- */
- public function setResultSet(array $resultSet)
- {
- reset($resultSet);
- $this->_resultSet = $resultSet;
- }
-
- public function bindColumn($column, &$param, $type = null)
- {
- }
-
- /**
* {@inheritdoc}
*/
public function bindValue($param, $value, $type = null)
@@ -93,7 +78,7 @@ public function bindValue($param, $value, $type = null)
/**
* {@inheritdoc}
*/
- public function bindParam($column, &$variable, $type = null, $length = null, $driverOptions = array())
+ public function bindParam($column, &$variable, $type = null)
{
}
View
16 tests/Doctrine/Tests/Mocks/IdentityIdGeneratorMock.php
@@ -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
32 tests/Doctrine/Tests/Mocks/SequenceMock.php
@@ -22,30 +22,6 @@ public function generate(EntityManager $em, $entity)
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 @@ public function reset()
{
$this->_sequenceNumber = 0;
}
-
- /**
- * @return void
- */
- public function autoinc()
- {
- $this->_sequenceNumber++;
- }
}
View
22 tests/Doctrine/Tests/Mocks/UnitOfWorkMock.php
@@ -53,28 +53,6 @@ public function setEntityPersister($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}
*/
public function setOriginalEntityData($entity, array $originalData)
View
7 tests/Doctrine/Tests/ORM/UnitOfWorkTest.php
@@ -7,7 +7,6 @@
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 @@ public function testSavingSingleEntityWithIdentityColumnForcesInsert()
// 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 @@ public function testCascadedIdentityColumnInsert()
//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
Please sign in to comment.
Something went wrong with that request. Please try again.