Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #579 from BenMorel/cleanup

Unit tests: cleanup of outdated / unused / commented out code
  • Loading branch information...
commit dba63c5a6189de8826bd35dccf60149debc60237 2 parents 4841a06 + 35562d3
Benjamin Eberlei authored March 12, 2013
14  tests/Doctrine/Tests/Mocks/DriverMock.php
@@ -26,20 +26,6 @@ public function connect(array $params, $username = null, $password = null, array
26 26
     }
27 27
 
28 28
     /**
29  
-     * Constructs the Sqlite PDO DSN.
30  
-     *
31  
-     * @param array $params
32  
-     *
33  
-     * @return string The DSN.
34  
-     *
35  
-     * @override
36  
-     */
37  
-    protected function _constructPdoDsn(array $params)
38  
-    {
39  
-        return "";
40  
-    }
41  
-
42  
-    /**
43 29
      * {@inheritdoc}
44 30
      */
45 31
     public function getDatabasePlatform()
22  tests/Doctrine/Tests/Mocks/EntityManagerMock.php
@@ -39,11 +39,6 @@ class EntityManagerMock extends \Doctrine\ORM\EntityManager
39 39
     private $_proxyFactoryMock;
40 40
 
41 41
     /**
42  
-     * @var array
43  
-     */
44  
-    private $_idGenerators = array();
45  
-
46  
-    /**
47 42
      * {@inheritdoc}
48 43
      */
49 44
     public function getUnitOfWork()
@@ -103,21 +98,4 @@ public static function create($conn, \Doctrine\ORM\Configuration $config = null,
103 98
 
104 99
         return new EntityManagerMock($conn, $config, $eventManager);
105 100
     }
106  
-/*
107  
-    public function setIdGenerator($className, $generator)
108  
-    {
109  
-        $this->_idGenerators[$className] = $generator;
110  
-    }
111  
-*/
112  
-    /** @override */
113  
-/*    public function getIdGenerator($className)
114  
-    {
115  
-
116  
-        if (isset($this->_idGenerators[$className])) {
117  
-            return $this->_idGenerators[$className];
118  
-        }
119  
-
120  
-        return parent::getIdGenerator($className);
121  
-    }
122  
- */
123 101
 }
19  tests/Doctrine/Tests/Mocks/EntityPersisterMock.php
@@ -46,25 +46,6 @@ class EntityPersisterMock extends \Doctrine\ORM\Persisters\BasicEntityPersister
46 46
      * @param object $entity
47 47
      *
48 48
      * @return mixed
49  
-     *
50  
-     * @override
51  
-     */
52  
-    public function insert($entity)
53  
-    {
54  
-        $this->inserts[] = $entity;
55  
-        if ( ! is_null($this->mockIdGeneratorType) && $this->mockIdGeneratorType == \Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_IDENTITY
56  
-                || $this->class->isIdGeneratorIdentity()) {
57  
-            $id = $this->identityColumnValueCounter++;
58  
-            $this->postInsertIds[$id] = $entity;
59  
-            return $id;
60  
-        }
61  
-        return null;
62  
-    }
63  
-
64  
-    /**
65  
-     * @param object $entity
66  
-     *
67  
-     * @return mixed
68 49
      */
69 50
     public function addInsert($entity)
70 51
     {
17  tests/Doctrine/Tests/Mocks/HydratorMockStatement.php
@@ -69,21 +69,6 @@ public function closeCursor()
69 69
     }
70 70
 
71 71
     /**
72  
-     * @param array $resultSet
73  
-     *
74  
-     * @return void
75  
-     */
76  
-    public function setResultSet(array $resultSet)
77  
-    {
78  
-        reset($resultSet);
79  
-        $this->_resultSet = $resultSet;
80  
-    }
81  
-
82  
-    public function bindColumn($column, &$param, $type = null)
83  
-    {
84  
-    }
85  
-
86  
-    /**
87 72
      * {@inheritdoc}
88 73
      */
89 74
     public function bindValue($param, $value, $type = null)
@@ -93,7 +78,7 @@ public function bindValue($param, $value, $type = null)
93 78
     /**
94 79
      * {@inheritdoc}
95 80
      */
96  
-    public function bindParam($column, &$variable, $type = null, $length = null, $driverOptions = array())
  81
+    public function bindParam($column, &$variable, $type = null)
97 82
     {
98 83
     }
99 84
 
16  tests/Doctrine/Tests/Mocks/IdentityIdGeneratorMock.php
... ...
@@ -1,16 +0,0 @@
1  
-<?php
2  
-
3  
-namespace Doctrine\Tests\Mocks;
4  
-
5  
-/**
6  
- * Mock class for IdentityGenerator.
7  
- */
8  
-class IdentityIdGeneratorMock extends \Doctrine\ORM\Id\IdentityGenerator
9  
-{
10  
-    private $_mockPostInsertId;
11  
-
12  
-    public function setMockPostInsertId($id)
13  
-    {
14  
-        $this->_mockPostInsertId = $id;
15  
-    }
16  
-}
32  tests/Doctrine/Tests/Mocks/SequenceMock.php
@@ -22,30 +22,6 @@ public function generate(EntityManager $em, $entity)
22 22
         return $this->_sequenceNumber++;
