Code Duplication    Length = 19-19 lines in 3 locations

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

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