Code Duplication    Length = 22-23 lines in 3 locations

tests/Doctrine/Tests/ORM/Cache/Persister/Collection/ReadWriteCachedCollectionPersisterTest.php 2 locations

@@ 93-115 (lines=23) @@
90
        $persister->update($collection);
91
    }
92
93
    public function testUpdateTransactionRollBackShouldEvictItem()
94
    {
95
        $entity     = new State("Foo");
96
        $lock       = Lock::createLockRead();
97
        $persister  = $this->createPersisterDefault();
98
        $collection = $this->createCollection($entity);
99
        $key        = new CollectionCacheKey(State::class, 'cities', ['id'=>1]);
100
101
        $this->region->expects($this->once())
102
            ->method('lock')
103
            ->with($this->equalTo($key))
104
            ->will($this->returnValue($lock));
105
106
        $this->region->expects($this->once())
107
            ->method('evict')
108
            ->with($this->equalTo($key))
109
            ->will($this->returnValue($lock));
110
111
        $this->em->getUnitOfWork()->registerManaged($entity, ['id'=>1], ['id'=>1, 'name'=>'Foo']);
112
113
        $persister->update($collection);
114
        $persister->afterTransactionRolledBack();
115
    }
116
117
    public function testDeleteTransactionRollBackShouldEvictItem()
118
    {
@@ 117-138 (lines=22) @@
114
        $persister->afterTransactionRolledBack();
115
    }
116
117
    public function testDeleteTransactionRollBackShouldEvictItem()
118
    {
119
        $entity     = new State("Foo");
120
        $lock       = Lock::createLockRead();
121
        $persister  = $this->createPersisterDefault();
122
        $collection = $this->createCollection($entity);
123
        $key        = new CollectionCacheKey(State::class, 'cities', ['id'=>1]);
124
125
        $this->region->expects($this->once())
126
            ->method('lock')
127
            ->with($this->equalTo($key))
128
            ->will($this->returnValue($lock));
129
130
        $this->region->expects($this->once())
131
            ->method('evict')
132
            ->with($this->equalTo($key));
133
134
        $this->em->getUnitOfWork()->registerManaged($entity, ['id'=>1], ['id'=>1, 'name'=>'Foo']);
135
136
        $persister->delete($collection);
137
        $persister->afterTransactionRolledBack();
138
    }
139
140
    public function testTransactionRollBackDeleteShouldClearQueue()
141
    {

tests/Doctrine/Tests/ORM/Cache/Persister/Entity/ReadWriteCachedEntityPersisterTest.php 1 location

@@ 86-107 (lines=22) @@
83
        $persister->update($entity);
84
    }
85
86
    public function testUpdateTransactionRollBackShouldEvictItem()
87
    {
88
        $entity    = new Country("Foo");
89
        $lock      = Lock::createLockRead();
90
        $persister = $this->createPersisterDefault();
91
        $key       = new EntityCacheKey(Country::class, ['id'=>1]);
92
93
        $this->region->expects($this->once())
94
            ->method('lock')
95
            ->with($this->equalTo($key))
96
            ->will($this->returnValue($lock));
97
98
        $this->region->expects($this->once())
99
            ->method('evict')
100
            ->with($this->equalTo($key))
101
            ->will($this->returnValue($lock));
102
103
        $this->em->getUnitOfWork()->registerManaged($entity, ['id'=>1], ['id'=>1, 'name'=>'Foo']);
104
105
        $persister->update($entity);
106
        $persister->afterTransactionRolledBack();
107
    }
108
109
    public function testDeleteTransactionRollBackShouldEvictItem()
110
    {