@@ 1142-1161 (lines=20) @@ | ||
1139 | /** |
|
1140 | * @group DDC-3343 |
|
1141 | */ |
|
1142 | public function testRemoveOrphanedManagedElementFromOneToManyExtraLazyCollection() |
|
1143 | { |
|
1144 | list($userId, $userListId) = $this->loadUserListFixture(); |
|
1145 | ||
1146 | /* @var $user User */ |
|
1147 | $user = $this->_em->find(User::class, $userId); |
|
1148 | ||
1149 | $user->userLists->removeElement($this->_em->find(UserList::class, $userListId)); |
|
1150 | ||
1151 | $this->_em->clear(); |
|
1152 | ||
1153 | /* @var $user User */ |
|
1154 | $user = $this->_em->find(User::class, $userId); |
|
1155 | ||
1156 | $this->assertCount(0, $user->userLists, 'Element was removed from association due to orphan removal'); |
|
1157 | $this->assertNull( |
|
1158 | $this->_em->find(UserList::class, $userListId), |
|
1159 | 'Element was deleted due to orphan removal' |
|
1160 | ); |
|
1161 | } |
|
1162 | ||
1163 | /** |
|
1164 | * @group DDC-3343 |
|
@@ 1195-1214 (lines=20) @@ | ||
1192 | /** |
|
1193 | * @group DDC-3343 |
|
1194 | */ |
|
1195 | public function testRemoveOrphanedManagedLazyProxyFromExtraLazyOneToMany() |
|
1196 | { |
|
1197 | list($userId, $userListId) = $this->loadUserListFixture(); |
|
1198 | ||
1199 | /* @var $user User */ |
|
1200 | $user = $this->_em->find(User::class, $userId); |
|
1201 | ||
1202 | $user->userLists->removeElement($this->_em->getReference(UserList::class, $userListId)); |
|
1203 | ||
1204 | $this->_em->clear(); |
|
1205 | ||
1206 | /* @var $user User */ |
|
1207 | $user = $this->_em->find(User::class, $userId); |
|
1208 | ||
1209 | $this->assertCount(0, $user->userLists, 'Element was removed from association due to orphan removal'); |
|
1210 | $this->assertNull( |
|
1211 | $this->_em->find(UserList::class, $userListId), |
|
1212 | 'Element was deleted due to orphan removal' |
|
1213 | ); |
|
1214 | } |
|
1215 | ||
1216 | /** |
|
1217 | * @return int[] ordered tuple: user id and tweet id |