Code Duplication    Length = 19-19 lines in 3 locations

eZ/Publish/API/Repository/Tests/SearchEngineIndexingTest.php 3 locations

@@ 215-233 (lines=19) @@
212
    /**
213
     * EZP-26186: Make sure affected child locations are deleted on content deletion (affected Solr).
214
     */
215
    public function testDeleteContent()
216
    {
217
        $repository = $this->getRepository();
218
        $contentService = $repository->getContentService();
219
        $searchService = $repository->getSearchService();
220
221
        $anonymousUsersContentId = $this->generateId('content', 42);
222
        $contentInfo = $contentService->loadContentInfo($anonymousUsersContentId);
223
224
        $contentService->deleteContent($contentInfo);
225
226
        $this->refreshSearch($repository);
227
228
        // Should not be found
229
        $criterion = new Criterion\ParentLocationId($contentInfo->mainLocationId);
230
        $query = new LocationQuery(array('filter' => $criterion));
231
        $result = $searchService->findLocations($query);
232
        $this->assertEquals(0, $result->totalCount);
233
    }
234
235
    /**
236
     * EZP-26186: Make sure index is deleted on removal of Users  (affected Solr).
@@ 238-256 (lines=19) @@
235
    /**
236
     * EZP-26186: Make sure index is deleted on removal of Users  (affected Solr).
237
     */
238
    public function testDeleteUser()
239
    {
240
        $repository = $this->getRepository();
241
        $userService = $repository->getUserService();
242
        $searchService = $repository->getSearchService();
243
244
        $anonymousContentId = $this->generateId('user', 10);
245
        $user = $userService->loadUser($anonymousContentId);
246
247
        $userService->deleteUser($user);
248
249
        $this->refreshSearch($repository);
250
251
        // Should not be found
252
        $criterion = new Criterion\ContentId($user->id);
253
        $query = new Query(array('filter' => $criterion));
254
        $result = $searchService->findContentInfo($query);
255
        $this->assertEquals(0, $result->totalCount);
256
    }
257
258
    /**
259
     * EZP-26186: Make sure index is deleted on removal of UserGroups  (affected Solr).
@@ 261-279 (lines=19) @@
258
    /**
259
     * EZP-26186: Make sure index is deleted on removal of UserGroups  (affected Solr).
260
     */
261
    public function testDeleteUserGroup()
262
    {
263
        $repository = $this->getRepository();
264
        $userService = $repository->getUserService();
265
        $searchService = $repository->getSearchService();
266
267
        $membersContentId = $this->generateId('user_group', 11);
268
        $userGroup = $userService->loadUserGroup($membersContentId);
269
270
        $userService->deleteUserGroup($userGroup);
271
272
        $this->refreshSearch($repository);
273
274
        // Should not be found
275
        $criterion = new Criterion\ContentId($userGroup->id);
276
        $query = new Query(array('filter' => $criterion));
277
        $result = $searchService->findContentInfo($query);
278
        $this->assertEquals(0, $result->totalCount);
279
    }
280
281
    /**
282
     * Test that a newly created user is available for search.