Code Duplication    Length = 19-19 lines in 3 locations

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

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