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