protected assertForCreateContentContentValidationException ( $mainLanguageCode, $structFields, $fieldDefinitions = [] ) |
protected function assertForCreateContentContentValidationException($mainLanguageCode, $structFields, $fieldDefinitions = array())
{
$repositoryMock = $this->getRepositoryMock();
$mockedService = $this->getPartlyMockedContentService(array('loadContentByRemoteId'));
$contentTypeServiceMock = $this->getContentTypeServiceMock();
$contentType = new ContentType(array('id' => 123, 'fieldDefinitions' => $fieldDefinitions));
$contentCreateStruct = new ContentCreateStruct(array('ownerId' => 169, 'alwaysAvailable' => false, 'remoteId' => 'faraday', 'mainLanguageCode' => $mainLanguageCode, 'fields' => $structFields, 'contentType' => $contentType));
$contentTypeServiceMock->expects($this->once())->method('loadContentType')->with($this->equalTo(123))->will($this->returnValue($contentType));
$repositoryMock->expects($this->once())->method('getContentTypeService')->will($this->returnValue($contentTypeServiceMock));
$repositoryMock->expects($this->once())->method('canUser')->with($this->equalTo('content'), $this->equalTo('create'), $this->isInstanceOf($contentCreateStruct), $this->equalTo(array()))->will($this->returnValue(true));
$mockedService->expects($this->once())->method('loadContentByRemoteId')->with($contentCreateStruct->remoteId)->will($this->throwException(new NotFoundException('Content', 'faraday')));
$mockedService->createContent($contentCreateStruct, array());
}