@@ 1151-1170 (lines=20) @@ | ||
1148 | /** |
|
1149 | * @group DDC-3343 |
|
1150 | */ |
|
1151 | public function testRemoveOrphanedManagedElementFromOneToManyExtraLazyCollection() |
|
1152 | { |
|
1153 | list($userId, $userListId) = $this->loadUserListFixture(); |
|
1154 | ||
1155 | /* @var $user User */ |
|
1156 | $user = $this->em->find(User::class, $userId); |
|
1157 | ||
1158 | $user->userLists->removeElement($this->em->find(UserList::class, $userListId)); |
|
1159 | ||
1160 | $this->em->clear(); |
|
1161 | ||
1162 | /* @var $user User */ |
|
1163 | $user = $this->em->find(User::class, $userId); |
|
1164 | ||
1165 | self::assertCount(0, $user->userLists, 'Element was removed from association due to orphan removal'); |
|
1166 | self::assertNull( |
|
1167 | $this->em->find(UserList::class, $userListId), |
|
1168 | 'Element was deleted due to orphan removal' |
|
1169 | ); |
|
1170 | } |
|
1171 | ||
1172 | /** |
|
1173 | * @group DDC-3343 |
|
@@ 1204-1223 (lines=20) @@ | ||
1201 | /** |
|
1202 | * @group DDC-3343 |
|
1203 | */ |
|
1204 | public function testRemoveOrphanedManagedLazyProxyFromExtraLazyOneToMany() |
|
1205 | { |
|
1206 | list($userId, $userListId) = $this->loadUserListFixture(); |
|
1207 | ||
1208 | /* @var $user User */ |
|
1209 | $user = $this->em->find(User::class, $userId); |
|
1210 | ||
1211 | $user->userLists->removeElement($this->em->getReference(UserList::class, $userListId)); |
|
1212 | ||
1213 | $this->em->clear(); |
|
1214 | ||
1215 | /* @var $user User */ |
|
1216 | $user = $this->em->find(User::class, $userId); |
|
1217 | ||
1218 | self::assertCount(0, $user->userLists, 'Element was removed from association due to orphan removal'); |
|
1219 | self::assertNull( |
|
1220 | $this->em->find(UserList::class, $userListId), |
|
1221 | 'Element was deleted due to orphan removal' |
|
1222 | ); |
|
1223 | } |
|
1224 | ||
1225 | /** |
|
1226 | * @return int[] ordered tuple: user id and tweet id |