|
@@ 2177-2197 (lines=21) @@
|
| 2174 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException |
| 2175 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft |
| 2176 |
|
*/ |
| 2177 |
|
public function testDeleteContent() |
| 2178 |
|
{ |
| 2179 |
|
$repository = $this->getRepository(); |
| 2180 |
|
|
| 2181 |
|
$contentService = $repository->getContentService(); |
| 2182 |
|
$locationService = $repository->getLocationService(); |
| 2183 |
|
|
| 2184 |
|
/* BEGIN: Use Case */ |
| 2185 |
|
$contentVersion2 = $this->createContentVersion2(); |
| 2186 |
|
|
| 2187 |
|
// Load the locations for this content object |
| 2188 |
|
$locations = $locationService->loadLocations($contentVersion2->contentInfo); |
| 2189 |
|
|
| 2190 |
|
// This will delete the content, all versions and the associated locations |
| 2191 |
|
$contentService->deleteContent($contentVersion2->contentInfo); |
| 2192 |
|
/* END: Use Case */ |
| 2193 |
|
|
| 2194 |
|
foreach ($locations as $location) { |
| 2195 |
|
$locationService->loadLocation($location->id); |
| 2196 |
|
} |
| 2197 |
|
} |
| 2198 |
|
|
| 2199 |
|
/** |
| 2200 |
|
* Test for the deleteContent() method. |
|
@@ 2209-2229 (lines=21) @@
|
| 2206 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException |
| 2207 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft |
| 2208 |
|
*/ |
| 2209 |
|
public function testDeleteContentWithEmptyBinaryField() |
| 2210 |
|
{ |
| 2211 |
|
$repository = $this->getRepository(); |
| 2212 |
|
|
| 2213 |
|
$contentService = $repository->getContentService(); |
| 2214 |
|
$locationService = $repository->getLocationService(); |
| 2215 |
|
|
| 2216 |
|
/* BEGIN: Use Case */ |
| 2217 |
|
$contentVersion = $this->createContentVersion1EmptyBinaryField(); |
| 2218 |
|
|
| 2219 |
|
// Load the locations for this content object |
| 2220 |
|
$locations = $locationService->loadLocations($contentVersion->contentInfo); |
| 2221 |
|
|
| 2222 |
|
// This will delete the content, all versions and the associated locations |
| 2223 |
|
$contentService->deleteContent($contentVersion->contentInfo); |
| 2224 |
|
/* END: Use Case */ |
| 2225 |
|
|
| 2226 |
|
foreach ($locations as $location) { |
| 2227 |
|
$locationService->loadLocation($location->id); |
| 2228 |
|
} |
| 2229 |
|
} |
| 2230 |
|
|
| 2231 |
|
/** |
| 2232 |
|
* Test for the loadContentDrafts() method. |