eZ\Publish\Core\Persistence\Legacy\Tests\Content\Location\TrashHandlerTest::testEmptyTrash PHP Method

testEmptyTrash() public method

public testEmptyTrash ( )
    public function testEmptyTrash()
    {
        $handler = $this->getTrashHandler();
        $expectedTrashed = array(array('node_id' => 69, 'path_string' => '/1/2/69/', 'contentobject_id' => 67), array('node_id' => 70, 'path_string' => '/1/2/70/', 'contentobject_id' => 68));
        // Index for locationGateway calls
        $i = 0;
        // Index for contentHandler calls
        $iContent = 0;
        // Index for locationMapper calls
        $iLocation = 0;
        $this->locationGateway->expects($this->at($i++))->method('listTrashed')->will($this->returnValue($expectedTrashed));
        foreach ($expectedTrashed as $trashedElement) {
            $this->locationMapper->expects($this->at($iLocation++))->method('createLocationFromRow')->will($this->returnValue(new Trashed(array('id' => $trashedElement['node_id'], 'contentId' => $trashedElement['contentobject_id'], 'pathString' => $trashedElement['path_string']))));
            $this->locationGateway->expects($this->at($i++))->method('removeElementFromTrash')->with($trashedElement['node_id']);
            $this->locationGateway->expects($this->at($i++))->method('countLocationsByContentId')->with($trashedElement['contentobject_id'])->will($this->returnValue(0));
            $this->contentHandler->expects($this->at($iContent++))->method('deleteContent')->with($trashedElement['contentobject_id']);
        }
        $handler->emptyTrash();
    }