From c6b76e2db8ea0a0a744482de6d7c477ef4615bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= Date: Sun, 3 Nov 2019 20:47:15 +0100 Subject: [PATCH] EZP-31103: Introduced strict types for ContentTypeService --- .../API/Repository/ContentTypeService.php | 71 +++++++------- eZ/Publish/Core/Event/ContentTypeService.php | 8 +- .../Twig/Extension/ContentExtensionTest.php | 16 +++- .../Content/Type/Gateway/DoctrineDatabase.php | 6 +- .../Core/Repository/ContentTypeService.php | 90 ++++++++---------- .../SiteAccessAware/ContentTypeService.php | 80 ++++++++-------- .../Tests/ContentTypeServiceTest.php | 60 ++++++------ .../Decorator/ContentTypeServiceDecorator.php | 92 +++++++++---------- .../ContentTypeServiceDecoratorTest.php | 22 ++--- 9 files changed, 217 insertions(+), 228 deletions(-) diff --git a/eZ/Publish/API/Repository/ContentTypeService.php b/eZ/Publish/API/Repository/ContentTypeService.php index 7908bf58515..86c0bd4b1c5 100644 --- a/eZ/Publish/API/Repository/ContentTypeService.php +++ b/eZ/Publish/API/Repository/ContentTypeService.php @@ -1,11 +1,11 @@ eventDispatcher = $eventDispatcher; } - public function createContentTypeGroup(ContentTypeGroupCreateStruct $contentTypeGroupCreateStruct) + public function createContentTypeGroup(ContentTypeGroupCreateStruct $contentTypeGroupCreateStruct): ContentTypeGroup { $eventData = [$contentTypeGroupCreateStruct]; @@ -133,7 +133,7 @@ public function deleteContentTypeGroup(ContentTypeGroup $contentTypeGroup): void public function createContentType( ContentTypeCreateStruct $contentTypeCreateStruct, array $contentTypeGroups - ) { + ): ContentTypeDraft { $eventData = [ $contentTypeCreateStruct, $contentTypeGroups, @@ -157,7 +157,7 @@ public function createContentType( return $contentTypeDraft; } - public function createContentTypeDraft(ContentType $contentType) + public function createContentTypeDraft(ContentType $contentType): ContentTypeDraft { $eventData = [$contentType]; @@ -223,7 +223,7 @@ public function deleteContentType(ContentType $contentType): void public function copyContentType( ContentType $contentType, User $creator = null - ) { + ): ContentType { $eventData = [ $contentType, $creator, diff --git a/eZ/Publish/Core/MVC/Symfony/Templating/Tests/Twig/Extension/ContentExtensionTest.php b/eZ/Publish/Core/MVC/Symfony/Templating/Tests/Twig/Extension/ContentExtensionTest.php index 81b93d2fa7b..790be24407a 100644 --- a/eZ/Publish/Core/MVC/Symfony/Templating/Tests/Twig/Extension/ContentExtensionTest.php +++ b/eZ/Publish/Core/MVC/Symfony/Templating/Tests/Twig/Extension/ContentExtensionTest.php @@ -33,8 +33,12 @@ class ContentExtensionTest extends FileSystemTwigIntegrationTestCase /** @var \eZ\Publish\API\Repository\ContentTypeService|\PHPUnit\Framework\MockObject\MockObject */ private $fieldHelperMock; + /** @var \eZ\Publish\Core\Repository\Values\ContentType\FieldDefinition[] */ private $fieldDefinitions = []; + /** @var int[] */ + private $identityMap = []; + public function getExtensions() { $this->fieldHelperMock = $this->createMock(FieldHelper::class); @@ -68,14 +72,20 @@ public function getFixturesDir() * * @return Content */ - protected function getContent($contentTypeIdentifier, array $fieldsData, array $namesData = []) + protected function getContent(string $contentTypeIdentifier, array $fieldsData, array $namesData = []) { + if (!array_key_exists($contentTypeIdentifier, $this->identityMap)) { + $this->identityMap[$contentTypeIdentifier] = count($this->identityMap) + 1; + } + + $contentTypeId = $this->identityMap[$contentTypeIdentifier]; + $fields = []; foreach ($fieldsData as $fieldTypeIdentifier => $fieldsArray) { $fieldsArray = isset($fieldsArray['id']) ? [$fieldsArray] : $fieldsArray; foreach ($fieldsArray as $fieldInfo) { // Save field definitions in property for mocking purposes - $this->fieldDefinitions[$contentTypeIdentifier][$fieldInfo['fieldDefIdentifier']] = new FieldDefinition( + $this->fieldDefinitions[$contentTypeId][$fieldInfo['fieldDefIdentifier']] = new FieldDefinition( [ 'identifier' => $fieldInfo['fieldDefIdentifier'], 'id' => $fieldInfo['id'], @@ -101,7 +111,7 @@ protected function getContent($contentTypeIdentifier, array $fieldsData, array $ 'id' => 42, 'mainLanguageCode' => 'fre-FR', // Using as id as we don't really care to test the service here - 'contentTypeId' => $contentTypeIdentifier, + 'contentTypeId' => $contentTypeId, ] ), ] diff --git a/eZ/Publish/Core/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabase.php b/eZ/Publish/Core/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabase.php index 77ec382dd24..34e4be6cd8b 100644 --- a/eZ/Publish/Core/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabase.php +++ b/eZ/Publish/Core/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabase.php @@ -130,7 +130,7 @@ public function __construct(DatabaseHandler $db, Connection $connection, MaskGen * * @param \eZ\Publish\SPI\Persistence\Content\Type\Group $group * - * @return mixed Group ID + * @return int Group ID */ public function insertGroup(Group $group) { @@ -158,7 +158,7 @@ public function insertGroup(Group $group) ); $q->prepare()->execute(); - return $this->dbHandler->lastInsertId( + return (int)$this->dbHandler->lastInsertId( $this->dbHandler->getSequenceName('ezcontentclassgroup', 'id') ); } @@ -353,7 +353,7 @@ public function insertType(Type $type, $typeId = null) $q->prepare()->execute(); if (empty($typeId)) { - $typeId = $this->dbHandler->lastInsertId( + $typeId = (int)$this->dbHandler->lastInsertId( $this->dbHandler->getSequenceName('ezcontentclass', 'id') ); } diff --git a/eZ/Publish/Core/Repository/ContentTypeService.php b/eZ/Publish/Core/Repository/ContentTypeService.php index ea7dc02d858..0b168a9b835 100644 --- a/eZ/Publish/Core/Repository/ContentTypeService.php +++ b/eZ/Publish/Core/Repository/ContentTypeService.php @@ -1,11 +1,11 @@ permissionResolver->canUser('class', 'create', $contentTypeGroupCreateStruct)) { throw new UnauthorizedException('ContentType', 'create'); @@ -174,7 +174,7 @@ public function createContentTypeGroup(ContentTypeGroupCreateStruct $contentType /** * {@inheritdoc} */ - public function loadContentTypeGroup($contentTypeGroupId, array $prioritizedLanguages = []) + public function loadContentTypeGroup(int $contentTypeGroupId, array $prioritizedLanguages = []): APIContentTypeGroup { $spiGroup = $this->contentTypeHandler->loadGroup( $contentTypeGroupId @@ -186,7 +186,7 @@ public function loadContentTypeGroup($contentTypeGroupId, array $prioritizedLang /** * {@inheritdoc} */ - public function loadContentTypeGroupByIdentifier($contentTypeGroupIdentifier, array $prioritizedLanguages = []) + public function loadContentTypeGroupByIdentifier(string $contentTypeGroupIdentifier, array $prioritizedLanguages = []): APIContentTypeGroup { $groups = $this->loadContentTypeGroups($prioritizedLanguages); @@ -202,7 +202,7 @@ public function loadContentTypeGroupByIdentifier($contentTypeGroupIdentifier, ar /** * {@inheritdoc} */ - public function loadContentTypeGroups(array $prioritizedLanguages = []) + public function loadContentTypeGroups(array $prioritizedLanguages = []): iterable { $spiGroups = $this->contentTypeHandler->loadAllGroups(); @@ -223,7 +223,7 @@ public function loadContentTypeGroups(array $prioritizedLanguages = []) * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup the content type group to be updated * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupUpdateStruct $contentTypeGroupUpdateStruct */ - public function updateContentTypeGroup(APIContentTypeGroup $contentTypeGroup, ContentTypeGroupUpdateStruct $contentTypeGroupUpdateStruct) + public function updateContentTypeGroup(APIContentTypeGroup $contentTypeGroup, ContentTypeGroupUpdateStruct $contentTypeGroupUpdateStruct): void { if (!$this->permissionResolver->canUser('class', 'update', $contentTypeGroup)) { throw new UnauthorizedException('ContentType', 'update'); @@ -283,10 +283,8 @@ public function updateContentTypeGroup(APIContentTypeGroup $contentTypeGroup, Co * * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to delete a content type group * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If a to be deleted content type has instances - * - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup */ - public function deleteContentTypeGroup(APIContentTypeGroup $contentTypeGroup) + public function deleteContentTypeGroup(APIContentTypeGroup $contentTypeGroup): void { if (!$this->permissionResolver->canUser('class', 'delete', $contentTypeGroup)) { throw new UnauthorizedException('ContentType', 'delete'); @@ -322,7 +320,7 @@ public function deleteContentTypeGroup(APIContentTypeGroup $contentTypeGroup) * * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct $contentTypeCreateStruct */ - protected function validateInputContentTypeCreateStruct(APIContentTypeCreateStruct $contentTypeCreateStruct) + protected function validateInputContentTypeCreateStruct(APIContentTypeCreateStruct $contentTypeCreateStruct): void { // Required properties @@ -479,7 +477,7 @@ protected function validateInputContentTypeCreateStruct(APIContentTypeCreateStru * * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup[] $contentTypeGroups */ - protected function validateInputContentTypeGroups(array $contentTypeGroups) + protected function validateInputContentTypeGroups(array $contentTypeGroups): void { if (empty($contentTypeGroups)) { throw new InvalidArgumentException( @@ -511,8 +509,8 @@ protected function validateInputContentTypeGroups(array $contentTypeGroups) */ protected function validateInputFieldDefinitionCreateStruct( FieldDefinitionCreateStruct $fieldDefinitionCreateStruct, - $argumentName = '$fieldDefinitionCreateStruct' - ) { + string $argumentName = '$fieldDefinitionCreateStruct' + ): void { // Required properties if ($fieldDefinitionCreateStruct->fieldTypeIdentifier === null) { @@ -643,7 +641,7 @@ protected function validateInputFieldDefinitionCreateStruct( * * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft */ - public function createContentType(APIContentTypeCreateStruct $contentTypeCreateStruct, array $contentTypeGroups) + public function createContentType(APIContentTypeCreateStruct $contentTypeCreateStruct, array $contentTypeGroups): APIContentTypeDraft { if (!$this->permissionResolver->canUser('class', 'create', $contentTypeCreateStruct, $contentTypeGroups)) { throw new UnauthorizedException('ContentType', 'create'); @@ -831,7 +829,7 @@ function (APIContentTypeGroup $contentTypeGroup) { * * @return \eZ\Publish\SPI\FieldType\ValidationError[] */ - protected function validateFieldDefinitionCreateStruct(FieldDefinitionCreateStruct $fieldDefinitionCreateStruct, SPIFieldType $fieldType) + protected function validateFieldDefinitionCreateStruct(FieldDefinitionCreateStruct $fieldDefinitionCreateStruct, SPIFieldType $fieldType): array { $validationErrors = []; @@ -851,7 +849,7 @@ protected function validateFieldDefinitionCreateStruct(FieldDefinitionCreateStru /** * {@inheritdoc} */ - public function loadContentType($contentTypeId, array $prioritizedLanguages = []) + public function loadContentType(int $contentTypeId, array $prioritizedLanguages = []): ContentType { $spiContentType = $this->contentTypeHandler->load( $contentTypeId, @@ -867,12 +865,8 @@ public function loadContentType($contentTypeId, array $prioritizedLanguages = [] /** * {@inheritdoc} */ - public function loadContentTypeByIdentifier($identifier, array $prioritizedLanguages = []) + public function loadContentTypeByIdentifier(string $identifier, array $prioritizedLanguages = []): ContentType { - if (!is_string($identifier)) { - throw new InvalidArgumentValue('$identifier', $identifier); - } - $spiContentType = $this->contentTypeHandler->loadByIdentifier( $identifier ); @@ -886,7 +880,7 @@ public function loadContentTypeByIdentifier($identifier, array $prioritizedLangu /** * {@inheritdoc} */ - public function loadContentTypeByRemoteId($remoteId, array $prioritizedLanguages = []) + public function loadContentTypeByRemoteId(string $remoteId, array $prioritizedLanguages = []): ContentType { $spiContentType = $this->contentTypeHandler->loadByRemoteId($remoteId); @@ -908,7 +902,7 @@ public function loadContentTypeByRemoteId($remoteId, array $prioritizedLanguages * * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft */ - public function loadContentTypeDraft($contentTypeId, bool $ignoreOwnership = false) + public function loadContentTypeDraft(int $contentTypeId, bool $ignoreOwnership = false): APIContentTypeDraft { $spiContentType = $this->contentTypeHandler->load( $contentTypeId, @@ -944,7 +938,7 @@ public function loadContentTypeList(array $contentTypeIds, array $prioritizedLan /** * {@inheritdoc} */ - public function loadContentTypes(APIContentTypeGroup $contentTypeGroup, array $prioritizedLanguages = []) + public function loadContentTypes(APIContentTypeGroup $contentTypeGroup, array $prioritizedLanguages = []): iterable { $spiContentTypes = $this->contentTypeHandler->loadContentTypes( $contentTypeGroup->id, @@ -975,7 +969,7 @@ public function loadContentTypes(APIContentTypeGroup $contentTypeGroup, array $p * * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft */ - public function createContentTypeDraft(APIContentType $contentType) + public function createContentTypeDraft(APIContentType $contentType): APIContentTypeDraft { if (!$this->permissionResolver->canUser('class', 'create', $contentType)) { throw new UnauthorizedException('ContentType', 'create'); @@ -1020,7 +1014,7 @@ public function createContentTypeDraft(APIContentType $contentType) * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeUpdateStruct $contentTypeUpdateStruct */ - public function updateContentTypeDraft(APIContentTypeDraft $contentTypeDraft, ContentTypeUpdateStruct $contentTypeUpdateStruct) + public function updateContentTypeDraft(APIContentTypeDraft $contentTypeDraft, ContentTypeUpdateStruct $contentTypeUpdateStruct): void { if (!$this->permissionResolver->canUser('class', 'update', $contentTypeDraft)) { throw new UnauthorizedException('ContentType', 'update'); @@ -1098,7 +1092,7 @@ public function updateContentTypeDraft(APIContentTypeDraft $contentTypeDraft, Co * * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType */ - public function deleteContentType(APIContentType $contentType) + public function deleteContentType(APIContentType $contentType): void { if (!$this->permissionResolver->canUser('class', 'delete', $contentType)) { throw new UnauthorizedException('ContentType', 'delete'); @@ -1138,7 +1132,7 @@ public function deleteContentType(APIContentType $contentType) * * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType */ - public function copyContentType(APIContentType $contentType, User $creator = null) + public function copyContentType(APIContentType $contentType, User $creator = null): ContentType { if (!$this->permissionResolver->canUser('class', 'create', $contentType)) { throw new UnauthorizedException('ContentType', 'create'); @@ -1173,7 +1167,7 @@ public function copyContentType(APIContentType $contentType, User $creator = nul * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup */ - public function assignContentTypeGroup(APIContentType $contentType, APIContentTypeGroup $contentTypeGroup) + public function assignContentTypeGroup(APIContentType $contentType, APIContentTypeGroup $contentTypeGroup): void { if (!$this->permissionResolver->canUser('class', 'update', $contentType)) { throw new UnauthorizedException('ContentType', 'update'); @@ -1215,7 +1209,7 @@ public function assignContentTypeGroup(APIContentType $contentType, APIContentTy * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup */ - public function unassignContentTypeGroup(APIContentType $contentType, APIContentTypeGroup $contentTypeGroup) + public function unassignContentTypeGroup(APIContentType $contentType, APIContentTypeGroup $contentTypeGroup): void { if (!$this->permissionResolver->canUser('class', 'update', $contentType, [$contentTypeGroup])) { throw new UnauthorizedException('ContentType', 'update'); @@ -1271,7 +1265,7 @@ public function unassignContentTypeGroup(APIContentType $contentType, APIContent * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft * @param \eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct $fieldDefinitionCreateStruct */ - public function addFieldDefinition(APIContentTypeDraft $contentTypeDraft, FieldDefinitionCreateStruct $fieldDefinitionCreateStruct) + public function addFieldDefinition(APIContentTypeDraft $contentTypeDraft, FieldDefinitionCreateStruct $fieldDefinitionCreateStruct): void { if (!$this->permissionResolver->canUser('class', 'update', $contentTypeDraft)) { throw new UnauthorizedException('ContentType', 'update'); @@ -1356,7 +1350,7 @@ public function addFieldDefinition(APIContentTypeDraft $contentTypeDraft, FieldD * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft * @param \eZ\Publish\API\Repository\Values\ContentType\FieldDefinition $fieldDefinition */ - public function removeFieldDefinition(APIContentTypeDraft $contentTypeDraft, APIFieldDefinition $fieldDefinition) + public function removeFieldDefinition(APIContentTypeDraft $contentTypeDraft, APIFieldDefinition $fieldDefinition): void { if (!$this->permissionResolver->canUser('class', 'update', $contentTypeDraft)) { throw new UnauthorizedException('ContentType', 'update'); @@ -1400,7 +1394,7 @@ public function removeFieldDefinition(APIContentTypeDraft $contentTypeDraft, API * @param \eZ\Publish\API\Repository\Values\ContentType\FieldDefinition $fieldDefinition the field definition which should be updated * @param \eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct */ - public function updateFieldDefinition(APIContentTypeDraft $contentTypeDraft, APIFieldDefinition $fieldDefinition, FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct) + public function updateFieldDefinition(APIContentTypeDraft $contentTypeDraft, APIFieldDefinition $fieldDefinition, FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct): void { if (!$this->permissionResolver->canUser('class', 'update', $contentTypeDraft)) { throw new UnauthorizedException('ContentType', 'update'); @@ -1456,7 +1450,7 @@ public function updateFieldDefinition(APIContentTypeDraft $contentTypeDraft, API * * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft */ - public function publishContentTypeDraft(APIContentTypeDraft $contentTypeDraft) + public function publishContentTypeDraft(APIContentTypeDraft $contentTypeDraft): void { if (!$this->permissionResolver->canUser('class', 'update', $contentTypeDraft)) { throw new UnauthorizedException('ContentType', 'update'); @@ -1517,12 +1511,8 @@ public function publishContentTypeDraft(APIContentTypeDraft $contentTypeDraft) * * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupCreateStruct */ - public function newContentTypeGroupCreateStruct($identifier) + public function newContentTypeGroupCreateStruct(string $identifier): ContentTypeGroupCreateStruct { - if (!is_string($identifier)) { - throw new InvalidArgumentValue('$identifier', $identifier); - } - return new ContentTypeGroupCreateStruct( [ 'identifier' => $identifier, @@ -1539,7 +1529,7 @@ public function newContentTypeGroupCreateStruct($identifier) * * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct */ - public function newContentTypeCreateStruct($identifier) + public function newContentTypeCreateStruct(string $identifier): APIContentTypeCreateStruct { if (!is_string($identifier)) { throw new InvalidArgumentValue('$identifier', $identifier); @@ -1557,7 +1547,7 @@ public function newContentTypeCreateStruct($identifier) * * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeUpdateStruct */ - public function newContentTypeUpdateStruct() + public function newContentTypeUpdateStruct(): ContentTypeUpdateStruct { return new ContentTypeUpdateStruct(); } @@ -1567,7 +1557,7 @@ public function newContentTypeUpdateStruct() * * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupUpdateStruct */ - public function newContentTypeGroupUpdateStruct() + public function newContentTypeGroupUpdateStruct(): ContentTypeGroupUpdateStruct { return new ContentTypeGroupUpdateStruct(); } @@ -1583,16 +1573,8 @@ public function newContentTypeGroupUpdateStruct() * * @return \eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct */ - public function newFieldDefinitionCreateStruct($identifier, $fieldTypeIdentifier) + public function newFieldDefinitionCreateStruct(string $identifier, string $fieldTypeIdentifier): FieldDefinitionCreateStruct { - if (!is_string($identifier)) { - throw new InvalidArgumentValue('$identifier', $identifier); - } - - if (!is_string($fieldTypeIdentifier)) { - throw new InvalidArgumentValue('$fieldTypeIdentifier', $fieldTypeIdentifier); - } - return new FieldDefinitionCreateStruct( [ 'identifier' => $identifier, @@ -1606,7 +1588,7 @@ public function newFieldDefinitionCreateStruct($identifier, $fieldTypeIdentifier * * @return \eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionUpdateStruct */ - public function newFieldDefinitionUpdateStruct() + public function newFieldDefinitionUpdateStruct(): FieldDefinitionUpdateStruct { return new FieldDefinitionUpdateStruct(); } @@ -1620,7 +1602,7 @@ public function newFieldDefinitionUpdateStruct() * * @return bool */ - public function isContentTypeUsed(APIContentType $contentType) + public function isContentTypeUsed(APIContentType $contentType): bool { return $this->contentTypeHandler->getContentCount($contentType->id) > 0; } diff --git a/eZ/Publish/Core/Repository/SiteAccessAware/ContentTypeService.php b/eZ/Publish/Core/Repository/SiteAccessAware/ContentTypeService.php index 68d9a486ce8..1558650f72e 100644 --- a/eZ/Publish/Core/Repository/SiteAccessAware/ContentTypeService.php +++ b/eZ/Publish/Core/Repository/SiteAccessAware/ContentTypeService.php @@ -47,69 +47,69 @@ public function __construct( $this->languageResolver = $languageResolver; } - public function createContentTypeGroup(ContentTypeGroupCreateStruct $contentTypeGroupCreateStruct) + public function createContentTypeGroup(ContentTypeGroupCreateStruct $contentTypeGroupCreateStruct): ContentTypeGroup { return $this->service->createContentTypeGroup($contentTypeGroupCreateStruct); } - public function loadContentTypeGroup($contentTypeGroupId, array $prioritizedLanguages = null) + public function loadContentTypeGroup(int $contentTypeGroupId, array $prioritizedLanguages = null): ContentTypeGroup { $prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); return $this->service->loadContentTypeGroup($contentTypeGroupId, $prioritizedLanguages); } - public function loadContentTypeGroupByIdentifier($contentTypeGroupIdentifier, array $prioritizedLanguages = null) + public function loadContentTypeGroupByIdentifier(string $contentTypeGroupIdentifier, array $prioritizedLanguages = null): ContentTypeGroup { $prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); return $this->service->loadContentTypeGroupByIdentifier($contentTypeGroupIdentifier, $prioritizedLanguages); } - public function loadContentTypeGroups(array $prioritizedLanguages = null) + public function loadContentTypeGroups(array $prioritizedLanguages = null): iterable { $prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); return $this->service->loadContentTypeGroups($prioritizedLanguages); } - public function updateContentTypeGroup(ContentTypeGroup $contentTypeGroup, ContentTypeGroupUpdateStruct $contentTypeGroupUpdateStruct) + public function updateContentTypeGroup(ContentTypeGroup $contentTypeGroup, ContentTypeGroupUpdateStruct $contentTypeGroupUpdateStruct): void { - return $this->service->updateContentTypeGroup($contentTypeGroup, $contentTypeGroupUpdateStruct); + $this->service->updateContentTypeGroup($contentTypeGroup, $contentTypeGroupUpdateStruct); } - public function deleteContentTypeGroup(ContentTypeGroup $contentTypeGroup) + public function deleteContentTypeGroup(ContentTypeGroup $contentTypeGroup): void { - return $this->service->deleteContentTypeGroup($contentTypeGroup); + $this->service->deleteContentTypeGroup($contentTypeGroup); } - public function createContentType(ContentTypeCreateStruct $contentTypeCreateStruct, array $contentTypeGroups) + public function createContentType(ContentTypeCreateStruct $contentTypeCreateStruct, array $contentTypeGroups): ContentTypeDraft { return $this->service->createContentType($contentTypeCreateStruct, $contentTypeGroups); } - public function loadContentType($contentTypeId, array $prioritizedLanguages = null) + public function loadContentType(int $contentTypeId, array $prioritizedLanguages = null): ContentType { $prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); return $this->service->loadContentType($contentTypeId, $prioritizedLanguages); } - public function loadContentTypeByIdentifier($identifier, array $prioritizedLanguages = null) + public function loadContentTypeByIdentifier(string $identifier, array $prioritizedLanguages = null): ContentType { $prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); return $this->service->loadContentTypeByIdentifier($identifier, $prioritizedLanguages); } - public function loadContentTypeByRemoteId($remoteId, array $prioritizedLanguages = null) + public function loadContentTypeByRemoteId(string $remoteId, array $prioritizedLanguages = null): ContentType { $prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); return $this->service->loadContentTypeByRemoteId($remoteId, $prioritizedLanguages); } - public function loadContentTypeDraft($contentTypeId, bool $ignoreOwnership = false) + public function loadContentTypeDraft(int $contentTypeId, bool $ignoreOwnership = false): ContentTypeDraft { return $this->service->loadContentTypeDraft($contentTypeId, $ignoreOwnership); } @@ -121,94 +121,94 @@ public function loadContentTypeList(array $contentTypeIds, array $prioritizedLan return $this->service->loadContentTypeList($contentTypeIds, $prioritizedLanguages); } - public function loadContentTypes(ContentTypeGroup $contentTypeGroup, array $prioritizedLanguages = null) + public function loadContentTypes(ContentTypeGroup $contentTypeGroup, array $prioritizedLanguages = null): iterable { $prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); return $this->service->loadContentTypes($contentTypeGroup, $prioritizedLanguages); } - public function createContentTypeDraft(ContentType $contentType) + public function createContentTypeDraft(ContentType $contentType): ContentTypeDraft { return $this->service->createContentTypeDraft($contentType); } - public function updateContentTypeDraft(ContentTypeDraft $contentTypeDraft, ContentTypeUpdateStruct $contentTypeUpdateStruct) + public function updateContentTypeDraft(ContentTypeDraft $contentTypeDraft, ContentTypeUpdateStruct $contentTypeUpdateStruct): void { - return $this->service->updateContentTypeDraft($contentTypeDraft, $contentTypeUpdateStruct); + $this->service->updateContentTypeDraft($contentTypeDraft, $contentTypeUpdateStruct); } - public function deleteContentType(ContentType $contentType) + public function deleteContentType(ContentType $contentType): void { - return $this->service->deleteContentType($contentType); + $this->service->deleteContentType($contentType); } - public function copyContentType(ContentType $contentType, User $user = null) + public function copyContentType(ContentType $contentType, User $creator = null): ContentType { - return $this->service->copyContentType($contentType, $user); + return $this->service->copyContentType($contentType, $creator); } - public function assignContentTypeGroup(ContentType $contentType, ContentTypeGroup $contentTypeGroup) + public function assignContentTypeGroup(ContentType $contentType, ContentTypeGroup $contentTypeGroup): void { - return $this->service->assignContentTypeGroup($contentType, $contentTypeGroup); + $this->service->assignContentTypeGroup($contentType, $contentTypeGroup); } - public function unassignContentTypeGroup(ContentType $contentType, ContentTypeGroup $contentTypeGroup) + public function unassignContentTypeGroup(ContentType $contentType, ContentTypeGroup $contentTypeGroup): void { - return $this->service->unassignContentTypeGroup($contentType, $contentTypeGroup); + $this->service->unassignContentTypeGroup($contentType, $contentTypeGroup); } - public function addFieldDefinition(ContentTypeDraft $contentTypeDraft, FieldDefinitionCreateStruct $fieldDefinitionCreateStruct) + public function addFieldDefinition(ContentTypeDraft $contentTypeDraft, FieldDefinitionCreateStruct $fieldDefinitionCreateStruct): void { - return $this->service->addFieldDefinition($contentTypeDraft, $fieldDefinitionCreateStruct); + $this->service->addFieldDefinition($contentTypeDraft, $fieldDefinitionCreateStruct); } - public function removeFieldDefinition(ContentTypeDraft $contentTypeDraft, FieldDefinition $fieldDefinition) + public function removeFieldDefinition(ContentTypeDraft $contentTypeDraft, FieldDefinition $fieldDefinition): void { - return $this->service->removeFieldDefinition($contentTypeDraft, $fieldDefinition); + $this->service->removeFieldDefinition($contentTypeDraft, $fieldDefinition); } - public function updateFieldDefinition(ContentTypeDraft $contentTypeDraft, FieldDefinition $fieldDefinition, FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct) + public function updateFieldDefinition(ContentTypeDraft $contentTypeDraft, FieldDefinition $fieldDefinition, FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct): void { - return $this->service->updateFieldDefinition($contentTypeDraft, $fieldDefinition, $fieldDefinitionUpdateStruct); + $this->service->updateFieldDefinition($contentTypeDraft, $fieldDefinition, $fieldDefinitionUpdateStruct); } - public function publishContentTypeDraft(ContentTypeDraft $contentTypeDraft) + public function publishContentTypeDraft(ContentTypeDraft $contentTypeDraft): void { - return $this->service->publishContentTypeDraft($contentTypeDraft); + $this->service->publishContentTypeDraft($contentTypeDraft); } - public function newContentTypeGroupCreateStruct($identifier) + public function newContentTypeGroupCreateStruct(string $identifier): ContentTypeGroupCreateStruct { return $this->service->newContentTypeGroupCreateStruct($identifier); } - public function newContentTypeCreateStruct($identifier) + public function newContentTypeCreateStruct(string $identifier): ContentTypeCreateStruct { return $this->service->newContentTypeCreateStruct($identifier); } - public function newContentTypeUpdateStruct() + public function newContentTypeUpdateStruct(): ContentTypeUpdateStruct { return $this->service->newContentTypeUpdateStruct(); } - public function newContentTypeGroupUpdateStruct() + public function newContentTypeGroupUpdateStruct(): ContentTypeGroupUpdateStruct { return $this->service->newContentTypeGroupUpdateStruct(); } - public function newFieldDefinitionCreateStruct($identifier, $fieldTypeIdentifier) + public function newFieldDefinitionCreateStruct(string $identifier, string $fieldTypeIdentifier): FieldDefinitionCreateStruct { return $this->service->newFieldDefinitionCreateStruct($identifier, $fieldTypeIdentifier); } - public function newFieldDefinitionUpdateStruct() + public function newFieldDefinitionUpdateStruct(): FieldDefinitionUpdateStruct { return $this->service->newFieldDefinitionUpdateStruct(); } - public function isContentTypeUsed(ContentType $contentType) + public function isContentTypeUsed(ContentType $contentType): bool { return $this->service->isContentTypeUsed($contentType); } diff --git a/eZ/Publish/Core/Repository/SiteAccessAware/Tests/ContentTypeServiceTest.php b/eZ/Publish/Core/Repository/SiteAccessAware/Tests/ContentTypeServiceTest.php index be5c085ab94..1682f423a17 100644 --- a/eZ/Publish/Core/Repository/SiteAccessAware/Tests/ContentTypeServiceTest.php +++ b/eZ/Publish/Core/Repository/SiteAccessAware/Tests/ContentTypeServiceTest.php @@ -47,50 +47,50 @@ public function providerForPassTroughMethods() // string $method, array $arguments, bool $return = true return [ - ['createContentTypeGroup', [$contentTypeGroupCreateStruct]], + ['createContentTypeGroup', [$contentTypeGroupCreateStruct], $contentTypeGroup], - ['updateContentTypeGroup', [$contentTypeGroup, $contentTypeGroupUpdateStruct]], + ['updateContentTypeGroup', [$contentTypeGroup, $contentTypeGroupUpdateStruct], null], - ['deleteContentTypeGroup', [$contentTypeGroup]], + ['deleteContentTypeGroup', [$contentTypeGroup], null], - ['createContentType', [$contentTypeCreateStruct, [$contentTypeGroup]]], + ['createContentType', [$contentTypeCreateStruct, [$contentTypeGroup]], $contentTypeDraft], - ['loadContentTypeDraft', [22]], + ['loadContentTypeDraft', [22], $contentTypeDraft], - ['createContentTypeDraft', [$contentType]], + ['createContentTypeDraft', [$contentType], $contentTypeDraft], - ['updateContentTypeDraft', [$contentTypeDraft, $contentTypeUpdateStruct]], + ['updateContentTypeDraft', [$contentTypeDraft, $contentTypeUpdateStruct], null], - ['deleteContentType', [$contentType]], + ['deleteContentType', [$contentType], null], - ['copyContentType', [$contentType]], - ['copyContentType', [$contentType, $user]], + ['copyContentType', [$contentType], $contentType], + ['copyContentType', [$contentType, $user], $contentType], - ['assignContentTypeGroup', [$contentType, $contentTypeGroup]], + ['assignContentTypeGroup', [$contentType, $contentTypeGroup], null], - ['unassignContentTypeGroup', [$contentType, $contentTypeGroup]], + ['unassignContentTypeGroup', [$contentType, $contentTypeGroup], null], - ['addFieldDefinition', [$contentTypeDraft, $fieldDefinitionCreateStruct]], + ['addFieldDefinition', [$contentTypeDraft, $fieldDefinitionCreateStruct], null], - ['removeFieldDefinition', [$contentTypeDraft, $fieldDefinition]], + ['removeFieldDefinition', [$contentTypeDraft, $fieldDefinition], null], - ['updateFieldDefinition', [$contentTypeDraft, $fieldDefinition, $fieldDefinitionUpdateStruct]], + ['updateFieldDefinition', [$contentTypeDraft, $fieldDefinition, $fieldDefinitionUpdateStruct], null], - ['publishContentTypeDraft', [$contentTypeDraft]], + ['publishContentTypeDraft', [$contentTypeDraft], null], - ['newContentTypeGroupCreateStruct', ['media']], + ['newContentTypeGroupCreateStruct', ['media'], $contentTypeGroupCreateStruct], - ['newContentTypeCreateStruct', ['blog']], + ['newContentTypeCreateStruct', ['blog'], $contentTypeCreateStruct], - ['newContentTypeUpdateStruct', []], + ['newContentTypeUpdateStruct', [], $contentTypeUpdateStruct], - ['newContentTypeGroupUpdateStruct', []], + ['newContentTypeGroupUpdateStruct', [], $contentTypeGroupUpdateStruct], - ['newFieldDefinitionCreateStruct', ['body', 'ezstring']], + ['newFieldDefinitionCreateStruct', ['body', 'ezstring'], $fieldDefinitionCreateStruct], - ['newFieldDefinitionUpdateStruct', []], + ['newFieldDefinitionUpdateStruct', [], $fieldDefinitionUpdateStruct], - ['isContentTypeUsed', [$contentType]], + ['isContentTypeUsed', [$contentType], true], ['removeContentTypeTranslation', [$contentTypeDraft, 'ger-DE'], $contentTypeDraft], @@ -105,21 +105,21 @@ public function providerForLanguagesLookupMethods() // string $method, array $arguments, bool $return, int $languageArgumentIndex return [ - ['loadContentTypeGroup', [33, self::LANG_ARG], true, 1], + ['loadContentTypeGroup', [33, self::LANG_ARG], $contentTypeGroup, 1], - ['loadContentTypeGroupByIdentifier', ['content', self::LANG_ARG], true, 1], + ['loadContentTypeGroupByIdentifier', ['content', self::LANG_ARG], $contentTypeGroup, 1], - ['loadContentTypeGroups', [self::LANG_ARG], true, 0], + ['loadContentTypeGroups', [self::LANG_ARG], [$contentTypeGroup], 0], - ['loadContentType', [22, self::LANG_ARG], true, 1], + ['loadContentType', [22, self::LANG_ARG], $contentType, 1], ['loadContentTypeList', [[22, self::LANG_ARG]], [$contentType], 1], - ['loadContentTypeByIdentifier', ['article', self::LANG_ARG], true, 1], + ['loadContentTypeByIdentifier', ['article', self::LANG_ARG], $contentType, 1], - ['loadContentTypeByRemoteId', ['w4ini3tn4f', self::LANG_ARG], true, 1], + ['loadContentTypeByRemoteId', ['w4ini3tn4f', self::LANG_ARG], $contentType, 1], - ['loadContentTypes', [$contentTypeGroup, self::LANG_ARG], true, 1], + ['loadContentTypes', [$contentTypeGroup, self::LANG_ARG], [$contentType], 1], ]; } } diff --git a/eZ/Publish/SPI/Repository/Decorator/ContentTypeServiceDecorator.php b/eZ/Publish/SPI/Repository/Decorator/ContentTypeServiceDecorator.php index 5f94c09a4d0..a4e68fb9370 100644 --- a/eZ/Publish/SPI/Repository/Decorator/ContentTypeServiceDecorator.php +++ b/eZ/Publish/SPI/Repository/Decorator/ContentTypeServiceDecorator.php @@ -31,26 +31,26 @@ public function __construct(ContentTypeService $innerService) $this->innerService = $innerService; } - public function createContentTypeGroup(ContentTypeGroupCreateStruct $contentTypeGroupCreateStruct) + public function createContentTypeGroup(ContentTypeGroupCreateStruct $contentTypeGroupCreateStruct): ContentTypeGroup { return $this->innerService->createContentTypeGroup($contentTypeGroupCreateStruct); } public function loadContentTypeGroup( - $contentTypeGroupId, + int $contentTypeGroupId, array $prioritizedLanguages = [] - ) { + ): ContentTypeGroup { return $this->innerService->loadContentTypeGroup($contentTypeGroupId, $prioritizedLanguages); } public function loadContentTypeGroupByIdentifier( - $contentTypeGroupIdentifier, + string $contentTypeGroupIdentifier, array $prioritizedLanguages = [] - ) { + ): ContentTypeGroup { return $this->innerService->loadContentTypeGroupByIdentifier($contentTypeGroupIdentifier, $prioritizedLanguages); } - public function loadContentTypeGroups(array $prioritizedLanguages = []) + public function loadContentTypeGroups(array $prioritizedLanguages = []): iterable { return $this->innerService->loadContentTypeGroups($prioritizedLanguages); } @@ -58,44 +58,44 @@ public function loadContentTypeGroups(array $prioritizedLanguages = []) public function updateContentTypeGroup( ContentTypeGroup $contentTypeGroup, ContentTypeGroupUpdateStruct $contentTypeGroupUpdateStruct - ) { - return $this->innerService->updateContentTypeGroup($contentTypeGroup, $contentTypeGroupUpdateStruct); + ): void { + $this->innerService->updateContentTypeGroup($contentTypeGroup, $contentTypeGroupUpdateStruct); } - public function deleteContentTypeGroup(ContentTypeGroup $contentTypeGroup) + public function deleteContentTypeGroup(ContentTypeGroup $contentTypeGroup): void { - return $this->innerService->deleteContentTypeGroup($contentTypeGroup); + $this->innerService->deleteContentTypeGroup($contentTypeGroup); } public function createContentType( ContentTypeCreateStruct $contentTypeCreateStruct, array $contentTypeGroups - ) { + ): ContentTypeDraft { return $this->innerService->createContentType($contentTypeCreateStruct, $contentTypeGroups); } public function loadContentType( - $contentTypeId, + int $contentTypeId, array $prioritizedLanguages = [] - ) { + ): ContentType { return $this->innerService->loadContentType($contentTypeId, $prioritizedLanguages); } public function loadContentTypeByIdentifier( - $identifier, + string $identifier, array $prioritizedLanguages = [] - ) { + ): ContentType { return $this->innerService->loadContentTypeByIdentifier($identifier, $prioritizedLanguages); } public function loadContentTypeByRemoteId( - $remoteId, + string $remoteId, array $prioritizedLanguages = [] - ) { + ): ContentType { return $this->innerService->loadContentTypeByRemoteId($remoteId, $prioritizedLanguages); } - public function loadContentTypeDraft($contentTypeId, bool $ignoreOwnership = false) + public function loadContentTypeDraft(int $contentTypeId, bool $ignoreOwnership = false): ContentTypeDraft { return $this->innerService->loadContentTypeDraft($contentTypeId, $ignoreOwnership); } @@ -110,11 +110,11 @@ public function loadContentTypeList( public function loadContentTypes( ContentTypeGroup $contentTypeGroup, array $prioritizedLanguages = [] - ) { + ): iterable { return $this->innerService->loadContentTypes($contentTypeGroup, $prioritizedLanguages); } - public function createContentTypeDraft(ContentType $contentType) + public function createContentTypeDraft(ContentType $contentType): ContentTypeDraft { return $this->innerService->createContentTypeDraft($contentType); } @@ -122,96 +122,96 @@ public function createContentTypeDraft(ContentType $contentType) public function updateContentTypeDraft( ContentTypeDraft $contentTypeDraft, ContentTypeUpdateStruct $contentTypeUpdateStruct - ) { - return $this->innerService->updateContentTypeDraft($contentTypeDraft, $contentTypeUpdateStruct); + ): void { + $this->innerService->updateContentTypeDraft($contentTypeDraft, $contentTypeUpdateStruct); } - public function deleteContentType(ContentType $contentType) + public function deleteContentType(ContentType $contentType): void { - return $this->innerService->deleteContentType($contentType); + $this->innerService->deleteContentType($contentType); } public function copyContentType( ContentType $contentType, User $creator = null - ) { + ): ContentType { return $this->innerService->copyContentType($contentType, $creator); } public function assignContentTypeGroup( ContentType $contentType, ContentTypeGroup $contentTypeGroup - ) { - return $this->innerService->assignContentTypeGroup($contentType, $contentTypeGroup); + ): void { + $this->innerService->assignContentTypeGroup($contentType, $contentTypeGroup); } public function unassignContentTypeGroup( ContentType $contentType, ContentTypeGroup $contentTypeGroup - ) { - return $this->innerService->unassignContentTypeGroup($contentType, $contentTypeGroup); + ): void { + $this->innerService->unassignContentTypeGroup($contentType, $contentTypeGroup); } public function addFieldDefinition( ContentTypeDraft $contentTypeDraft, FieldDefinitionCreateStruct $fieldDefinitionCreateStruct - ) { - return $this->innerService->addFieldDefinition($contentTypeDraft, $fieldDefinitionCreateStruct); + ): void { + $this->innerService->addFieldDefinition($contentTypeDraft, $fieldDefinitionCreateStruct); } public function removeFieldDefinition( ContentTypeDraft $contentTypeDraft, FieldDefinition $fieldDefinition - ) { - return $this->innerService->removeFieldDefinition($contentTypeDraft, $fieldDefinition); + ): void { + $this->innerService->removeFieldDefinition($contentTypeDraft, $fieldDefinition); } public function updateFieldDefinition( ContentTypeDraft $contentTypeDraft, FieldDefinition $fieldDefinition, FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct - ) { - return $this->innerService->updateFieldDefinition($contentTypeDraft, $fieldDefinition, $fieldDefinitionUpdateStruct); + ): void { + $this->innerService->updateFieldDefinition($contentTypeDraft, $fieldDefinition, $fieldDefinitionUpdateStruct); } - public function publishContentTypeDraft(ContentTypeDraft $contentTypeDraft) + public function publishContentTypeDraft(ContentTypeDraft $contentTypeDraft): void { - return $this->innerService->publishContentTypeDraft($contentTypeDraft); + $this->innerService->publishContentTypeDraft($contentTypeDraft); } - public function newContentTypeGroupCreateStruct($identifier) + public function newContentTypeGroupCreateStruct(string $identifier): ContentTypeGroupCreateStruct { return $this->innerService->newContentTypeGroupCreateStruct($identifier); } - public function newContentTypeCreateStruct($identifier) + public function newContentTypeCreateStruct(string $identifier): ContentTypeCreateStruct { return $this->innerService->newContentTypeCreateStruct($identifier); } - public function newContentTypeUpdateStruct() + public function newContentTypeUpdateStruct(): ContentTypeUpdateStruct { return $this->innerService->newContentTypeUpdateStruct(); } - public function newContentTypeGroupUpdateStruct() + public function newContentTypeGroupUpdateStruct(): ContentTypeGroupUpdateStruct { return $this->innerService->newContentTypeGroupUpdateStruct(); } public function newFieldDefinitionCreateStruct( - $identifier, - $fieldTypeIdentifier - ) { + string $identifier, + string $fieldTypeIdentifier + ): FieldDefinitionCreateStruct { return $this->innerService->newFieldDefinitionCreateStruct($identifier, $fieldTypeIdentifier); } - public function newFieldDefinitionUpdateStruct() + public function newFieldDefinitionUpdateStruct(): FieldDefinitionUpdateStruct { return $this->innerService->newFieldDefinitionUpdateStruct(); } - public function isContentTypeUsed(ContentType $contentType) + public function isContentTypeUsed(ContentType $contentType): bool { return $this->innerService->isContentTypeUsed($contentType); } diff --git a/eZ/Publish/SPI/Repository/Tests/Decorator/ContentTypeServiceDecoratorTest.php b/eZ/Publish/SPI/Repository/Tests/Decorator/ContentTypeServiceDecoratorTest.php index 3fd43e658fd..d9fcec1a199 100644 --- a/eZ/Publish/SPI/Repository/Tests/Decorator/ContentTypeServiceDecoratorTest.php +++ b/eZ/Publish/SPI/Repository/Tests/Decorator/ContentTypeServiceDecoratorTest.php @@ -55,8 +55,8 @@ public function testLoadContentTypeGroupDecorator() $decoratedService = $this->createDecorator($serviceMock); $parameters = [ - 'random_value_5ced05ce0ffda1.73499446', - ['random_value_5ced05ce0ffde5.37998562'], + 1, + ['prioritized_language_value'], ]; $serviceMock->expects($this->once())->method('loadContentTypeGroup')->with(...$parameters); @@ -70,8 +70,8 @@ public function testLoadContentTypeGroupByIdentifierDecorator() $decoratedService = $this->createDecorator($serviceMock); $parameters = [ - 'random_value_5ced05ce0ffe39.59526434', - ['random_value_5ced05ce0ffe45.95635954'], + 'content_group_type_identifier', + ['prioritized_language_value'], ]; $serviceMock->expects($this->once())->method('loadContentTypeGroupByIdentifier')->with(...$parameters); @@ -84,7 +84,7 @@ public function testLoadContentTypeGroupsDecorator() $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); - $parameters = [['random_value_5ced05ce0ffe73.64294893']]; + $parameters = [['prioritized_language_value']]; $serviceMock->expects($this->once())->method('loadContentTypeGroups')->with(...$parameters); @@ -125,7 +125,7 @@ public function testCreateContentTypeDecorator() $parameters = [ $this->createMock(ContentTypeCreateStruct::class), - ['random_value_5ced05ce102210.02830368'], + ['content_type_group_identifier'], ]; $serviceMock->expects($this->once())->method('createContentType')->with(...$parameters); @@ -139,8 +139,8 @@ public function testLoadContentTypeDecorator() $decoratedService = $this->createDecorator($serviceMock); $parameters = [ - 'random_value_5ced05ce102297.95671709', - ['random_value_5ced05ce1022b3.56541050'], + 1, + ['prioritized_language_value'], ]; $serviceMock->expects($this->once())->method('loadContentType')->with(...$parameters); @@ -154,8 +154,8 @@ public function testLoadContentTypeByIdentifierDecorator() $decoratedService = $this->createDecorator($serviceMock); $parameters = [ - 'random_value_5ced05ce1022f0.22217017', - ['random_value_5ced05ce102306.63870627'], + 'content_type_identifier', + ['prioritized_language_value'], ]; $serviceMock->expects($this->once())->method('loadContentTypeByIdentifier')->with(...$parameters); @@ -183,7 +183,7 @@ public function testLoadContentTypeDraftDecorator() $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); - $parameters = ['random_value_5ced05ce102353.24566517']; + $parameters = [1, true]; $serviceMock->expects($this->once())->method('loadContentTypeDraft')->with(...$parameters);