|
@@ 481-503 (lines=23) @@
|
| 478 |
|
* |
| 479 |
|
* @see \eZ\Publish\API\Repository\SectionService::countAssignedContents() |
| 480 |
|
*/ |
| 481 |
|
public function testCountAssignedContents() |
| 482 |
|
{ |
| 483 |
|
$repository = $this->getRepository(); |
| 484 |
|
|
| 485 |
|
$sectionService = $repository->getSectionService(); |
| 486 |
|
|
| 487 |
|
$standardSectionId = $this->generateId('section', 1); |
| 488 |
|
/* BEGIN: Use Case */ |
| 489 |
|
// $standardSectionId contains the ID of the "Standard" section in a eZ |
| 490 |
|
// Publish demo installation. |
| 491 |
|
|
| 492 |
|
$standardSection = $sectionService->loadSection($standardSectionId); |
| 493 |
|
|
| 494 |
|
$numberOfAssignedContent = $sectionService->countAssignedContents( |
| 495 |
|
$standardSection |
| 496 |
|
); |
| 497 |
|
/* END: Use Case */ |
| 498 |
|
|
| 499 |
|
$this->assertEquals( |
| 500 |
|
2, // Taken from the fixture |
| 501 |
|
$numberOfAssignedContent |
| 502 |
|
); |
| 503 |
|
} |
| 504 |
|
|
| 505 |
|
/** |
| 506 |
|
* Test for the isSectionUsed() method. |
|
@@ 510-532 (lines=23) @@
|
| 507 |
|
* |
| 508 |
|
* @see \eZ\Publish\API\Repository\SectionService::isSectionUsed() |
| 509 |
|
*/ |
| 510 |
|
public function testIsSectionUsed() |
| 511 |
|
{ |
| 512 |
|
$repository = $this->getRepository(); |
| 513 |
|
|
| 514 |
|
$sectionService = $repository->getSectionService(); |
| 515 |
|
|
| 516 |
|
$standardSectionId = $this->generateId('section', 1); |
| 517 |
|
/* BEGIN: Use Case */ |
| 518 |
|
// $standardSectionId contains the ID of the "Standard" section in a eZ |
| 519 |
|
// Publish demo installation. |
| 520 |
|
|
| 521 |
|
$standardSection = $sectionService->loadSection($standardSectionId); |
| 522 |
|
|
| 523 |
|
$isSectionUsed = $sectionService->isSectionUsed( |
| 524 |
|
$standardSection |
| 525 |
|
); |
| 526 |
|
/* END: Use Case */ |
| 527 |
|
|
| 528 |
|
$this->assertTrue( |
| 529 |
|
// Taken from the fixture |
| 530 |
|
$isSectionUsed |
| 531 |
|
); |
| 532 |
|
} |
| 533 |
|
|
| 534 |
|
/** |
| 535 |
|
* Test for the assignSection() method. |