eZ\Publish\Core\FieldType\Page\PageService::getWaitingBlockItems PHP Method

getWaitingBlockItems() public method

Returns queued items (the next to be displayed), for a given block.
public getWaitingBlockItems ( Block $block ) : Item[]
$block eZ\Publish\Core\FieldType\Page\Parts\Block
return eZ\Publish\Core\FieldType\Page\Parts\Item[]
    public function getWaitingBlockItems(Block $block)
    {
        if (isset($this->waitingBlockItems[$block])) {
            return $this->waitingBlockItems[$block];
        }
        return $this->waitingBlockItems[$block] = $this->getStorageGateway()->getWaitingBlockItems($block);
    }

Usage Example

 /**
  * @covers eZ\Publish\Core\FieldType\Page\PageService::hasStorageGateway
  * @covers eZ\Publish\Core\FieldType\Page\PageService::getStorageGateway
  * @covers eZ\Publish\Core\FieldType\Page\PageService::getWaitingBlockItems
  */
 public function testGetWaitingBlockItems()
 {
     $block = $this->buildBlock();
     $items = array(new Item(), new Item());
     $this->storageGateway->expects($this->once())->method('getWaitingBlockItems')->with($block)->will($this->returnValue($items));
     $this->pageService->setStorageGateway($this->storageGateway);
     // Calling assertion twice to test cache (comes along with storage gateway's getWaitingBlockItems() that should be called only once. See above)
     $this->assertSame($items, $this->pageService->getWaitingBlockItems($block));
     $this->assertSame($items, $this->pageService->getWaitingBlockItems($block));
 }