|
@@ 107-124 (lines=18) @@
|
| 104 |
|
* |
| 105 |
|
* @covers \eZ\Publish\Core\Repository\SectionService::createSection |
| 106 |
|
*/ |
| 107 |
|
public function testCreateSection() |
| 108 |
|
{ |
| 109 |
|
$sectionService = $this->repository->getSectionService(); |
| 110 |
|
|
| 111 |
|
$sectionCreateStruct = $sectionService->newSectionCreateStruct(); |
| 112 |
|
$sectionCreateStruct->identifier = 'test'; |
| 113 |
|
$sectionCreateStruct->name = 'Test'; |
| 114 |
|
|
| 115 |
|
$createdSection = $sectionService->createSection($sectionCreateStruct); |
| 116 |
|
|
| 117 |
|
self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\Content\\Section', $createdSection); |
| 118 |
|
self::assertGreaterThan(0, $createdSection->id); |
| 119 |
|
|
| 120 |
|
$this->assertStructPropertiesCorrect( |
| 121 |
|
$sectionCreateStruct, |
| 122 |
|
$createdSection |
| 123 |
|
); |
| 124 |
|
} |
| 125 |
|
|
| 126 |
|
/** |
| 127 |
|
* Test service function for creating sections throwing InvalidArgumentException. |
|
@@ 323-340 (lines=18) @@
|
| 320 |
|
* |
| 321 |
|
* @covers \eZ\Publish\Core\Repository\SectionService::deleteSection |
| 322 |
|
*/ |
| 323 |
|
public function testDeleteSection() |
| 324 |
|
{ |
| 325 |
|
$sectionService = $this->repository->getSectionService(); |
| 326 |
|
|
| 327 |
|
$sectionCreateStruct = $sectionService->newSectionCreateStruct(); |
| 328 |
|
$sectionCreateStruct->identifier = 'test'; |
| 329 |
|
$sectionCreateStruct->name = 'Test'; |
| 330 |
|
|
| 331 |
|
$newSection = $sectionService->createSection($sectionCreateStruct); |
| 332 |
|
$sectionService->deleteSection($newSection); |
| 333 |
|
|
| 334 |
|
try { |
| 335 |
|
$sectionService->loadSection($newSection->id); |
| 336 |
|
self::fail('Section is still returned after being deleted'); |
| 337 |
|
} catch (NotFoundException $e) { |
| 338 |
|
// Do nothing |
| 339 |
|
} |
| 340 |
|
} |
| 341 |
|
|
| 342 |
|
/** |
| 343 |
|
* Test service function for deleting sections throwing NotFoundException. |