// of user information to the server, which needs a corresponding // authenticator. $repository = new Client\IntegrationTestRepository($authenticator = new Client\HttpClient\Authentication\IntegrationTestAuthenticator(new Client\HttpClient\Stream(HTTP_BASE_URL)), new Common\Input\Dispatcher($parsingDispatcher = new Common\Input\ParsingDispatcher(), array('json' => new Common\Input\Handler\Json(), 'xml' => new Common\Input\Handler\Xml())), new Common\Output\Visitor($generator, array('\\eZ\\Publish\\API\\Repository\\Values\\Content\\SectionCreateStruct' => new Client\Output\ValueObjectVisitor\SectionCreateStruct($requestParser), '\\eZ\\Publish\\API\\Repository\\Values\\Content\\SectionUpdateStruct' => new Client\Output\ValueObjectVisitor\SectionUpdateStruct($requestParser), '\\eZ\\Publish\\Core\\REST\\Common\\Values\\SectionIncludingContentMetadataUpdateStruct' => new Client\Output\ValueObjectVisitor\SectionIncludingContentMetadataUpdateStruct($requestParser), '\\eZ\\Publish\\API\\Repository\\Values\\User\\RoleCreateStruct' => new Client\Output\ValueObjectVisitor\RoleCreateStruct($requestParser), '\\eZ\\Publish\\API\\Repository\\Values\\User\\RoleUpdateStruct' => new Client\Output\ValueObjectVisitor\RoleUpdateStruct($requestParser), '\\eZ\\Publish\\API\\Repository\\Values\\User\\PolicyCreateStruct' => new Client\Output\ValueObjectVisitor\PolicyCreateStruct($requestParser), '\\eZ\\Publish\\API\\Repository\\Values\\User\\Limitation' => new Client\Output\ValueObjectVisitor\Limitation($requestParser), '\\eZ\\Publish\\API\\Repository\\Values\\User\\PolicyUpdateStruct' => new Client\Output\ValueObjectVisitor\PolicyUpdateStruct($requestParser), '\\eZ\\Publish\\API\\Repository\\Values\\Content\\LocationCreateStruct' => new Client\Output\ValueObjectVisitor\LocationCreateStruct($requestParser), '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroupCreateStruct' => new Client\Output\ValueObjectVisitor\ObjectStateGroupCreateStruct($requestParser), '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroupUpdateStruct' => new Client\Output\ValueObjectVisitor\ObjectStateGroupUpdateStruct($requestParser), '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateCreateStruct' => new Client\Output\ValueObjectVisitor\ObjectStateCreateStruct($requestParser), '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateUpdateStruct' => new Client\Output\ValueObjectVisitor\ObjectStateUpdateStruct($requestParser))), $requestParser, $fieldTypes, $authenticator); // Object with convenience methods for parsers $parserTools = new Common\Input\ParserTools(); // Parser for field values (using FieldTypes for toHash()/fromHash() operations) $fieldTypeParser = new Common\Input\FieldTypeParser($repository->getContentService(), $repository->getContentTypeService(), $repository->getFieldTypeService(), new Common\FieldTypeProcessorRegistry()); // The parsing dispatcher configures which parsers are used for which // mime type. The mime types (content types) are provided *WITHOUT* an // encoding type (+json / +xml). // // For each mime type you specify an instance of the parser which // should be used to process the given mime type. $inputParsers = array('application/vnd.ez.api.Version' => new Client\Input\Parser\Content($parserTools, $repository->getContentService(), new Client\Input\Parser\VersionInfo($parserTools, $repository->getContentService()), $fieldTypeParser), 'application/vnd.ez.api.ContentList' => new Client\Input\Parser\ContentList(), 'application/vnd.ez.api.ContentInfo' => new Client\Input\Parser\ContentInfo($parserTools, $repository->getContentTypeService()), 'application/vnd.ez.api.ContentType' => new Client\Input\Parser\ContentType($parserTools, $repository->getContentTypeService()), 'application/vnd.ez.api.FieldDefinitionList' => new Client\Input\Parser\FieldDefinitionList($parserTools, $repository->getContentTypeService()), 'application/vnd.ez.api.FieldDefinition' => new Client\Input\Parser\FieldDefinition($parserTools, $fieldTypeParser), 'application/vnd.ez.api.SectionList' => new Client\Input\Parser\SectionList(), 'application/vnd.ez.api.Section' => new Client\Input\Parser\Section(), 'application/vnd.ez.api.ErrorMessage' => new Client\Input\Parser\ErrorMessage(), 'application/vnd.ez.api.RoleList' => new Client\Input\Parser\RoleList(), 'application/vnd.ez.api.Role' => new Client\Input\Parser\Role(), 'application/vnd.ez.api.Policy' => new Client\Input\Parser\Policy(), 'application/vnd.ez.api.limitation' => new Client\Input\Parser\Limitation(), 'application/vnd.ez.api.PolicyList' => new Client\Input\Parser\PolicyList(), 'application/vnd.ez.api.RelationList' => new Client\Input\Parser\RelationList(), 'application/vnd.ez.api.Relation' => new Client\Input\Parser\Relation($repository->getContentService()), 'application/vnd.ez.api.RoleAssignmentList' => new Client\Input\Parser\RoleAssignmentList(), 'application/vnd.ez.api.RoleAssignment' => new Client\Input\Parser\RoleAssignment(), 'application/vnd.ez.api.Location' => new Client\Input\Parser\Location($parserTools), 'application/vnd.ez.api.LocationList' => new Client\Input\Parser\LocationList(), 'application/vnd.ez.api.ObjectStateGroup' => new Client\Input\Parser\ObjectStateGroup($parserTools), 'application/vnd.ez.api.ObjectStateGroupList' => new Client\Input\Parser\ObjectStateGroupList(), 'application/vnd.ez.api.ObjectState' => new Client\Input\Parser\ObjectState($parserTools), 'application/vnd.ez.api.ObjectStateList' => new Client\Input\Parser\ObjectStateList()); foreach ($inputParsers as $mimeType => $parser) { $parsingDispatcher->addParser($mimeType, $parser); } // Force sets the used user. This will be refactored most likely, since this is // not really valid for a REST client. /* Code commented while implementing EZP-21168, the stubs are removed. $repository->setCurrentUser( new \eZ\Publish\API\Repository\Tests\Stubs\Values\User\UserStub( array( 'content' => new \eZ\Publish\API\Repository\Tests\Stubs\Values\Content\ContentStub( array( 'id' => 14 ) ) )