eZ\Publish\Core\FieldType\Tests\Page\PageServiceTest::testGetLastValidBlockItem PHP Method

testGetLastValidBlockItem() public method

    public function testGetLastValidBlockItem()
    {
        $block = $this->buildBlock();
        $lastValidItem = new Item();
        $this->storageGateway->expects($this->once())->method('getLastValidBlockItem')->with($block)->will($this->returnValue($lastValidItem));
        $this->pageService->setStorageGateway($this->storageGateway);
        // Calling assertion twice to test cache (comes along with storage gateway's getLastValidBlockItem() that should be called only once. See above)
        $this->assertSame($lastValidItem, $this->pageService->getLastValidBlockItem($block));
        $this->assertSame($lastValidItem, $this->pageService->getLastValidBlockItem($block));
    }