Code Duplication    Length = 19-19 lines in 3 locations

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

@@ 60-78 (lines=19) @@
57
    /**
58
     * EZP-26186: Make sure affected child locations are deleted on content deletion (affected Solr & Elastic).
59
     */
60
    public function testDeleteContent()
61
    {
62
        $repository = $this->getRepository();
63
        $contentService = $repository->getContentService();
64
        $searchService = $repository->getSearchService();
65
66
        $anonymousUsersContentId = $this->generateId('content', 42);
67
        $contentInfo = $contentService->loadContentInfo($anonymousUsersContentId);
68
69
        $contentService->deleteContent($contentInfo);
70
71
        $this->refreshSearch($repository);
72
73
        // Should not be found
74
        $criterion = new Criterion\ParentLocationId($contentInfo->mainLocationId);
75
        $query = new LocationQuery(array('filter' => $criterion));
76
        $result = $searchService->findLocations($query);
77
        $this->assertEquals(0, $result->totalCount);
78
    }
79
80
    /**
81
     * EZP-26186: Make sure index is deleted on removal of Users  (affected Solr & Elastic).
@@ 83-101 (lines=19) @@
80
    /**
81
     * EZP-26186: Make sure index is deleted on removal of Users  (affected Solr & Elastic).
82
     */
83
    public function testDeleteUser()
84
    {
85
        $repository = $this->getRepository();
86
        $userService = $repository->getUserService();
87
        $searchService = $repository->getSearchService();
88
89
        $anonymousContentId = $this->generateId('user', 10);
90
        $user = $userService->loadUser($anonymousContentId);
91
92
        $userService->deleteUser($user);
93
94
        $this->refreshSearch($repository);
95
96
        // Should not be found
97
        $criterion = new Criterion\ContentId($user->id);
98
        $query = new Query(array('filter' => $criterion));
99
        $result = $searchService->findContentInfo($query);
100
        $this->assertEquals(0, $result->totalCount);
101
    }
102
103
    /**
104
     * EZP-26186: Make sure index is deleted on removal of UserGroups  (affected Solr & Elastic).
@@ 106-124 (lines=19) @@
103
    /**
104
     * EZP-26186: Make sure index is deleted on removal of UserGroups  (affected Solr & Elastic).
105
     */
106
    public function testDeleteUserGroup()
107
    {
108
        $repository = $this->getRepository();
109
        $userService = $repository->getUserService();
110
        $searchService = $repository->getSearchService();
111
112
        $membersContentId = $this->generateId('user_group', 11);
113
        $userGroup = $userService->loadUserGroup($membersContentId);
114
115
        $userService->deleteUserGroup($userGroup);
116
117
        $this->refreshSearch($repository);
118
119
        // Should not be found
120
        $criterion = new Criterion\ContentId($userGroup->id);
121
        $query = new Query(array('filter' => $criterion));
122
        $result = $searchService->findContentInfo($query);
123
        $this->assertEquals(0, $result->totalCount);
124
    }
125
126
   /*
127
    * Test that a newly created user is available for search.