Code Duplication    Length = 19-19 lines in 3 locations

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

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