23 23
     }
24 24
 
25  
-    /**
26  
-     * @override
27  
-     */
28  
-    public function nextId($seqName, $ondemand = true)
29  
-    {
30  
-        return $this->_sequenceNumber++;
31  
-    }
32  
-
33  
-    /**
34  
-     * @override
35  
-     */
36  
-    public function lastInsertId($table = null, $field = null)
37  
-    {
38  
-        return $this->_sequenceNumber - 1;
39  
-    }
40  
-
41  
-    /**
42  
-     * @override
43  
-     */
44  
-    public function currId($seqName)
45  
-    {
46  
-        return $this->_sequenceNumber;
47  
-    }
48  
-
49 25
     /* Mock API */
50 26
 
51 27
     /**
@@ -55,12 +31,4 @@ public function reset()
55 31
     {
56 32
         $this->_sequenceNumber = 0;
57 33
     }
58  
-
59  
-    /**
60  
-     * @return void
61  
-     */
62  
-    public function autoinc()
63  
-    {
64  
-        $this->_sequenceNumber++;
65  
-    }
66 34
 }
22  tests/Doctrine/Tests/Mocks/UnitOfWorkMock.php
@@ -53,28 +53,6 @@ public function setEntityPersister($entityName, $persister)
53 53
     }
54 54
 
55 55
     /**
56  
-     * @param object $entity
57  
-     * @param array  $mockChangeSet
58  
-     *
59  
-     * @return void
60  
-     */
61  
-    public function setDataChangeSet($entity, array $mockChangeSet)
62  
-    {
63  
-        $this->_mockDataChangeSets[spl_object_hash($entity)] = $mockChangeSet;
64  
-    }
65  
-
66  
-    /**
67  
-     * @param object $entity
68  
-     * @param mixed  $state
69  
-     *
70  
-     * @return void
71  
-     */
72  
-    public function setEntityState($entity, $state)
73  
-    {
74  
-        $this->_entityStates[spl_object_hash($entity)] = $state;
75  
-    }
76  
-
77  
-    /**
78 56
      * {@inheritdoc}
79 57
      */
80 58
     public function setOriginalEntityData($entity, array $originalData)
7  tests/Doctrine/Tests/ORM/UnitOfWorkTest.php
@@ -7,7 +7,6 @@
7 7
 use Doctrine\Tests\Mocks\EntityManagerMock;
8 8
 use Doctrine\Tests\Mocks\UnitOfWorkMock;
9 9
 use Doctrine\Tests\Mocks\EntityPersisterMock;
10  
-use Doctrine\Tests\Mocks\IdentityIdGeneratorMock;
11 10
 use Doctrine\Tests\Models\Forum\ForumUser;
12 11
 use Doctrine\Tests\Models\Forum\ForumAvatar;
13 12
 
@@ -54,8 +53,6 @@ public function testSavingSingleEntityWithIdentityColumnForcesInsert()
54 53
         // Setup fake persister and id generator for identity generation
55 54
         $userPersister = new EntityPersisterMock($this->_emMock, $this->_emMock->getClassMetadata("Doctrine\Tests\Models\Forum\ForumUser"));
56 55
         $this->_unitOfWork->setEntityPersister('Doctrine\Tests\Models\Forum\ForumUser', $userPersister);
57  
-        //$idGeneratorMock = new IdentityIdGeneratorMock($this->_emMock);
58  
-        //$this->_emMock->setIdGenerator('Doctrine\Tests\Models\Forum\ForumUser', $idGeneratorMock);
59 56
         $userPersister->setMockIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_IDENTITY);
60 57
 
61 58
         // Test
@@ -96,14 +93,10 @@ public function testCascadedIdentityColumnInsert()
96 93
         //ForumUser
97 94
         $userPersister = new EntityPersisterMock($this->_emMock, $this->_emMock->getClassMetadata("Doctrine\Tests\Models\Forum\ForumUser"));
98 95
         $this->_unitOfWork->setEntityPersister('Doctrine\Tests\Models\Forum\ForumUser', $userPersister);
99  
-        //$userIdGeneratorMock = new IdentityIdGeneratorMock($this->_emMock);
100  
-        //$this->_emMock->setIdGenerator('Doctrine\Tests\Models\Forum\ForumUser', $userIdGeneratorMock);
101 96
         $userPersister->setMockIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_IDENTITY);
102 97
         // ForumAvatar
103 98
         $avatarPersister = new EntityPersisterMock($this->_emMock, $this->_emMock->getClassMetadata("Doctrine\Tests\Models\Forum\ForumAvatar"));
104 99
         $this->_unitOfWork->setEntityPersister('Doctrine\Tests\Models\Forum\ForumAvatar', $avatarPersister);
105  
-        //$avatarIdGeneratorMock = new IdentityIdGeneratorMock($this->_emMock);
106  
-        //$this->_emMock->setIdGenerator('Doctrine\Tests\Models\Forum\ForumAvatar', $avatarIdGeneratorMock);
107 100
         $avatarPersister->setMockIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_IDENTITY);
108 101
 
109 102
         // Test

0 notes on commit dba63c5

Please sign in to comment.
Something went wrong with that request. Please try again.