eZ\Bundle\EzPublishCoreBundle\Tests\FieldType\Page\PageServiceTest::testGetValidBlockItemsAsContentInfo PHP Method

testGetValidBlockItemsAsContentInfo() public method

    public function testGetValidBlockItemsAsContentInfo()
    {
        $this->pageService->setStorageGateway($this->storageGateway);
        $block = $this->buildBlock();
        $items = array(new Item(array('contentId' => 1)), new Item(array('contentId' => 60)));
        $content1 = new ContentInfo(array('id' => 1));
        $content2 = new ContentInfo(array('id' => 60));
        $expectedResult = array($content1, $content2);
        $this->storageGateway->expects($this->once())->method('getValidBlockItems')->with($block)->will($this->returnValue($items));
        $this->contentService->expects($this->exactly(count($items)))->method('loadContentInfo')->with($this->logicalOr(1, 60))->will($this->onConsecutiveCalls($content1, $content2));
        $this->assertSame($expectedResult, $this->pageService->getValidBlockItemsAsContentInfo($block));
    }