eZ\Publish\Core\Repository\Tests\Service\Mock\ContentTest::testCreateContentThrowsInvalidArgumentExceptionDuplicateRemoteId PHP Метод

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

Test for the createContent() method.
    public function testCreateContentThrowsInvalidArgumentExceptionDuplicateRemoteId()
    {
        $repositoryMock = $this->getRepositoryMock();
        $mockedService = $this->getPartlyMockedContentService(array('loadContentByRemoteId'));
        $contentTypeServiceMock = $this->getContentTypeServiceMock();
        $contentType = new ContentType(array('id' => 123, 'fieldDefinitions' => array()));
        $contentCreateStruct = new ContentCreateStruct(array('ownerId' => 169, 'alwaysAvailable' => false, 'remoteId' => 'faraday', 'mainLanguageCode' => 'eng-US', 'contentType' => $contentType));
        $repositoryMock->expects($this->once())->method('getCurrentUserReference')->will($this->returnValue(new UserReference(169)));
        $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->returnValue('Hello...'));
        $mockedService->createContent(new ContentCreateStruct(array('remoteId' => 'faraday', 'mainLanguageCode' => 'eng-US', 'contentType' => $contentType)), array());
    }
ContentTest