eZ\Publish\Core\Persistence\Legacy\Tests\Content\ContentHandlerTest::testUpdateContent PHP Метод

testUpdateContent() публичный Метод

public testUpdateContent ( )
    public function testUpdateContent()
    {
        $handler = $this->getPartlyMockedHandler(array('load', 'loadContentInfo'));
        $gatewayMock = $this->getGatewayMock();
        $fieldHandlerMock = $this->getFieldHandlerMock();
        $contentTypeHandlerMock = $this->getContentTypeHandlerMock();
        $contentTypeMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Type');
        $contentStub = new Content(array('versionInfo' => new VersionInfo(array('contentInfo' => new ContentInfo(array('contentTypeId' => 4242))))));
        $contentTypeHandlerMock->expects($this->once())->method('load')->with($contentStub->versionInfo->contentInfo->contentTypeId)->will($this->returnValue($contentTypeMock));
        $gatewayMock->expects($this->once())->method('updateContent')->with(14, $this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\MetadataUpdateStruct'));
        $gatewayMock->expects($this->once())->method('updateVersion')->with(14, 4, $this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\UpdateStruct'));
        $fieldHandlerMock->expects($this->once())->method('updateFields')->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content'), $this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\UpdateStruct'), $this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\Type'));
        $handler->expects($this->at(0))->method('load')->with(14, 4)->will($this->returnValue($contentStub));
        $handler->expects($this->at(1))->method('load')->with(14, 4);
        $handler->expects($this->at(2))->method('loadContentInfo')->with(14);
        $resultContent = $handler->updateContent(14, 4, new UpdateStruct(array('creatorId' => 14, 'modificationDate' => time(), 'initialLanguageId' => 2, 'fields' => array(new Field(array('id' => 23, 'fieldDefinitionId' => 42, 'type' => 'some-type', 'value' => new FieldValue())), new Field(array('id' => 23, 'fieldDefinitionId' => 43, 'type' => 'some-type', 'value' => new FieldValue()))))));
        $resultContentInfo = $handler->updateMetadata(14, new MetadataUpdateStruct(array('ownerId' => 14, 'name' => 'Some name', 'modificationDate' => time(), 'alwaysAvailable' => true)));
    }