From 949ee66f81dcd0293fa1414d9c3f4a8f123ae81d Mon Sep 17 00:00:00 2001 From: Nattfarinn Date: Tue, 2 Jul 2019 14:49:59 +0200 Subject: [PATCH 1/3] EZP-30646: Reimplemented SignalSlots using EventDispatcher MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Dropped SignalSlot layer * Dropped ezpublish.api.signal Event * Reimplemented functions provided by slots using Event Subscribers * Aligned Repository factories * Aligned misc usages * Aligned tests Co-Authored-By: Adam Wójs --- doc/specifications/api/README.md | 4 +- .../ApiLoader/RepositoryFactory.php | 2 +- .../SignalSlot/SignalDispatcherFactory.php | 50 -- .../Command/RegenerateUrlAliasesCommand.php | 2 +- .../Compiler/SignalSlotPass.php | 38 - .../EzPublishCoreExtension.php | 2 +- .../EzPublishCoreBundle.php | 2 - .../Resources/config/commands.yml | 2 +- .../Resources/config/papi.yml | 21 - .../Resources/config/services.yml | 2 +- .../Slot/SymfonyEventConverterSlot.php | 39 - .../Compiler/SignalSlotPassTest.php | 64 -- .../Compiler/URLHandlerPassTest.php | 2 - .../SymfonyEventConverterSlotTest.php | 35 - .../EzPublishLegacySearchEngineBundle.php | 2 - .../Repository/Tests/ContentServiceTest.php | 2 +- .../Repository/Tests/SearchServiceTest.php | 10 +- .../Repository/Tests/SetupFactory/Legacy.php | 1 - .../API/Repository/Tests/UserServiceTest.php | 16 +- .../Container/ApiLoader/RepositoryFactory.php | 2 +- .../SignalSlot/SignalDispatcherFactory.php | 82 -- .../Search/SearchEngineSignalSlotPass.php | 61 -- .../Compiler/Search/SignalSlotPass.php | 50 -- .../Compiler/Search/SignalSlotPassTest.php | 71 -- .../Core/MVC/Symfony/Event/SignalEvent.php | 35 - .../Symfony/Event/Tests/SignalEventTest.php | 27 - eZ/Publish/Core/MVC/Symfony/MVCEvents.php | 10 - .../Core/Search/Common/BackgroundIndexer.php | 2 +- .../AbstractSearchEventSubscriber.php} | 27 +- .../ContentEventSubscriber.php | 125 +++ .../LocationEventSubscriber.php | 120 +++ .../ObjectStateEventSubscriber.php} | 31 +- .../SectionEventSubscriber.php | 28 + .../EventSubscriber/TrashEventSubscriber.php | 42 + .../EventSubscriber/UserEventSubscriber.php | 147 ++++ eZ/Publish/Core/Search/Common/Slot.php | 39 - .../Core/Search/Common/Slot/AssignSection.php | 32 - .../Core/Search/Common/Slot/CopyContent.php | 44 - .../Core/Search/Common/Slot/CopySubtree.php | 31 - .../Search/Common/Slot/CreateLocation.php | 45 -- .../Core/Search/Common/Slot/CreateUser.php | 48 -- .../Search/Common/Slot/CreateUserGroup.php | 48 -- .../Core/Search/Common/Slot/DeleteContent.php | 38 - .../Search/Common/Slot/DeleteLocation.php | 35 - .../Search/Common/Slot/DeleteTranslation.php | 51 -- .../Core/Search/Common/Slot/DeleteUser.php | 38 - .../Search/Common/Slot/DeleteUserGroup.php | 38 - .../Core/Search/Common/Slot/DeleteVersion.php | 34 - .../Core/Search/Common/Slot/HideContent.php | 31 - .../Core/Search/Common/Slot/HideLocation.php | 32 - .../Core/Search/Common/Slot/MoveSubtree.php | 32 - .../Core/Search/Common/Slot/MoveUserGroup.php | 38 - .../Search/Common/Slot/PublishVersion.php | 39 - .../Core/Search/Common/Slot/Recover.php | 31 - .../Core/Search/Common/Slot/RevealContent.php | 31 - .../Core/Search/Common/Slot/SwapLocation.php | 46 -- eZ/Publish/Core/Search/Common/Slot/Trash.php | 41 - .../Search/Common/Slot/UnhideLocation.php | 32 - .../Common/Slot/UpdateContentMetadata.php | 36 - .../Search/Common/Slot/UpdateLocation.php | 45 -- .../Core/Search/Common/Slot/UpdateUser.php | 48 -- .../Core/SignalSlot/BookmarkService.php | 84 -- eZ/Publish/Core/SignalSlot/ContentService.php | 734 ----------------- .../Core/SignalSlot/FieldTypeService.php | 83 -- .../Core/SignalSlot/LanguageService.php | 246 ------ .../Core/SignalSlot/LocationService.php | 384 --------- .../Core/SignalSlot/NotificationService.php | 106 --- .../Core/SignalSlot/ObjectStateService.php | 359 --------- eZ/Publish/Core/SignalSlot/Repository.php | 549 ------------- eZ/Publish/Core/SignalSlot/RoleService.php | 761 ------------------ eZ/Publish/Core/SignalSlot/SearchService.php | 142 ---- eZ/Publish/Core/SignalSlot/Signal.php | 21 - .../BookmarkService/CreateBookmarkSignal.php | 21 - .../BookmarkService/DeleteBookmarkSignal.php | 21 - .../ContentService/AddRelationSignal.php | 38 - .../AddTranslationInfoSignal.php | 19 - .../ContentService/CopyContentSignal.php | 52 -- .../CreateContentDraftSignal.php | 45 -- .../ContentService/CreateContentSignal.php | 31 - .../ContentService/DeleteContentSignal.php | 33 - .../ContentService/DeleteRelationSignal.php | 38 - .../DeleteTranslationSignal.php | 31 - .../ContentService/DeleteVersionSignal.php | 31 - .../ContentService/HideContentSignal.php | 17 - .../ContentService/PublishVersionSignal.php | 46 -- .../RemoveTranslationSignal.php | 25 - .../ContentService/RevealContentSignal.php | 17 - .../ContentService/TranslateVersionSignal.php | 40 - .../UpdateContentMetadataSignal.php | 24 - .../ContentService/UpdateContentSignal.php | 31 - .../AddFieldDefinitionSignal.php | 24 - .../AssignContentTypeGroupSignal.php | 31 - .../CopyContentTypeSignal.php | 31 - .../CreateContentTypeDraftSignal.php | 24 - .../CreateContentTypeGroupSignal.php | 24 - .../CreateContentTypeSignal.php | 24 - .../DeleteContentTypeGroupSignal.php | 24 - .../DeleteContentTypeSignal.php | 24 - .../PublishContentTypeDraftSignal.php | 24 - ...emoveContentTypeDraftTranslationSignal.php | 31 - .../RemoveFieldDefinitionSignal.php | 31 - .../UnassignContentTypeGroupSignal.php | 31 - .../UpdateContentTypeDraftSignal.php | 24 - .../UpdateContentTypeGroupSignal.php | 24 - .../UpdateFieldDefinitionSignal.php | 31 - .../LanguageService/CreateLanguageSignal.php | 24 - .../LanguageService/DeleteLanguageSignal.php | 24 - .../LanguageService/DisableLanguageSignal.php | 24 - .../LanguageService/EnableLanguageSignal.php | 24 - .../UpdateLanguageNameSignal.php | 31 - .../LocationService/CopySubtreeSignal.php | 38 - .../LocationService/CreateLocationSignal.php | 40 - .../LocationService/DeleteLocationSignal.php | 38 - .../LocationService/HideLocationSignal.php | 47 -- .../LocationService/MoveSubtreeSignal.php | 40 - .../LocationService/SwapLocationSignal.php | 63 -- .../LocationService/UnhideLocationSignal.php | 47 -- .../LocationService/UpdateLocationSignal.php | 40 - .../NotificationCreateSignal.php | 23 - .../NotificationDeleteSignal.php | 17 - .../NotificationReadSignal.php | 17 - .../CreateObjectStateGroupSignal.php | 24 - .../CreateObjectStateSignal.php | 31 - .../DeleteObjectStateGroupSignal.php | 24 - .../DeleteObjectStateSignal.php | 24 - .../SetContentStateSignal.php | 38 - .../SetPriorityOfObjectStateSignal.php | 31 - .../UpdateObjectStateGroupSignal.php | 24 - .../UpdateObjectStateSignal.php | 24 - .../AddPolicyByRoleDraftSignal.php | 31 - .../Signal/RoleService/AddPolicySignal.php | 31 - .../AssignRoleToUserGroupSignal.php | 38 - .../RoleService/AssignRoleToUserSignal.php | 38 - .../RoleService/CreateRoleDraftSignal.php | 24 - .../Signal/RoleService/CreateRoleSignal.php | 24 - .../RoleService/DeleteRoleDraftSignal.php | 24 - .../Signal/RoleService/DeleteRoleSignal.php | 24 - .../RoleService/PublishRoleDraftSignal.php | 24 - .../RemovePolicyByRoleDraftSignal.php | 31 - .../Signal/RoleService/RemovePolicySignal.php | 31 - .../RemoveRoleAssignmentSignal.php | 24 - .../UnassignRoleFromUserGroupSignal.php | 31 - .../UnassignRoleFromUserSignal.php | 31 - .../Signal/RoleService/UpdatePolicySignal.php | 24 - .../RoleService/UpdateRoleDraftSignal.php | 24 - .../Signal/RoleService/UpdateRoleSignal.php | 24 - .../SectionService/AssignSectionSignal.php | 31 - .../AssignSectionToSubtreeSignal.php | 28 - .../SectionService/CreateSectionSignal.php | 24 - .../SectionService/DeleteSectionSignal.php | 24 - .../SectionService/UpdateSectionSignal.php | 24 - .../TrashService/DeleteTrashItemSignal.php | 29 - .../Signal/TrashService/EmptyTrashSignal.php | 20 - .../Signal/TrashService/RecoverSignal.php | 45 -- .../Signal/TrashService/TrashSignal.php | 45 -- .../CreateGlobalUrlAliasSignal.php | 24 - .../URLAliasService/CreateUrlAliasSignal.php | 24 - .../URLAliasService/RemoveAliasesSignal.php | 24 - .../Signal/URLService/UpdateUrlSignal.php | 31 - .../URLWildcardService/CreateSignal.php | 24 - .../URLWildcardService/RemoveSignal.php | 24 - .../URLWildcardService/TranslateSignal.php | 24 - .../UserPreferenceSetSignal.php | 20 - .../AssignUserToUserGroupSignal.php | 31 - .../UserService/CreateUserGroupSignal.php | 24 - .../Signal/UserService/CreateUserSignal.php | 24 - .../UserService/DeleteUserGroupSignal.php | 33 - .../Signal/UserService/DeleteUserSignal.php | 33 - .../UserService/MoveUserGroupSignal.php | 31 - .../UnAssignUserFromUserGroupSignal.php | 31 - .../UserService/UpdateUserGroupSignal.php | 24 - .../Signal/UserService/UpdateUserSignal.php | 24 - .../UserService/UpdateUserTokenSignal.php | 24 - .../Core/SignalSlot/SignalDispatcher.php | 31 - .../DefaultSignalDispatcher.php | 98 --- .../SignalDispatcherTransactionWrapper.php | 115 --- eZ/Publish/Core/SignalSlot/Slot.php | 22 - eZ/Publish/Core/SignalSlot/SlotFactory.php | 28 - .../SlotFactory/GeneralSlotFactory.php | 50 -- .../SlotFactory/NullSlotFactory.php | 27 - .../SignalSlot/Tests/BookmarkServiceTest.php | 72 -- .../SignalSlot/Tests/ContentServiceTest.php | 299 ------- .../SignalSlot/Tests/FieldTypeServiceTest.php | 66 -- .../SignalSlot/Tests/LanguageServiceTest.php | 144 ---- .../SignalSlot/Tests/LocationServiceTest.php | 229 ------ .../Tests/NotificationServiceTest.php | 106 --- .../Tests/ObjectStateServiceTest.php | 199 ----- .../Core/SignalSlot/Tests/RepositoryTest.php | 212 ----- .../Core/SignalSlot/Tests/RoleServiceTest.php | 325 -------- .../SignalSlot/Tests/SearchServiceTest.php | 96 --- .../SignalSlot/Tests/SectionServiceTest.php | 150 ---- .../Core/SignalSlot/Tests/ServiceTest.php | 199 ----- .../DefaultSignalDispatcherTest.php | 81 -- .../SlotFactory/GeneralSlotFactoryTest.php | 64 -- .../SignalSlot/Tests/TrashServiceTest.php | 153 ---- .../SignalSlot/Tests/URLAliasServiceTest.php | 147 ---- .../Core/SignalSlot/Tests/URLServiceTest.php | 96 --- .../Tests/URLWildcardServiceTest.php | 89 -- .../Tests/UserPreferenceServiceTest.php | 69 -- .../Core/SignalSlot/Tests/UserServiceTest.php | 315 -------- eZ/Publish/Core/SignalSlot/TrashService.php | 186 ----- .../Core/SignalSlot/URLAliasService.php | 269 ------- eZ/Publish/Core/SignalSlot/URLService.php | 99 --- .../Core/SignalSlot/URLWildcardService.php | 154 ---- .../Core/SignalSlot/UserPreferenceService.php | 72 -- eZ/Publish/Core/SignalSlot/UserService.php | 577 ------------- eZ/Publish/Core/settings/containerBuilder.php | 2 +- eZ/Publish/Core/settings/notification.yml | 2 +- eZ/Publish/Core/settings/repository.yml | 36 +- eZ/Publish/Core/settings/repository/event.yml | 94 +++ .../Core/settings/repository/signalslot.yml | 163 ---- .../settings/repository/siteaccessaware.yml | 24 +- .../Core/settings/search_engines/common.yml | 10 + .../Core/settings/search_engines/legacy.yml | 1 - .../settings/search_engines/legacy/slots.yml | 126 --- eZ/Publish/Core/settings/tests/common.yml | 3 + .../settings/tests/integration_legacy.yml | 9 + .../tests/integration_legacy_core.yml | 7 - eZ/Publish/Core/settings/user_preference.yml | 2 +- eZ/Publish/SPI/FieldType/EventListener.php | 33 - .../Tests/FieldType/BaseIntegrationTest.php | 2 +- .../FieldType/FileBaseIntegrationTest.php | 2 +- phpunit.xml | 4 +- 223 files changed, 670 insertions(+), 13258 deletions(-) delete mode 100644 eZ/Bundle/EzPublishCoreBundle/ApiLoader/SignalSlot/SignalDispatcherFactory.php delete mode 100644 eZ/Bundle/EzPublishCoreBundle/DependencyInjection/Compiler/SignalSlotPass.php delete mode 100644 eZ/Bundle/EzPublishCoreBundle/SignalSlot/Slot/SymfonyEventConverterSlot.php delete mode 100644 eZ/Bundle/EzPublishCoreBundle/Tests/DependencyInjection/Compiler/SignalSlotPassTest.php delete mode 100644 eZ/Bundle/EzPublishCoreBundle/Tests/SignalSlot/SymfonyEventConverterSlotTest.php delete mode 100644 eZ/Publish/Core/Base/Container/ApiLoader/SignalSlot/SignalDispatcherFactory.php delete mode 100644 eZ/Publish/Core/Base/Container/Compiler/Search/SearchEngineSignalSlotPass.php delete mode 100644 eZ/Publish/Core/Base/Container/Compiler/Search/SignalSlotPass.php delete mode 100644 eZ/Publish/Core/Base/Tests/Container/Compiler/Search/SignalSlotPassTest.php delete mode 100644 eZ/Publish/Core/MVC/Symfony/Event/SignalEvent.php delete mode 100644 eZ/Publish/Core/MVC/Symfony/Event/Tests/SignalEventTest.php rename eZ/Publish/Core/Search/Common/{Slot/AbstractSubtree.php => EventSubscriber/AbstractSearchEventSubscriber.php} (64%) create mode 100644 eZ/Publish/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php create mode 100644 eZ/Publish/Core/Search/Common/EventSubscriber/LocationEventSubscriber.php rename eZ/Publish/Core/Search/Common/{Slot/SetContentState.php => EventSubscriber/ObjectStateEventSubscriber.php} (53%) create mode 100644 eZ/Publish/Core/Search/Common/EventSubscriber/SectionEventSubscriber.php create mode 100644 eZ/Publish/Core/Search/Common/EventSubscriber/TrashEventSubscriber.php create mode 100644 eZ/Publish/Core/Search/Common/EventSubscriber/UserEventSubscriber.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/AssignSection.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/CopyContent.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/CopySubtree.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/CreateLocation.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/CreateUser.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/CreateUserGroup.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/DeleteContent.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/DeleteLocation.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/DeleteTranslation.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/DeleteUser.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/DeleteUserGroup.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/DeleteVersion.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/HideContent.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/HideLocation.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/MoveSubtree.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/MoveUserGroup.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/PublishVersion.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/Recover.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/RevealContent.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/SwapLocation.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/Trash.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/UnhideLocation.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/UpdateContentMetadata.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/UpdateLocation.php delete mode 100644 eZ/Publish/Core/Search/Common/Slot/UpdateUser.php delete mode 100644 eZ/Publish/Core/SignalSlot/BookmarkService.php delete mode 100644 eZ/Publish/Core/SignalSlot/ContentService.php delete mode 100644 eZ/Publish/Core/SignalSlot/FieldTypeService.php delete mode 100644 eZ/Publish/Core/SignalSlot/LanguageService.php delete mode 100644 eZ/Publish/Core/SignalSlot/LocationService.php delete mode 100644 eZ/Publish/Core/SignalSlot/NotificationService.php delete mode 100644 eZ/Publish/Core/SignalSlot/ObjectStateService.php delete mode 100644 eZ/Publish/Core/SignalSlot/Repository.php delete mode 100644 eZ/Publish/Core/SignalSlot/RoleService.php delete mode 100644 eZ/Publish/Core/SignalSlot/SearchService.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/BookmarkService/CreateBookmarkSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/BookmarkService/DeleteBookmarkSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/AddRelationSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/AddTranslationInfoSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/CopyContentSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/CreateContentDraftSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/CreateContentSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/DeleteContentSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/DeleteRelationSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/DeleteTranslationSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/DeleteVersionSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/HideContentSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/PublishVersionSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/RemoveTranslationSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/RevealContentSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/TranslateVersionSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/UpdateContentMetadataSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentService/UpdateContentSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentTypeService/AddFieldDefinitionSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentTypeService/AssignContentTypeGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentTypeService/CopyContentTypeSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentTypeService/CreateContentTypeDraftSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentTypeService/CreateContentTypeGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentTypeService/CreateContentTypeSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentTypeService/DeleteContentTypeGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentTypeService/DeleteContentTypeSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentTypeService/PublishContentTypeDraftSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentTypeService/RemoveContentTypeDraftTranslationSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentTypeService/RemoveFieldDefinitionSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentTypeService/UnassignContentTypeGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentTypeService/UpdateContentTypeDraftSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentTypeService/UpdateContentTypeGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ContentTypeService/UpdateFieldDefinitionSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/LanguageService/CreateLanguageSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/LanguageService/DeleteLanguageSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/LanguageService/DisableLanguageSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/LanguageService/EnableLanguageSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/LanguageService/UpdateLanguageNameSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/LocationService/CopySubtreeSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/LocationService/CreateLocationSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/LocationService/DeleteLocationSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/LocationService/HideLocationSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/LocationService/MoveSubtreeSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/LocationService/SwapLocationSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/LocationService/UnhideLocationSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/LocationService/UpdateLocationSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/NotificationService/NotificationCreateSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/NotificationService/NotificationDeleteSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/NotificationService/NotificationReadSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ObjectStateService/CreateObjectStateGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ObjectStateService/CreateObjectStateSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ObjectStateService/DeleteObjectStateGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ObjectStateService/DeleteObjectStateSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ObjectStateService/SetContentStateSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ObjectStateService/SetPriorityOfObjectStateSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ObjectStateService/UpdateObjectStateGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/ObjectStateService/UpdateObjectStateSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/AddPolicyByRoleDraftSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/AddPolicySignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/AssignRoleToUserGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/AssignRoleToUserSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/CreateRoleDraftSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/CreateRoleSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/DeleteRoleDraftSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/DeleteRoleSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/PublishRoleDraftSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/RemovePolicyByRoleDraftSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/RemovePolicySignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/RemoveRoleAssignmentSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/UnassignRoleFromUserGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/UnassignRoleFromUserSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/UpdatePolicySignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/UpdateRoleDraftSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/RoleService/UpdateRoleSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/SectionService/AssignSectionSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/SectionService/AssignSectionToSubtreeSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/SectionService/CreateSectionSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/SectionService/DeleteSectionSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/SectionService/UpdateSectionSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/TrashService/DeleteTrashItemSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/TrashService/EmptyTrashSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/TrashService/RecoverSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/TrashService/TrashSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/URLAliasService/CreateGlobalUrlAliasSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/URLAliasService/CreateUrlAliasSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/URLAliasService/RemoveAliasesSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/URLService/UpdateUrlSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/URLWildcardService/CreateSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/URLWildcardService/RemoveSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/URLWildcardService/TranslateSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/UserPreferenceService/UserPreferenceSetSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/UserService/AssignUserToUserGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/UserService/CreateUserGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/UserService/CreateUserSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/UserService/DeleteUserGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/UserService/DeleteUserSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/UserService/MoveUserGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/UserService/UnAssignUserFromUserGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/UserService/UpdateUserGroupSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/UserService/UpdateUserSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/Signal/UserService/UpdateUserTokenSignal.php delete mode 100644 eZ/Publish/Core/SignalSlot/SignalDispatcher.php delete mode 100644 eZ/Publish/Core/SignalSlot/SignalDispatcher/DefaultSignalDispatcher.php delete mode 100644 eZ/Publish/Core/SignalSlot/SignalDispatcher/SignalDispatcherTransactionWrapper.php delete mode 100644 eZ/Publish/Core/SignalSlot/Slot.php delete mode 100644 eZ/Publish/Core/SignalSlot/SlotFactory.php delete mode 100644 eZ/Publish/Core/SignalSlot/SlotFactory/GeneralSlotFactory.php delete mode 100644 eZ/Publish/Core/SignalSlot/SlotFactory/NullSlotFactory.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/BookmarkServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/ContentServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/FieldTypeServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/LanguageServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/LocationServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/NotificationServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/ObjectStateServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/RepositoryTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/RoleServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/SearchServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/SectionServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/ServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/SignalDispatcher/DefaultSignalDispatcherTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/SlotFactory/GeneralSlotFactoryTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/TrashServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/URLAliasServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/URLServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/URLWildcardServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/UserPreferenceServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/UserServiceTest.php delete mode 100644 eZ/Publish/Core/SignalSlot/TrashService.php delete mode 100644 eZ/Publish/Core/SignalSlot/URLAliasService.php delete mode 100644 eZ/Publish/Core/SignalSlot/URLService.php delete mode 100644 eZ/Publish/Core/SignalSlot/URLWildcardService.php delete mode 100644 eZ/Publish/Core/SignalSlot/UserPreferenceService.php delete mode 100644 eZ/Publish/Core/SignalSlot/UserService.php create mode 100644 eZ/Publish/Core/settings/repository/event.yml delete mode 100644 eZ/Publish/Core/settings/repository/signalslot.yml delete mode 100644 eZ/Publish/Core/settings/search_engines/legacy/slots.yml delete mode 100644 eZ/Publish/SPI/FieldType/EventListener.php diff --git a/doc/specifications/api/README.md b/doc/specifications/api/README.md index 488cecd5f05..5db56b0d202 100644 --- a/doc/specifications/api/README.md +++ b/doc/specifications/api/README.md @@ -12,6 +12,6 @@ covering all eZ Content Repository functionality, this is where you'll find its This folder is mainly covering concepts and features of the implementation of the API, found in: - `eZ\Publish\Core\Repository`: Implementation of business logic of the Repository. -- `eZ\Publish\Core\SignalSlot`: "Signal Slot" implementation of Repository allowing to use slots (listener) for signals - (events) on every call to api that changes data in the repository. +- `eZ\Publish\Core\Event`: "Event" implementation of Repository allowing to use Symfony event listeners and subscribers + for events on every call to api that changes data in the repository. diff --git a/eZ/Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php b/eZ/Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php index 6867fd07029..d92047392de 100644 --- a/eZ/Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php +++ b/eZ/Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php @@ -64,7 +64,7 @@ public function __construct( * Builds the main repository, heart of eZ Publish API. * * This always returns the true inner Repository, please depend on ezpublish.api.repository and not this method - * directly to make sure you get an instance wrapped inside Signal / Cache / * functionality. + * directly to make sure you get an instance wrapped inside Event / Cache / * functionality. * * @param \eZ\Publish\SPI\Persistence\Handler $persistenceHandler * @param \eZ\Publish\SPI\Search\Handler $searchHandler diff --git a/eZ/Bundle/EzPublishCoreBundle/ApiLoader/SignalSlot/SignalDispatcherFactory.php b/eZ/Bundle/EzPublishCoreBundle/ApiLoader/SignalSlot/SignalDispatcherFactory.php deleted file mode 100644 index 5697ac2c589..00000000000 --- a/eZ/Bundle/EzPublishCoreBundle/ApiLoader/SignalSlot/SignalDispatcherFactory.php +++ /dev/null @@ -1,50 +0,0 @@ -repositoryAlias = $repositoryAlias; - $this->repositoriesSettings = $repositoriesSettings; - parent::__construct($signalDispatcherClass, null); - } - - /** - * {@inheritdoc} - */ - public function getSearchEngineAlias() - { - if ($this->repositoryAlias === null) { - $aliases = array_keys($this->repositoriesSettings); - $this->repositoryAlias = array_shift($aliases); - } - - return isset($this->repositoriesSettings[$this->repositoryAlias]['search']['engine']) ? $this->repositoriesSettings[$this->repositoryAlias]['search']['engine'] : ''; - } -} diff --git a/eZ/Bundle/EzPublishCoreBundle/Command/RegenerateUrlAliasesCommand.php b/eZ/Bundle/EzPublishCoreBundle/Command/RegenerateUrlAliasesCommand.php index 7abad856696..3e78f4314d4 100644 --- a/eZ/Bundle/EzPublishCoreBundle/Command/RegenerateUrlAliasesCommand.php +++ b/eZ/Bundle/EzPublishCoreBundle/Command/RegenerateUrlAliasesCommand.php @@ -83,7 +83,7 @@ protected function configure() Note: This script can potentially run for a very long time. -Due to performance issues the command does not send any Signals. +Due to performance issues the command does not send any Events. HTTP cache needs to be cleared manually after executing this command. diff --git a/eZ/Bundle/EzPublishCoreBundle/DependencyInjection/Compiler/SignalSlotPass.php b/eZ/Bundle/EzPublishCoreBundle/DependencyInjection/Compiler/SignalSlotPass.php deleted file mode 100644 index 1b118a04ad2..00000000000 --- a/eZ/Bundle/EzPublishCoreBundle/DependencyInjection/Compiler/SignalSlotPass.php +++ /dev/null @@ -1,38 +0,0 @@ -hasDefinition('ezpublish.signalslot.signal_dispatcher')) { - return; - } - - $signalDispatcherDef = $container->getDefinition('ezpublish.signalslot.signal_dispatcher'); - foreach ($container->findTaggedServiceIds('ezpublish.api.slot') as $id => $attributes) { - foreach ($attributes as $attribute) { - if (!isset($attribute['signal'])) { - throw new LogicException("Could not find 'signal' attribute on '$id' service, which is mandatory for services tagged as 'ezpublish.api.slot'"); - } - - $signalDispatcherDef->addMethodCall('attach', [$attribute['signal'], new Reference($id)]); - } - } - } -} diff --git a/eZ/Bundle/EzPublishCoreBundle/DependencyInjection/EzPublishCoreExtension.php b/eZ/Bundle/EzPublishCoreBundle/DependencyInjection/EzPublishCoreExtension.php index 715157ceeaa..5e8965577c3 100644 --- a/eZ/Bundle/EzPublishCoreBundle/DependencyInjection/EzPublishCoreExtension.php +++ b/eZ/Bundle/EzPublishCoreBundle/DependencyInjection/EzPublishCoreExtension.php @@ -294,7 +294,7 @@ private function handleApiLoading(ContainerBuilder $container, FileLoader $loade ); $coreLoader->load('repository.yml'); $coreLoader->load('repository/inner.yml'); - $coreLoader->load('repository/signalslot.yml'); + $coreLoader->load('repository/event.yml'); $coreLoader->load('repository/siteaccessaware.yml'); $coreLoader->load('fieldtype_external_storages.yml'); $coreLoader->load('fieldtypes.yml'); diff --git a/eZ/Bundle/EzPublishCoreBundle/EzPublishCoreBundle.php b/eZ/Bundle/EzPublishCoreBundle/EzPublishCoreBundle.php index 0ab1b2b9864..a5ecf4ff8d3 100644 --- a/eZ/Bundle/EzPublishCoreBundle/EzPublishCoreBundle.php +++ b/eZ/Bundle/EzPublishCoreBundle/EzPublishCoreBundle.php @@ -28,7 +28,6 @@ use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\LocationViewPass; use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\RouterPass; use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\SecurityPass; -use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\SignalSlotPass; use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\SlugConverterConfigurationPass; use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\TranslationCollectorPass; use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ViewProvidersPass; @@ -68,7 +67,6 @@ public function build(ContainerBuilder $container) $container->addCompilerPass(new LocalePass()); $container->addCompilerPass(new ContentViewPass()); $container->addCompilerPass(new LocationViewPass()); - $container->addCompilerPass(new SignalSlotPass()); $container->addCompilerPass(new RouterPass()); $container->addCompilerPass(new SecurityPass()); $container->addCompilerPass(new FragmentPass()); diff --git a/eZ/Bundle/EzPublishCoreBundle/Resources/config/commands.yml b/eZ/Bundle/EzPublishCoreBundle/Resources/config/commands.yml index 4c97723df5a..cf45bf216be 100644 --- a/eZ/Bundle/EzPublishCoreBundle/Resources/config/commands.yml +++ b/eZ/Bundle/EzPublishCoreBundle/Resources/config/commands.yml @@ -2,7 +2,7 @@ services: ezpublish.console.command.regenerate_url_aliases: class: eZ\Bundle\EzPublishCoreBundle\Command\RegenerateUrlAliasesCommand arguments: - # intentionally passing inner repository to avoid sending Signals due to performance issues + # intentionally passing inner repository to avoid sending Events due to performance issues - '@ezpublish.api.inner_repository' - '@?logger' tags: diff --git a/eZ/Bundle/EzPublishCoreBundle/Resources/config/papi.yml b/eZ/Bundle/EzPublishCoreBundle/Resources/config/papi.yml index 450a84b3645..15a7c962fa5 100644 --- a/eZ/Bundle/EzPublishCoreBundle/Resources/config/papi.yml +++ b/eZ/Bundle/EzPublishCoreBundle/Resources/config/papi.yml @@ -7,9 +7,6 @@ parameters: ezpublish.api.search_engine.factory.class: eZ\Bundle\EzPublishCoreBundle\ApiLoader\SearchEngineFactory ezpublish.api.search_engine.indexer.factory.class: eZ\Bundle\EzPublishCoreBundle\ApiLoader\SearchEngineIndexerFactory - # Symfony event converter Slot - ezpublish.signalslot.event_converter_slot.class: eZ\Bundle\EzPublishCoreBundle\SignalSlot\Slot\SymfonyEventConverterSlot - # Using legacy storage engine for data compatibility with 4.x ezpublish.api.storage_engine.default: legacy ezpublish.api.search_engine.default: legacy @@ -18,9 +15,6 @@ parameters: ezpublish.api.location.class: eZ\Publish\Core\Repository\Values\Content\Location ezpublish.api.version.class: eZ\Publish\Core\Repository\Values\Content\VersionInfo - # SignalDispatcher factory - ezpublish.signalslot.signal_dispatcher.factory.class: eZ\Bundle\EzPublishCoreBundle\ApiLoader\SignalSlot\SignalDispatcherFactory - services: # API ezpublish.api.repository.factory: @@ -73,21 +67,6 @@ services: factory: ["@ezpublish.api.search_engine.indexer.factory", buildSearchEngineIndexer] public: false - # Signal Slot API wrapper - ezpublish.signalslot.event_converter_slot: - class: "%ezpublish.signalslot.event_converter_slot.class%" - arguments: ["@event_dispatcher"] - tags: - - { name: ezpublish.api.slot, signal: '*' } - - # SignalDispatcher Factory - ezpublish.signalslot.signal_dispatcher.factory: - class: "%ezpublish.signalslot.signal_dispatcher.factory.class%" - arguments: - - "%ezpublish.signalslot.signal_dispatcher.class%" - - "$repository$" - - "%ezpublish.repositories%" - # Redefine background indexer to the one provided here which works on kernel/console.terminate. ezpublish.search.background_indexer: class: eZ\Bundle\EzPublishCoreBundle\EventListener\BackgroundIndexingTerminateListener diff --git a/eZ/Bundle/EzPublishCoreBundle/Resources/config/services.yml b/eZ/Bundle/EzPublishCoreBundle/Resources/config/services.yml index 2423c84be32..03d84a3cdbb 100644 --- a/eZ/Bundle/EzPublishCoreBundle/Resources/config/services.yml +++ b/eZ/Bundle/EzPublishCoreBundle/Resources/config/services.yml @@ -258,7 +258,7 @@ services: ezplatform.core.command.cleanup_versions: class: eZ\Bundle\EzPublishCoreBundle\Command\CleanupVersionsCommand arguments: - - "@ezpublish.signalslot.repository" + - '@eZ\Publish\Core\Event\Repository' - "@ezpublish.config.resolver" - "@ezpublish.persistence.connection" tags: diff --git a/eZ/Bundle/EzPublishCoreBundle/SignalSlot/Slot/SymfonyEventConverterSlot.php b/eZ/Bundle/EzPublishCoreBundle/SignalSlot/Slot/SymfonyEventConverterSlot.php deleted file mode 100644 index f05108fbc27..00000000000 --- a/eZ/Bundle/EzPublishCoreBundle/SignalSlot/Slot/SymfonyEventConverterSlot.php +++ /dev/null @@ -1,39 +0,0 @@ -eventDispatcher = $eventDispatcher; - } - - /** - * Receive the given $signal and react on it. - * - * @param Signal $signal - */ - public function receive(Signal $signal) - { - $this->eventDispatcher->dispatch(MVCEvents::API_SIGNAL, new SignalEvent($signal)); - } -} diff --git a/eZ/Bundle/EzPublishCoreBundle/Tests/DependencyInjection/Compiler/SignalSlotPassTest.php b/eZ/Bundle/EzPublishCoreBundle/Tests/DependencyInjection/Compiler/SignalSlotPassTest.php deleted file mode 100644 index 96e4d527231..00000000000 --- a/eZ/Bundle/EzPublishCoreBundle/Tests/DependencyInjection/Compiler/SignalSlotPassTest.php +++ /dev/null @@ -1,64 +0,0 @@ -addTag('ezpublish.api.slot', ['signal' => $signalIdentifier]); - - $containerBuilder = new ContainerBuilder(); - $slotId = 'acme.foo_slot'; - $containerBuilder->addDefinitions( - [ - $slotId => $slotDef, - 'ezpublish.signalslot.signal_dispatcher' => $dispatcherDef, - ] - ); - - $pass = new SignalSlotPass(); - $pass->process($containerBuilder); - $this->assertTrue($dispatcherDef->hasMethodCall('attach')); - $calls = $dispatcherDef->getMethodCalls(); - list($method, $arguments) = $calls[0]; - $this->assertSame('attach', $method); - list($signal, $serviceId) = $arguments; - $this->assertSame($signalIdentifier, $signal); - $this->assertEquals($slotId, new Reference($serviceId)); - } - - public function testProcessNoSignal() - { - $this->expectException(\LogicException::class); - - $slotDef = new Definition(); - $slotDef->addTag('ezpublish.api.slot', []); - - $containerBuilder = new ContainerBuilder(); - $containerBuilder->addDefinitions( - [ - 'acme.foo_slot' => $slotDef, - 'ezpublish.signalslot.signal_dispatcher' => new Definition(), - ] - ); - - $pass = new SignalSlotPass(); - $pass->process($containerBuilder); - } -} diff --git a/eZ/Bundle/EzPublishCoreBundle/Tests/DependencyInjection/Compiler/URLHandlerPassTest.php b/eZ/Bundle/EzPublishCoreBundle/Tests/DependencyInjection/Compiler/URLHandlerPassTest.php index 533c31d108e..5997eada15d 100644 --- a/eZ/Bundle/EzPublishCoreBundle/Tests/DependencyInjection/Compiler/URLHandlerPassTest.php +++ b/eZ/Bundle/EzPublishCoreBundle/Tests/DependencyInjection/Compiler/URLHandlerPassTest.php @@ -1,8 +1,6 @@ createMock(EventDispatcherInterface::class); - $eventDispatcher - ->expects($this->once()) - ->method('dispatch') - ->with(MVCEvents::API_SIGNAL, $this->isInstanceOf(SignalEvent::class)); - - $slot = new SymfonyEventConverterSlot($eventDispatcher); - $slot->receive($this->createMock(Signal::class)); - } -} diff --git a/eZ/Bundle/EzPublishLegacySearchEngineBundle/EzPublishLegacySearchEngineBundle.php b/eZ/Bundle/EzPublishLegacySearchEngineBundle/EzPublishLegacySearchEngineBundle.php index d6cce67d206..0a7ac046053 100644 --- a/eZ/Bundle/EzPublishLegacySearchEngineBundle/EzPublishLegacySearchEngineBundle.php +++ b/eZ/Bundle/EzPublishLegacySearchEngineBundle/EzPublishLegacySearchEngineBundle.php @@ -14,7 +14,6 @@ use eZ\Publish\Core\Base\Container\Compiler\Search\Legacy\CriterionFieldValueHandlerRegistryPass; use eZ\Publish\Core\Base\Container\Compiler\Search\Legacy\SortClauseConverterPass; use eZ\Publish\Core\Base\Container\Compiler\Search\FieldRegistryPass; -use eZ\Publish\Core\Base\Container\Compiler\Search\SearchEngineSignalSlotPass; class EzPublishLegacySearchEngineBundle extends Bundle { @@ -26,7 +25,6 @@ public function build(ContainerBuilder $container) $container->addCompilerPass(new CriterionFieldValueHandlerRegistryPass()); $container->addCompilerPass(new SortClauseConverterPass()); $container->addCompilerPass(new FieldRegistryPass()); - $container->addCompilerPass(new SearchEngineSignalSlotPass('legacy')); } public function getContainerExtension() diff --git a/eZ/Publish/API/Repository/Tests/ContentServiceTest.php b/eZ/Publish/API/Repository/Tests/ContentServiceTest.php index f722cc092fa..b3f8d363e11 100644 --- a/eZ/Publish/API/Repository/Tests/ContentServiceTest.php +++ b/eZ/Publish/API/Repository/Tests/ContentServiceTest.php @@ -6672,9 +6672,9 @@ public function testPublishVersionWithSelectedLanguages() $contentUpdateStruct->setField('name', 'Draft 1 DE', 'ger-DE'); $contentService->updateContent($draft->versionInfo, $contentUpdateStruct); - $contentService->publishVersion($draft->versionInfo, ['ger-DE']); $content = $contentService->loadContent($draft->contentInfo->id); + $this->assertEquals( [ 'eng-US' => 'Published US', diff --git a/eZ/Publish/API/Repository/Tests/SearchServiceTest.php b/eZ/Publish/API/Repository/Tests/SearchServiceTest.php index c0e41edf598..b03ab945382 100644 --- a/eZ/Publish/API/Repository/Tests/SearchServiceTest.php +++ b/eZ/Publish/API/Repository/Tests/SearchServiceTest.php @@ -3654,7 +3654,7 @@ protected function createContentForTestUserMetadataGroupHorizontal() // Create a Content to be found through Editors UserGroup id. // This ensures data is indexed, it could also be done by updating metadata of - // an existing Content, but slot would need to reindex Content and that should + // an existing Content, but listener would need to reindex Content and that should // be tested elsewhere (dedicated indexing integration tests, missing ATM). $contentType = $contentTypeService->loadContentTypeByIdentifier('folder'); @@ -3719,7 +3719,7 @@ public function testUserMetadataGroupHorizontalFilterContent($queryType = null) // Administrator User is owned by itself, when additional Locations are added // it should be reindexed and its UserGroups will updated, which means it should // also be found as a Content of Editors UserGroup. However we do not handle this - // in slots yet, and also miss SPI methods to do it without using Search (also + // in listeners yet, and also miss SPI methods to do it without using Search (also // needed to decouple services), because as indexing is asynchronous Search // should not eat its own dog food for reindexing. $this->assertEquals(1, $result->totalCount); @@ -3730,7 +3730,7 @@ public function testUserMetadataGroupHorizontalFilterContent($queryType = null) ); } else { // This is how it should eventually work for all search engines, - // with required reindexing slots properly implemented. + // with required reindexing listeners properly implemented. $result = $searchService->findContent($query); @@ -3808,7 +3808,7 @@ public function testUserMetadataGroupHorizontalFilterLocation($queryType = null) // Administrator User is owned by itself, when additional Locations are added // it should be reindexed and its UserGroups will updated, which means it should // also be found as a Content of Editors UserGroup. However we do not handle this - // in slots yet, and also miss SPI methods to do it without using Search (also + // in listeners yet, and also miss SPI methods to do it without using Search (also // needed to decouple services), because as indexing is asynchronous Search // should not eat its own dog food for reindexing. $this->assertEquals(1, $result->totalCount); @@ -3819,7 +3819,7 @@ public function testUserMetadataGroupHorizontalFilterLocation($queryType = null) ); } else { // This is how it should eventually work for all search engines, - // with required reindexing slots properly implemented. + // with required reindexing listeners properly implemented. $result = $searchService->findLocations($query); diff --git a/eZ/Publish/API/Repository/Tests/SetupFactory/Legacy.php b/eZ/Publish/API/Repository/Tests/SetupFactory/Legacy.php index c5ea30ee167..7051dcb865a 100644 --- a/eZ/Publish/API/Repository/Tests/SetupFactory/Legacy.php +++ b/eZ/Publish/API/Repository/Tests/SetupFactory/Legacy.php @@ -467,7 +467,6 @@ public function getServiceContainer() self::$ioRootDir . '/' . $containerBuilder->getParameter('storage_dir') ); - $containerBuilder->addCompilerPass(new Compiler\Search\SearchEngineSignalSlotPass('legacy')); $containerBuilder->addCompilerPass(new Compiler\Search\FieldRegistryPass()); // load overrides just before creating test Container diff --git a/eZ/Publish/API/Repository/Tests/UserServiceTest.php b/eZ/Publish/API/Repository/Tests/UserServiceTest.php index 632d8acda45..0740ad1df2c 100644 --- a/eZ/Publish/API/Repository/Tests/UserServiceTest.php +++ b/eZ/Publish/API/Repository/Tests/UserServiceTest.php @@ -1662,12 +1662,12 @@ public function testUpdateUserEmail(): void public function testUpdateUserNoPassword() { $repository = $this->getRepository(); - $signalSlotUserService = $repository->getUserService(); + $eventUserService = $repository->getUserService(); - $signalSlotUserServiceReflection = new ReflectionClass($signalSlotUserService); - $userServiceProperty = $signalSlotUserServiceReflection->getProperty('service'); + $eventUserServiceReflection = new ReflectionClass($eventUserService); + $userServiceProperty = $eventUserServiceReflection->getProperty('innerService'); $userServiceProperty->setAccessible(true); - $userService = $userServiceProperty->getValue($signalSlotUserService); + $userService = $userServiceProperty->getValue($eventUserService); $userServiceReflection = new ReflectionClass($userService); $settingsProperty = $userServiceReflection->getProperty('settings'); @@ -2691,12 +2691,12 @@ public function testCreateUserInvalidPasswordHashTypeThrowsException() $this->expectExceptionMessage("Argument 'type' is invalid: Password hash type '42424242' is not recognized"); $repository = $this->getRepository(); - $signalSlotUserService = $repository->getUserService(); + $eventUserService = $repository->getUserService(); - $signalSlotUserServiceReflection = new ReflectionClass($signalSlotUserService); - $userServiceProperty = $signalSlotUserServiceReflection->getProperty('service'); + $eventUserServiceReflection = new ReflectionClass($eventUserService); + $userServiceProperty = $eventUserServiceReflection->getProperty('innerService'); $userServiceProperty->setAccessible(true); - $userService = $userServiceProperty->getValue($signalSlotUserService); + $userService = $userServiceProperty->getValue($eventUserService); $userServiceReflection = new ReflectionClass($userService); $settingsProperty = $userServiceReflection->getProperty('settings'); diff --git a/eZ/Publish/Core/Base/Container/ApiLoader/RepositoryFactory.php b/eZ/Publish/Core/Base/Container/ApiLoader/RepositoryFactory.php index 0d37a54245e..ee338e690da 100644 --- a/eZ/Publish/Core/Base/Container/ApiLoader/RepositoryFactory.php +++ b/eZ/Publish/Core/Base/Container/ApiLoader/RepositoryFactory.php @@ -53,7 +53,7 @@ public function __construct( * Builds the main repository, heart of eZ Publish API. * * This always returns the true inner Repository, please depend on ezpublish.api.repository and not this method - * directly to make sure you get an instance wrapped inside Signal / Cache / * functionality. + * directly to make sure you get an instance wrapped inside Event / Cache / * functionality. * * @param \eZ\Publish\SPI\Persistence\Handler $persistenceHandler * @param \eZ\Publish\SPI\Search\Handler $searchHandler diff --git a/eZ/Publish/Core/Base/Container/ApiLoader/SignalSlot/SignalDispatcherFactory.php b/eZ/Publish/Core/Base/Container/ApiLoader/SignalSlot/SignalDispatcherFactory.php deleted file mode 100644 index cfd18841c7c..00000000000 --- a/eZ/Publish/Core/Base/Container/ApiLoader/SignalSlot/SignalDispatcherFactory.php +++ /dev/null @@ -1,82 +0,0 @@ -signalDispatcherClass = $signalDispatcherClass; - $this->searchEngineAlias = $searchEngineAlias; - } - - /** - * Get current search engine alias. - * - * @return string - */ - public function getSearchEngineAlias() - { - return $this->searchEngineAlias; - } - - /** - * Bulk add all signal slots if needed for a search engine. - * - * @param string $searchEngineAlias - * @param array $searchEngineSignalSlots [signal => array(slot1, slot2, ...)] - */ - public function addSlotsForSearchEngine($searchEngineAlias, array $searchEngineSignalSlots) - { - if ($this->getSearchEngineAlias() !== $searchEngineAlias) { - return; - } - - foreach ($searchEngineSignalSlots as $signalIdentifier => $slots) { - if ($signalIdentifier[0] === '\\') { - $signalIdentifier = substr($signalIdentifier, 1); - } elseif ($signalIdentifier !== '*') { - $signalIdentifier = static::RELATIVE_SIGNAL_NAMESPACE . "\\$signalIdentifier"; - } - $this->signalSlotMap[$signalIdentifier] = $slots; - } - } - - /** - * Build SignalDispatcher for SignalSlots. - * - * @return \eZ\Publish\Core\SignalSlot\SignalDispatcher - */ - public function buildSignalDispatcher() - { - return new $this->signalDispatcherClass($this->signalSlotMap); - } -} diff --git a/eZ/Publish/Core/Base/Container/Compiler/Search/SearchEngineSignalSlotPass.php b/eZ/Publish/Core/Base/Container/Compiler/Search/SearchEngineSignalSlotPass.php deleted file mode 100644 index 67bf88b3b2c..00000000000 --- a/eZ/Publish/Core/Base/Container/Compiler/Search/SearchEngineSignalSlotPass.php +++ /dev/null @@ -1,61 +0,0 @@ -searchEngineAlias = $searchEngineAlias; - } - - public function process(ContainerBuilder $container) - { - if (!$container->hasDefinition('ezpublish.signalslot.signal_dispatcher.factory')) { - return; - } - - $signalDispatcherFactoryDef = $container->getDefinition('ezpublish.signalslot.signal_dispatcher.factory'); - $searchEngineSlotTagName = sprintf('ezpublish.search.%s.slot', $this->searchEngineAlias); - $tags = $container->findTaggedServiceIds('ezpublish.search.slot') - + $container->findTaggedServiceIds($searchEngineSlotTagName); - - $searchEngineSignalSlots = []; - foreach ($tags as $id => $attributes) { - foreach ($attributes as $attribute) { - if (!isset($attribute['signal'])) { - throw new LogicException( - "Could not find 'signal' attribute on '$id' service, " . - "which is mandatory for services tagged as 'ezpublish.search.slot', " . - "or the specific tags for given search engine, in this case '$searchEngineSlotTagName'." - ); - } - - $searchEngineSignalSlots[$attribute['signal']][] = new Reference($id); - } - } - - $signalDispatcherFactoryDef->addMethodCall('addSlotsForSearchEngine', [$this->searchEngineAlias, $searchEngineSignalSlots]); - } -} diff --git a/eZ/Publish/Core/Base/Container/Compiler/Search/SignalSlotPass.php b/eZ/Publish/Core/Base/Container/Compiler/Search/SignalSlotPass.php deleted file mode 100644 index 105f3b9a5fc..00000000000 --- a/eZ/Publish/Core/Base/Container/Compiler/Search/SignalSlotPass.php +++ /dev/null @@ -1,50 +0,0 @@ -hasDefinition('ezpublish.signalslot.signal_dispatcher')) { - return; - } - - $signalDispatcherDef = $container->getDefinition('ezpublish.signalslot.signal_dispatcher'); - - foreach ($container->findTaggedServiceIds('ezpublish.search.slot') as $id => $attributes) { - foreach ($attributes as $attribute) { - if (!isset($attribute['signal'])) { - throw new LogicException( - "Could not find 'signal' attribute on '$id' service, " . - "which is mandatory for services tagged as 'ezpublish.persistence.solr.slot'" - ); - } - - $signalDispatcherDef->addMethodCall( - 'attach', - [ - $attribute['signal'], - new Reference($id), - ] - ); - } - } - } -} diff --git a/eZ/Publish/Core/Base/Tests/Container/Compiler/Search/SignalSlotPassTest.php b/eZ/Publish/Core/Base/Tests/Container/Compiler/Search/SignalSlotPassTest.php deleted file mode 100644 index d336dd4f555..00000000000 --- a/eZ/Publish/Core/Base/Tests/Container/Compiler/Search/SignalSlotPassTest.php +++ /dev/null @@ -1,71 +0,0 @@ -setDefinition('ezpublish.signalslot.signal_dispatcher', new Definition()); - } - - /** - * Register the compiler pass under test, just like you would do inside a bundle's load() - * method:. - * - * $container->addCompilerPass(new MyCompilerPass()); - */ - protected function registerCompilerPass(ContainerBuilder $container): void - { - $container->addCompilerPass(new SignalSlotPass()); - } - - public function testAttachSignal() - { - $signal = 'signal_identifier'; - $serviceId = 'service_id'; - $def = new Definition(); - $def->addTag('ezpublish.search.slot', ['signal' => $signal]); - $this->setDefinition($serviceId, $def); - - $this->compile(); - - $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( - 'ezpublish.signalslot.signal_dispatcher', - 'attach', - [$signal, new Reference($serviceId)] - ); - } - - public function testAttachSignalNoAlias() - { - $this->expectException(\LogicException::class); - - $signal = 'signal_identifier'; - $serviceId = 'service_id'; - $def = new Definition(); - $def->addTag('ezpublish.search.slot'); - $this->setDefinition($serviceId, $def); - - $this->compile(); - - $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( - 'ezpublish.signalslot.signal_dispatcher', - 'attach', - [$signal, new Reference($serviceId)] - ); - } -} diff --git a/eZ/Publish/Core/MVC/Symfony/Event/SignalEvent.php b/eZ/Publish/Core/MVC/Symfony/Event/SignalEvent.php deleted file mode 100644 index 5037c64f713..00000000000 --- a/eZ/Publish/Core/MVC/Symfony/Event/SignalEvent.php +++ /dev/null @@ -1,35 +0,0 @@ -signal = $signal; - } - - /** - * @return Signal - */ - public function getSignal() - { - return $this->signal; - } -} diff --git a/eZ/Publish/Core/MVC/Symfony/Event/Tests/SignalEventTest.php b/eZ/Publish/Core/MVC/Symfony/Event/Tests/SignalEventTest.php deleted file mode 100644 index 53c9dca52d4..00000000000 --- a/eZ/Publish/Core/MVC/Symfony/Event/Tests/SignalEventTest.php +++ /dev/null @@ -1,27 +0,0 @@ -createMock(Signal::class); - $event = new SignalEvent($signal); - $this->assertSame($signal, $event->getSignal()); - } -} diff --git a/eZ/Publish/Core/MVC/Symfony/MVCEvents.php b/eZ/Publish/Core/MVC/Symfony/MVCEvents.php index 646ad8cffd6..a0b8c4a6777 100644 --- a/eZ/Publish/Core/MVC/Symfony/MVCEvents.php +++ b/eZ/Publish/Core/MVC/Symfony/MVCEvents.php @@ -37,16 +37,6 @@ final class MVCEvents */ const API_CONTENT_EXCEPTION = 'ezpublish.api.contentException'; - /** - * The API_SIGNAL event occurs when the SignalSlot repository services emit a signal. - * This make it possible to react to it, depending on which signal is emitted. - * - * All available signals can be found under eZ\Publish\Core\SignalSlot\Signal namespace. - * - * The event listener method receives a eZ\Publish\Core\MVC\Symfony\Event\SignalEvent instance. - */ - const API_SIGNAL = 'ezpublish.api.signal'; - /** * CONFIG_SCOPE_CHANGE event occurs when configuration scope is changed (e.g. for content preview in a given siteaccess). * diff --git a/eZ/Publish/Core/Search/Common/BackgroundIndexer.php b/eZ/Publish/Core/Search/Common/BackgroundIndexer.php index bef4738cbab..5e20c1c1034 100644 --- a/eZ/Publish/Core/Search/Common/BackgroundIndexer.php +++ b/eZ/Publish/Core/Search/Common/BackgroundIndexer.php @@ -16,7 +16,7 @@ * * Example of background: After console command or request has finished execution. * - * NOTE: This is not for use by regular indexing needs reacting to Repository signals, but rather for use inside the + * NOTE: This is not for use by regular indexing needs reacting to Repository events, but rather for use inside the * Search service when inconsistencies are discovered which should be re-indexed, hence operate as a self healing system. */ interface BackgroundIndexer diff --git a/eZ/Publish/Core/Search/Common/Slot/AbstractSubtree.php b/eZ/Publish/Core/Search/Common/EventSubscriber/AbstractSearchEventSubscriber.php similarity index 64% rename from eZ/Publish/Core/Search/Common/Slot/AbstractSubtree.php rename to eZ/Publish/Core/Search/Common/EventSubscriber/AbstractSearchEventSubscriber.php index 107e81446c0..47ccee3a642 100644 --- a/eZ/Publish/Core/Search/Common/Slot/AbstractSubtree.php +++ b/eZ/Publish/Core/Search/Common/EventSubscriber/AbstractSearchEventSubscriber.php @@ -1,21 +1,34 @@ searchHandler = $searchHandler; + $this->persistenceHandler = $persistenceHandler; + } + + public function indexSubtree(int $locationId): void { $contentHandler = $this->persistenceHandler->contentHandler(); $locationHandler = $this->persistenceHandler->locationHandler(); diff --git a/eZ/Publish/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php b/eZ/Publish/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php new file mode 100644 index 00000000000..d40725c742b --- /dev/null +++ b/eZ/Publish/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php @@ -0,0 +1,125 @@ + 'onCopyContent', + DeleteContentEvent::class => 'onDeleteContent', + DeleteTranslationEvent::class => 'onDeleteTranslation', + HideContentEvent::class => 'onHideContent', + PublishVersionEvent::class => 'onPublishVersion', + RevealContentEvent::class => 'onRevealContent', + UpdateContentMetadataEvent::class => 'onUpdateContentMetadata', + ]; + } + + public function onCopyContent(CopyContentEvent $event) + { + $this->searchHandler->indexContent( + $this->persistenceHandler->contentHandler()->load( + $event->getContent()->getVersionInfo()->getContentInfo()->id, + $event->getContent()->getVersionInfo()->versionNo + ) + ); + + $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent( + $event->getContent()->getVersionInfo()->getContentInfo()->id + ); + + foreach ($locations as $location) { + $this->searchHandler->indexLocation($location); + } + } + + public function onDeleteContent(DeleteContentEvent $event) + { + $this->searchHandler->deleteContent($event->getContentInfo()->id); + + foreach ($event->getLocations() as $locationId) { + $this->searchHandler->deleteLocation($locationId, $event->getContentInfo()->id); + } + } + + public function onDeleteTranslation(DeleteTranslationEvent $event) + { + $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( + $event->getContentInfo()->id + ); + + if (!$contentInfo->isPublished) { + return; + } + + $this->searchHandler->indexContent( + $this->persistenceHandler->contentHandler()->load( + $contentInfo->id, + $contentInfo->currentVersionNo + ) + ); + + $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent( + $contentInfo->id + ); + + foreach ($locations as $location) { + $this->searchHandler->indexLocation($location); + } + } + + public function onHideContent(HideContentEvent $event) + { + $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($event->getContentInfo()->id); + foreach ($locations as $location) { + $this->indexSubtree($location->id); + } + } + + public function onPublishVersion(PublishVersionEvent $event) + { + $this->searchHandler->indexContent( + $this->persistenceHandler->contentHandler()->load($event->getContent()->id, $event->getContent()->getVersionInfo()->versionNo) + ); + + $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($event->getContent()->id); + foreach ($locations as $location) { + $this->searchHandler->indexLocation($location); + } + } + + public function onRevealContent(RevealContentEvent $event) + { + $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($event->getContentInfo()->id); + foreach ($locations as $location) { + $this->indexSubtree($location->id); + } + } + + public function onUpdateContentMetadata(UpdateContentMetadataEvent $event) + { + $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($event->getContent()->id); + if (!$contentInfo->isPublished) { + return; + } + $this->searchHandler->indexContent( + $this->persistenceHandler->contentHandler()->load($contentInfo->id, $contentInfo->currentVersionNo) + ); + $this->searchHandler->indexLocation($this->persistenceHandler->locationHandler()->load($contentInfo->mainLocationId)); + } +} diff --git a/eZ/Publish/Core/Search/Common/EventSubscriber/LocationEventSubscriber.php b/eZ/Publish/Core/Search/Common/EventSubscriber/LocationEventSubscriber.php new file mode 100644 index 00000000000..da82f2b43aa --- /dev/null +++ b/eZ/Publish/Core/Search/Common/EventSubscriber/LocationEventSubscriber.php @@ -0,0 +1,120 @@ + 'onCopySubtree', + CreateLocationEvent::class => 'onCreateLocation', + DeleteLocationEvent::class => 'onDeleteLocation', + HideLocationEvent::class => 'onHideLocation', + MoveSubtreeEvent::class => 'onMoveSubtree', + SwapLocationEvent::class => 'onSwapLocation', + UnhideLocationEvent::class => 'onUnhideLocation', + UpdateLocationEvent::class => 'onUpdateLocation', + ]; + } + + public function onCopySubtree(CopySubtreeEvent $event) + { + $this->indexSubtree($event->getLocation()->id); + } + + public function onCreateLocation(CreateLocationEvent $event) + { + $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( + $event->getContentInfo()->id + ); + + $this->searchHandler->indexContent( + $this->persistenceHandler->contentHandler()->load( + $contentInfo->id, + $contentInfo->currentVersionNo + ) + ); + } + + public function onDeleteLocation(DeleteLocationEvent $event) + { + $this->searchHandler->deleteLocation( + $event->getLocation()->id, + $event->getLocation()->contentId + ); + } + + public function onHideLocation(HideLocationEvent $event) + { + $this->indexSubtree($event->getHiddenLocation()->id); + } + + public function onMoveSubtree(MoveSubtreeEvent $event) + { + $this->indexSubtree($event->getLocation()->id); + } + + public function onSwapLocation(SwapLocationEvent $event) + { + $locations = [ + $event->getLocation1(), + $event->getLocation2(), + ]; + + array_walk($locations, function (Location $location) { + $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($location->contentId); + + $this->searchHandler->indexContent( + $this->persistenceHandler->contentHandler()->load( + $location->contentId, + $contentInfo->currentVersionNo + ) + ); + + $this->searchHandler->indexLocation( + $this->persistenceHandler->locationHandler()->load($location->id) + ); + }); + } + + public function onUnhideLocation(UnhideLocationEvent $event) + { + $this->indexSubtree($event->getRevealedLocation()->id); + } + + public function onUpdateLocation(UpdateLocationEvent $event) + { + $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( + $event->getLocation()->contentId + ); + + $this->searchHandler->indexContent( + $this->persistenceHandler->contentHandler()->load( + $event->getLocation()->contentId, + $contentInfo->currentVersionNo + ) + ); + + $this->searchHandler->indexLocation( + $this->persistenceHandler->locationHandler()->load( + $event->getLocation()->id + ) + ); + } +} diff --git a/eZ/Publish/Core/Search/Common/Slot/SetContentState.php b/eZ/Publish/Core/Search/Common/EventSubscriber/ObjectStateEventSubscriber.php similarity index 53% rename from eZ/Publish/Core/Search/Common/Slot/SetContentState.php rename to eZ/Publish/Core/Search/Common/EventSubscriber/ObjectStateEventSubscriber.php index 1800ff99700..4ad8911c811 100644 --- a/eZ/Publish/Core/Search/Common/Slot/SetContentState.php +++ b/eZ/Publish/Core/Search/Common/EventSubscriber/ObjectStateEventSubscriber.php @@ -1,33 +1,26 @@ 'onSetContentState', + ]; + } - $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($signal->contentId); + public function onSetContentState(SetContentStateEvent $event) + { + $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($event->getContentInfo()->id); $this->searchHandler->indexContent( $this->persistenceHandler->contentHandler()->load( diff --git a/eZ/Publish/Core/Search/Common/EventSubscriber/SectionEventSubscriber.php b/eZ/Publish/Core/Search/Common/EventSubscriber/SectionEventSubscriber.php new file mode 100644 index 00000000000..92c58b92cac --- /dev/null +++ b/eZ/Publish/Core/Search/Common/EventSubscriber/SectionEventSubscriber.php @@ -0,0 +1,28 @@ + 'onAssignSection', + ]; + } + + public function onAssignSection(AssignSectionEvent $event) + { + $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($event->getContentInfo()->id); + $this->searchHandler->indexContent( + $this->persistenceHandler->contentHandler()->load($contentInfo->id, $contentInfo->currentVersionNo) + ); + } +} diff --git a/eZ/Publish/Core/Search/Common/EventSubscriber/TrashEventSubscriber.php b/eZ/Publish/Core/Search/Common/EventSubscriber/TrashEventSubscriber.php new file mode 100644 index 00000000000..fa8cac696af --- /dev/null +++ b/eZ/Publish/Core/Search/Common/EventSubscriber/TrashEventSubscriber.php @@ -0,0 +1,42 @@ + 'onRecover', + TrashEvent::class => 'onTrash', + ]; + } + + public function onRecover(RecoverEvent $event) + { + $this->indexSubtree($event->getLocation()->id); + } + + public function onTrash(TrashEvent $event) + { + if ($event->getTrashItem() instanceof TrashItem) { + $this->searchHandler->deleteContent( + $event->getLocation()->contentId + ); + } + + $this->searchHandler->deleteLocation( + $event->getLocation()->id, + $event->getLocation()->contentId + ); + } +} diff --git a/eZ/Publish/Core/Search/Common/EventSubscriber/UserEventSubscriber.php b/eZ/Publish/Core/Search/Common/EventSubscriber/UserEventSubscriber.php new file mode 100644 index 00000000000..beb8318c6a6 --- /dev/null +++ b/eZ/Publish/Core/Search/Common/EventSubscriber/UserEventSubscriber.php @@ -0,0 +1,147 @@ + 'onCreateUser', + CreateUserGroupEvent::class => 'onCreateUserGroup', + DeleteUserEvent::class => 'onDeleteUser', + DeleteUserGroupEvent::class => 'onDeleteUserGroup', + MoveUserGroupEvent::class => 'onMoveUserGroup', + UpdateUserEvent::class => 'onUpdateUser', + UpdateUserGroupEvent::class => 'onUpdateUserGroup', + ]; + } + + public function onCreateUser(CreateUserEvent $event) + { + $userContentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( + $event->getUser()->id + ); + + $this->searchHandler->indexContent( + $this->persistenceHandler->contentHandler()->load( + $userContentInfo->id, + $userContentInfo->currentVersionNo + ) + ); + + $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent( + $userContentInfo->id + ); + + foreach ($locations as $location) { + $this->searchHandler->indexLocation($location); + } + } + + public function onCreateUserGroup(CreateUserGroupEvent $event) + { + $userGroupContentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( + $event->getUserGroup()->id + ); + + $this->searchHandler->indexContent( + $this->persistenceHandler->contentHandler()->load( + $userGroupContentInfo->id, + $userGroupContentInfo->currentVersionNo + ) + ); + + $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent( + $userGroupContentInfo->id + ); + + foreach ($locations as $location) { + $this->searchHandler->indexLocation($location); + } + } + + public function onDeleteUser(DeleteUserEvent $event) + { + $this->searchHandler->deleteContent($event->getUser()->id); + + foreach ($event->getLocations() as $locationId) { + $this->searchHandler->deleteLocation($locationId, $event->getUser()->id); + } + } + + public function onDeleteUserGroup(DeleteUserGroupEvent $event) + { + $this->searchHandler->deleteContent($event->getUserGroup()->id); + + foreach ($event->getLocations() as $locationId) { + $this->searchHandler->deleteLocation($locationId, $event->getUserGroup()->id); + } + } + + public function onMoveUserGroup(MoveUserGroupEvent $event) + { + $userGroupContentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( + $event->getUserGroup()->id + ); + + $this->indexSubtree($userGroupContentInfo->mainLocationId); + } + + public function onUpdateUser(UpdateUserEvent $event) + { + $userContentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( + $event->getUser()->id + ); + + $this->searchHandler->indexContent( + $this->persistenceHandler->contentHandler()->load( + $userContentInfo->id, + $userContentInfo->currentVersionNo + ) + ); + + $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent( + $userContentInfo->id + ); + + foreach ($locations as $location) { + $this->searchHandler->indexLocation($location); + } + } + + public function onUpdateUserGroup(UpdateUserGroupEvent $event) + { + $userContentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( + $event->getUserGroup()->id + ); + + $this->searchHandler->indexContent( + $this->persistenceHandler->contentHandler()->load( + $userContentInfo->id, + $userContentInfo->currentVersionNo + ) + ); + + $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent( + $userContentInfo->id + ); + + foreach ($locations as $location) { + $this->searchHandler->indexLocation($location); + } + } +} diff --git a/eZ/Publish/Core/Search/Common/Slot.php b/eZ/Publish/Core/Search/Common/Slot.php deleted file mode 100644 index 5d6516758e2..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot.php +++ /dev/null @@ -1,39 +0,0 @@ -repository = $repository; - $this->persistenceHandler = $persistenceHandler; - $this->searchHandler = $searchHandler; - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/AssignSection.php b/eZ/Publish/Core/Search/Common/Slot/AssignSection.php deleted file mode 100644 index 731c913bd39..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/AssignSection.php +++ /dev/null @@ -1,32 +0,0 @@ -persistenceHandler->contentHandler()->loadContentInfo($signal->contentId); - $this->searchHandler->indexContent( - $this->persistenceHandler->contentHandler()->load($contentInfo->id, $contentInfo->currentVersionNo) - ); - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/CopyContent.php b/eZ/Publish/Core/Search/Common/Slot/CopyContent.php deleted file mode 100644 index 3e744bf2dcd..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/CopyContent.php +++ /dev/null @@ -1,44 +0,0 @@ -searchHandler->indexContent( - $this->persistenceHandler->contentHandler()->load( - $signal->dstContentId, - $signal->dstVersionNo - ) - ); - - $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent( - $signal->dstContentId - ); - foreach ($locations as $location) { - $this->searchHandler->indexLocation($location); - } - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/CopySubtree.php b/eZ/Publish/Core/Search/Common/Slot/CopySubtree.php deleted file mode 100644 index 4d98bcd1b49..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/CopySubtree.php +++ /dev/null @@ -1,31 +0,0 @@ -indexSubtree($signal->targetNewSubtreeId); - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/CreateLocation.php b/eZ/Publish/Core/Search/Common/Slot/CreateLocation.php deleted file mode 100644 index 48f4135aa58..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/CreateLocation.php +++ /dev/null @@ -1,45 +0,0 @@ -persistenceHandler->contentHandler()->loadContentInfo( - $signal->contentId - ); - - $this->searchHandler->indexContent( - $this->persistenceHandler->contentHandler()->load( - $signal->contentId, - $contentInfo->currentVersionNo - ) - ); - - $this->searchHandler->indexLocation( - $this->persistenceHandler->locationHandler()->load($signal->locationId) - ); - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/CreateUser.php b/eZ/Publish/Core/Search/Common/Slot/CreateUser.php deleted file mode 100644 index 77ce591cfb0..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/CreateUser.php +++ /dev/null @@ -1,48 +0,0 @@ -persistenceHandler->contentHandler()->loadContentInfo( - $signal->userId - ); - - $this->searchHandler->indexContent( - $this->persistenceHandler->contentHandler()->load( - $userContentInfo->id, - $userContentInfo->currentVersionNo - ) - ); - - $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent( - $userContentInfo->id - ); - foreach ($locations as $location) { - $this->searchHandler->indexLocation($location); - } - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/CreateUserGroup.php b/eZ/Publish/Core/Search/Common/Slot/CreateUserGroup.php deleted file mode 100644 index 80d67245968..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/CreateUserGroup.php +++ /dev/null @@ -1,48 +0,0 @@ -persistenceHandler->contentHandler()->loadContentInfo( - $signal->userGroupId - ); - - $this->searchHandler->indexContent( - $this->persistenceHandler->contentHandler()->load( - $userGroupContentInfo->id, - $userGroupContentInfo->currentVersionNo - ) - ); - - $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent( - $userGroupContentInfo->id - ); - foreach ($locations as $location) { - $this->searchHandler->indexLocation($location); - } - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/DeleteContent.php b/eZ/Publish/Core/Search/Common/Slot/DeleteContent.php deleted file mode 100644 index c1c41f6c236..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/DeleteContent.php +++ /dev/null @@ -1,38 +0,0 @@ -searchHandler->deleteContent($signal->contentId); - - // Delete locations if there is any - foreach ($signal->affectedLocationIds as $locationId) { - $this->searchHandler->deleteLocation($locationId, $signal->contentId); - } - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/DeleteLocation.php b/eZ/Publish/Core/Search/Common/Slot/DeleteLocation.php deleted file mode 100644 index aafcfd6b1d1..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/DeleteLocation.php +++ /dev/null @@ -1,35 +0,0 @@ -searchHandler->deleteLocation( - $signal->locationId, - $signal->contentId - ); - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/DeleteTranslation.php b/eZ/Publish/Core/Search/Common/Slot/DeleteTranslation.php deleted file mode 100644 index b03dac8f373..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/DeleteTranslation.php +++ /dev/null @@ -1,51 +0,0 @@ -persistenceHandler->contentHandler()->loadContentInfo( - $signal->contentId - ); - if (!$contentInfo->isPublished) { - return; - } - - $this->searchHandler->indexContent( - $this->persistenceHandler->contentHandler()->load( - $contentInfo->id, - $contentInfo->currentVersionNo - ) - ); - - $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent( - $contentInfo->id - ); - foreach ($locations as $location) { - $this->searchHandler->indexLocation($location); - } - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/DeleteUser.php b/eZ/Publish/Core/Search/Common/Slot/DeleteUser.php deleted file mode 100644 index 9c0c3c74bf8..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/DeleteUser.php +++ /dev/null @@ -1,38 +0,0 @@ -searchHandler->deleteContent($signal->userId); - - // Delete locations if there is any - foreach ($signal->affectedLocationIds as $locationId) { - $this->searchHandler->deleteLocation($locationId, $signal->userId); - } - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/DeleteUserGroup.php b/eZ/Publish/Core/Search/Common/Slot/DeleteUserGroup.php deleted file mode 100644 index 4a90cf25202..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/DeleteUserGroup.php +++ /dev/null @@ -1,38 +0,0 @@ -searchHandler->deleteContent($signal->userGroupId); - - // Delete locations if there is any - foreach ($signal->affectedLocationIds as $locationId) { - $this->searchHandler->deleteLocation($locationId, $signal->userGroupId); - } - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/DeleteVersion.php b/eZ/Publish/Core/Search/Common/Slot/DeleteVersion.php deleted file mode 100644 index d5099a267be..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/DeleteVersion.php +++ /dev/null @@ -1,34 +0,0 @@ -persistenceHandler->locationHandler()->loadLocationsByContent($signal->contentId); - foreach ($locations as $location) { - $this->indexSubtree($location->id); - } - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/HideLocation.php b/eZ/Publish/Core/Search/Common/Slot/HideLocation.php deleted file mode 100644 index bc21e601a25..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/HideLocation.php +++ /dev/null @@ -1,32 +0,0 @@ -indexSubtree($signal->locationId); - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/MoveSubtree.php b/eZ/Publish/Core/Search/Common/Slot/MoveSubtree.php deleted file mode 100644 index e5626b86794..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/MoveSubtree.php +++ /dev/null @@ -1,32 +0,0 @@ -indexSubtree($signal->locationId); - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/MoveUserGroup.php b/eZ/Publish/Core/Search/Common/Slot/MoveUserGroup.php deleted file mode 100644 index 0dc52a9d985..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/MoveUserGroup.php +++ /dev/null @@ -1,38 +0,0 @@ -persistenceHandler->contentHandler()->loadContentInfo( - $signal->userGroupId - ); - - // Moving UserGroup moves its main Location, so we only need to - // (re)index main Location's subtree - $this->indexSubtree($userGroupContentInfo->mainLocationId); - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/PublishVersion.php b/eZ/Publish/Core/Search/Common/Slot/PublishVersion.php deleted file mode 100644 index b4966474841..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/PublishVersion.php +++ /dev/null @@ -1,39 +0,0 @@ -searchHandler->indexContent( - $this->persistenceHandler->contentHandler()->load($signal->contentId, $signal->versionNo) - ); - - $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($signal->contentId); - foreach ($locations as $location) { - $this->searchHandler->indexLocation($location); - } - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/Recover.php b/eZ/Publish/Core/Search/Common/Slot/Recover.php deleted file mode 100644 index 15ca67e5861..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/Recover.php +++ /dev/null @@ -1,31 +0,0 @@ -indexSubtree($signal->newLocationId); - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/RevealContent.php b/eZ/Publish/Core/Search/Common/Slot/RevealContent.php deleted file mode 100644 index f780f0b7fc5..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/RevealContent.php +++ /dev/null @@ -1,31 +0,0 @@ -persistenceHandler->locationHandler()->loadLocationsByContent($signal->contentId); - foreach ($locations as $location) { - $this->indexSubtree($location->id); - } - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/SwapLocation.php b/eZ/Publish/Core/Search/Common/Slot/SwapLocation.php deleted file mode 100644 index 12132dfcc85..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/SwapLocation.php +++ /dev/null @@ -1,46 +0,0 @@ -persistenceHandler->contentHandler()->loadContentInfoList([$signal->content1Id, $signal->content2Id]); - $this->searchHandler->indexContent( - $this->persistenceHandler->contentHandler()->load( - $signal->content1Id, - $contentInfoList[$signal->content1Id]->currentVersionNo - ) - ); - $this->searchHandler->indexContent( - $this->persistenceHandler->contentHandler()->load( - $signal->content2Id, - $contentInfoList[$signal->content2Id]->currentVersionNo - ) - ); - $this->searchHandler->indexLocation($this->persistenceHandler->locationHandler()->load($signal->location1Id)); - $this->searchHandler->indexLocation($this->persistenceHandler->locationHandler()->load($signal->location2Id)); - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/Trash.php b/eZ/Publish/Core/Search/Common/Slot/Trash.php deleted file mode 100644 index 89f8223e68f..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/Trash.php +++ /dev/null @@ -1,41 +0,0 @@ -contentTrashed) { - $this->searchHandler->deleteContent( - $signal->contentId - ); - } - - $this->searchHandler->deleteLocation( - $signal->locationId, - $signal->contentId - ); - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/UnhideLocation.php b/eZ/Publish/Core/Search/Common/Slot/UnhideLocation.php deleted file mode 100644 index 0e61d72ac54..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/UnhideLocation.php +++ /dev/null @@ -1,32 +0,0 @@ -indexSubtree($signal->locationId); - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/UpdateContentMetadata.php b/eZ/Publish/Core/Search/Common/Slot/UpdateContentMetadata.php deleted file mode 100644 index 48a5dacad1e..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/UpdateContentMetadata.php +++ /dev/null @@ -1,36 +0,0 @@ -persistenceHandler->contentHandler()->loadContentInfo($signal->contentId); - if (!$contentInfo->isPublished) { - return; - } - $this->searchHandler->indexContent( - $this->persistenceHandler->contentHandler()->load($contentInfo->id, $contentInfo->currentVersionNo) - ); - $this->searchHandler->indexLocation($this->persistenceHandler->locationHandler()->load($contentInfo->mainLocationId)); - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/UpdateLocation.php b/eZ/Publish/Core/Search/Common/Slot/UpdateLocation.php deleted file mode 100644 index a069ee49f88..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/UpdateLocation.php +++ /dev/null @@ -1,45 +0,0 @@ -persistenceHandler->contentHandler()->loadContentInfo( - $signal->contentId - ); - - $this->searchHandler->indexContent( - $this->persistenceHandler->contentHandler()->load( - $signal->contentId, - $contentInfo->currentVersionNo - ) - ); - - $this->searchHandler->indexLocation( - $this->persistenceHandler->locationHandler()->load($signal->locationId) - ); - } -} diff --git a/eZ/Publish/Core/Search/Common/Slot/UpdateUser.php b/eZ/Publish/Core/Search/Common/Slot/UpdateUser.php deleted file mode 100644 index ebc8f6ea9c9..00000000000 --- a/eZ/Publish/Core/Search/Common/Slot/UpdateUser.php +++ /dev/null @@ -1,48 +0,0 @@ -persistenceHandler->contentHandler()->loadContentInfo( - $signal->userId - ); - - $this->searchHandler->indexContent( - $this->persistenceHandler->contentHandler()->load( - $userContentInfo->id, - $userContentInfo->currentVersionNo - ) - ); - - $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent( - $userContentInfo->id - ); - foreach ($locations as $location) { - $this->searchHandler->indexLocation($location); - } - } -} diff --git a/eZ/Publish/Core/SignalSlot/BookmarkService.php b/eZ/Publish/Core/SignalSlot/BookmarkService.php deleted file mode 100644 index 165f1f65f3f..00000000000 --- a/eZ/Publish/Core/SignalSlot/BookmarkService.php +++ /dev/null @@ -1,84 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * {@inheritdoc} - */ - public function createBookmark(Location $location): void - { - $this->service->createBookmark($location); - - $this->signalDispatcher->emit(new CreateBookmarkSignal([ - 'locationId' => $location->id, - ])); - } - - /** - * {@inheritdoc} - */ - public function deleteBookmark(Location $location): void - { - $this->service->deleteBookmark($location); - - $this->signalDispatcher->emit(new DeleteBookmarkSignal([ - 'locationId' => $location->id, - ])); - } - - /** - * {@inheritdoc} - */ - public function loadBookmarks(int $offset = 0, int $limit = 25): BookmarkList - { - return $this->service->loadBookmarks($offset, $limit); - } - - /** - * {@inheritdoc} - */ - public function isBookmarked(Location $location): bool - { - return $this->service->isBookmarked($location); - } -} diff --git a/eZ/Publish/Core/SignalSlot/ContentService.php b/eZ/Publish/Core/SignalSlot/ContentService.php deleted file mode 100644 index c77892c7969..00000000000 --- a/eZ/Publish/Core/SignalSlot/ContentService.php +++ /dev/null @@ -1,734 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * Loads a content info object. - * - * To load fields use loadContent - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read the content - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the content with the given id does not exist - * - * @param int $contentId - * - * @return \eZ\Publish\API\Repository\Values\Content\ContentInfo - */ - public function loadContentInfo($contentId) - { - return $this->service->loadContentInfo($contentId); - } - - /** - * {@inheritdoc} - */ - public function loadContentInfoList(array $contentIds): iterable - { - return $this->service->loadContentInfoList($contentIds); - } - - /** - * Loads a content info object for the given remoteId. - * - * To load fields use loadContent - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read the content - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the content with the given remote id does not exist - * - * @param string $remoteId - * - * @return \eZ\Publish\API\Repository\Values\Content\ContentInfo - */ - public function loadContentInfoByRemoteId($remoteId) - { - return $this->service->loadContentInfoByRemoteId($remoteId); - } - - /** - * Loads a version info of the given content object. - * - * If no version number is given, the method returns the current version - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the version with the given number does not exist - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - * @param int $versionNo the version number. If not given the current version is returned. - * - * @return \eZ\Publish\API\Repository\Values\Content\VersionInfo - */ - public function loadVersionInfo(ContentInfo $contentInfo, $versionNo = null) - { - return $this->service->loadVersionInfo($contentInfo, $versionNo); - } - - /** - * Loads a version info of the given content object id. - * - * If no version number is given, the method returns the current version - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the version with the given number does not exist - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version - * - * @param mixed $contentId - * @param int $versionNo the version number. If not given the current version is returned. - * - * @return \eZ\Publish\API\Repository\Values\Content\VersionInfo - */ - public function loadVersionInfoById($contentId, $versionNo = null) - { - return $this->service->loadVersionInfoById($contentId, $versionNo); - } - - /** - * Loads content in a version for the given content info object. - * - * If no version number is given, the method returns the current version - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if version with the given number does not exist - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - * @param array $languages A language filter for fields. If not given all languages are returned - * @param int $versionNo the version number. If not given the current version is returned - * @param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true - * - * @return \eZ\Publish\API\Repository\Values\Content\Content - */ - public function loadContentByContentInfo(ContentInfo $contentInfo, array $languages = null, $versionNo = null, $useAlwaysAvailable = true) - { - return $this->service->loadContentByContentInfo($contentInfo, $languages, $versionNo, $useAlwaysAvailable); - } - - /** - * Loads content in the version given by version info. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version - * - * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo - * @param array $languages A language filter for fields. If not given all languages are returned - * @param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true - * - * @return \eZ\Publish\API\Repository\Values\Content\Content - */ - public function loadContentByVersionInfo(VersionInfo $versionInfo, array $languages = null, $useAlwaysAvailable = true) - { - return $this->service->loadContentByVersionInfo($versionInfo, $languages, $useAlwaysAvailable); - } - - /** - * Loads content in a version of the given content object. - * - * If no version number is given, the method returns the current version - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if the content or version with the given id and languages does not exist - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version - * - * @param int $contentId - * @param array $languages A language filter for fields. If not given all languages are returned - * @param int $versionNo the version number. If not given the current version is returned - * @param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true - * - * @return \eZ\Publish\API\Repository\Values\Content\Content - */ - public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true) - { - return $this->service->loadContent($contentId, $languages, $versionNo, $useAlwaysAvailable); - } - - /** - * Loads content in a version for the content object reference by the given remote id. - * - * If no version is given, the method returns the current version - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the content or version with the given remote id does not exist - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version - * - * @param string $remoteId - * @param array $languages A language filter for fields. If not given all languages are returned - * @param int $versionNo the version number. If not given the current version is returned - * @param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true - * - * @return \eZ\Publish\API\Repository\Values\Content\Content - */ - public function loadContentByRemoteId($remoteId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true) - { - return $this->service->loadContentByRemoteId($remoteId, $languages, $versionNo, $useAlwaysAvailable); - } - - /** - * Creates a new content draft assigned to the authenticated user. - * - * If a different userId is given in $contentCreateStruct it is assigned to the given user - * but this required special rights for the authenticated user - * (this is useful for content staging where the transfer process does not - * have to authenticate with the user which created the content object in the source server). - * The user has to publish the draft if it should be visible. - * In 4.x at least one location has to be provided in the location creation array. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to create the content in the given location - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if there is a provided remoteId which exists in the system - * or there is no location provided (4.x) or multiple locations - * are under the same parent or if the a field value is not accepted by the field type - * @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException if a field in the $contentCreateStruct is not valid - * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if a required field is missing or is set to an empty value - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentCreateStruct $contentCreateStruct - * @param \eZ\Publish\API\Repository\Values\Content\LocationCreateStruct[] $locationCreateStructs For each location parent under which a location should be created for the content - * - * @return \eZ\Publish\API\Repository\Values\Content\Content - the newly created content draft - */ - public function createContent(ContentCreateStruct $contentCreateStruct, array $locationCreateStructs = []) - { - $returnValue = $this->service->createContent($contentCreateStruct, $locationCreateStructs); - $this->signalDispatcher->emit( - new CreateContentSignal( - [ - 'contentId' => $returnValue->getVersionInfo()->getContentInfo()->id, - 'versionNo' => $returnValue->getVersionInfo()->versionNo, - ] - ) - ); - - return $returnValue; - } - - /** - * Updates the metadata. - * - * (see {@link ContentMetadataUpdateStruct}) of a content object - to update fields use updateContent - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to update the content meta data - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the remoteId in $contentMetadataUpdateStruct is set but already exists - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - * @param \eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct $contentMetadataUpdateStruct - * - * @return \eZ\Publish\API\Repository\Values\Content\Content the content with the updated attributes - */ - public function updateContentMetadata(ContentInfo $contentInfo, ContentMetadataUpdateStruct $contentMetadataUpdateStruct) - { - $returnValue = $this->service->updateContentMetadata($contentInfo, $contentMetadataUpdateStruct); - $this->signalDispatcher->emit( - new UpdateContentMetadataSignal( - [ - 'contentId' => $contentInfo->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Deletes a content object including all its versions and locations including their subtrees. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to delete the content (in one of the locations of the given content object) - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - * - * @return mixed[] Affected Location Id's - */ - public function deleteContent(ContentInfo $contentInfo) - { - $returnValue = $this->service->deleteContent($contentInfo); - $this->signalDispatcher->emit( - new DeleteContentSignal( - [ - 'contentId' => $contentInfo->id, - 'affectedLocationIds' => $returnValue, - ] - ) - ); - - return $returnValue; - } - - /** - * Creates a draft from a published or archived version. - * - * If no version is given, the current published version is used. - * 4.x: The draft is created with the initialLanguage code of the source version or if not present with the main language. - * It can be changed on updating the version. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to create the draft - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo - * @param \eZ\Publish\API\Repository\Values\User\User $user if set given user is used to create the draft - otherwise the current user is used - * - * @return \eZ\Publish\API\Repository\Values\Content\Content - the newly created content draft - */ - public function createContentDraft(ContentInfo $contentInfo, VersionInfo $versionInfo = null, User $user = null) - { - $returnValue = $this->service->createContentDraft($contentInfo, $versionInfo, $user); - $this->signalDispatcher->emit( - new CreateContentDraftSignal( - [ - 'contentId' => $contentInfo->id, - 'versionNo' => ($versionInfo !== null ? $versionInfo->versionNo : null), - 'newVersionNo' => $returnValue->getVersionInfo()->versionNo, - 'userId' => ($user !== null ? $user->id : null), - ] - ) - ); - - return $returnValue; - } - - /** - * Loads drafts for a user. - * - * If no user is given the drafts for the authenticated user a returned - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load the draft list - * - * @param \eZ\Publish\API\Repository\Values\User\User $user - * - * @return \eZ\Publish\API\Repository\Values\Content\VersionInfo[] the drafts ({@link VersionInfo}) owned by the given user - */ - public function loadContentDrafts(User $user = null) - { - return $this->service->loadContentDrafts($user); - } - - /** - * Updates the fields of a draft. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to update this version - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is not a draft - * @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException if a field in the $contentUpdateStruct is not valid - * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if a required field is set to an empty value - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if a field value is not accepted by the field type - * - * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo - * @param \eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct $contentUpdateStruct - * - * @return \eZ\Publish\API\Repository\Values\Content\Content the content draft with the updated fields - */ - public function updateContent(VersionInfo $versionInfo, ContentUpdateStruct $contentUpdateStruct) - { - $returnValue = $this->service->updateContent($versionInfo, $contentUpdateStruct); - $this->signalDispatcher->emit( - new UpdateContentSignal( - [ - 'contentId' => $versionInfo->getContentInfo()->id, - 'versionNo' => $versionInfo->versionNo, - ] - ) - ); - - return $returnValue; - } - - /** - * Publishes a content version. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to publish this version - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is not a draft - * - * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo - * @param string[] $translations - * - * @return \eZ\Publish\API\Repository\Values\Content\Content - */ - public function publishVersion(VersionInfo $versionInfo, array $translations = Language::ALL) - { - $returnValue = $this->service->publishVersion($versionInfo, $translations); - $this->signalDispatcher->emit( - new PublishVersionSignal( - [ - 'contentId' => $versionInfo->getContentInfo()->id, - 'versionNo' => $versionInfo->versionNo, - 'affectedTranslations' => $translations, - ] - ) - ); - - return $returnValue; - } - - /** - * Removes the given version. - * - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is in - * published state or is the last version of the Content - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to remove this version - * - * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo - */ - public function deleteVersion(VersionInfo $versionInfo) - { - $returnValue = $this->service->deleteVersion($versionInfo); - $this->signalDispatcher->emit( - new DeleteVersionSignal( - [ - 'contentId' => $versionInfo->contentInfo->id, - 'versionNo' => $versionInfo->versionNo, - ] - ) - ); - - return $returnValue; - } - - /** - * Loads all versions for the given content. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to list versions - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the given status is invalid - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - * @param int|null $status - * - * @return \eZ\Publish\API\Repository\Values\Content\VersionInfo[] Sorted by creation date - */ - public function loadVersions(ContentInfo $contentInfo, ?int $status = null) - { - return $this->service->loadVersions($contentInfo, $status); - } - - /** - * Copies the content to a new location. If no version is given, - * all versions are copied, otherwise only the given version. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to copy the content to the given location - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - * @param \eZ\Publish\API\Repository\Values\Content\LocationCreateStruct $destinationLocationCreateStruct the target location where the content is copied to - * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo - * - * @return \eZ\Publish\API\Repository\Values\Content\Content - */ - public function copyContent(ContentInfo $contentInfo, LocationCreateStruct $destinationLocationCreateStruct, VersionInfo $versionInfo = null) - { - $returnValue = $this->service->copyContent($contentInfo, $destinationLocationCreateStruct, $versionInfo); - $this->signalDispatcher->emit( - new CopyContentSignal( - [ - 'srcContentId' => $contentInfo->id, - 'srcVersionNo' => ($versionInfo !== null ? $versionInfo->versionNo : null), - 'dstContentId' => $returnValue->getVersionInfo()->getContentInfo()->id, - 'dstVersionNo' => $returnValue->getVersionInfo()->versionNo, - 'dstParentLocationId' => $destinationLocationCreateStruct->parentLocationId, - ] - ) - ); - - return $returnValue; - } - - /** - * Loads all outgoing relations for the given version. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read this version - * - * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo - * - * @return \eZ\Publish\API\Repository\Values\Content\Relation[] - */ - public function loadRelations(VersionInfo $versionInfo) - { - return $this->service->loadRelations($versionInfo); - } - - /** - * Loads all incoming relations for a content object. - * - * The relations come only from published versions of the source content objects - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read this version - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - * - * @return \eZ\Publish\API\Repository\Values\Content\Relation[] - */ - public function loadReverseRelations(ContentInfo $contentInfo) - { - return $this->service->loadReverseRelations($contentInfo); - } - - /** - * Adds a relation of type common. - * - * The source of the relation is the content and version - * referenced by $versionInfo. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to edit this version - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is not a draft - * - * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $sourceVersion - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $destinationContent the destination of the relation - * - * @return \eZ\Publish\API\Repository\Values\Content\Relation the newly created relation - */ - public function addRelation(VersionInfo $sourceVersion, ContentInfo $destinationContent) - { - $returnValue = $this->service->addRelation($sourceVersion, $destinationContent); - $this->signalDispatcher->emit( - new AddRelationSignal( - [ - 'srcContentId' => $sourceVersion->contentInfo->id, - 'srcVersionNo' => $sourceVersion->versionNo, - 'dstContentId' => $destinationContent->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Removes a relation of type COMMON from a draft. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed edit this version - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is not a draft - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if there is no relation of type COMMON for the given destination - * - * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $sourceVersion - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $destinationContent - */ - public function deleteRelation(VersionInfo $sourceVersion, ContentInfo $destinationContent) - { - $returnValue = $this->service->deleteRelation($sourceVersion, $destinationContent); - $this->signalDispatcher->emit( - new DeleteRelationSignal( - [ - 'srcContentId' => $sourceVersion->contentInfo->id, - 'srcVersionNo' => $sourceVersion->versionNo, - 'dstContentId' => $destinationContent->id, - ] - ) - ); - - return $returnValue; - } - - /** - * {@inheritdoc} - */ - public function removeTranslation(ContentInfo $contentInfo, $languageCode) - { - @trigger_error( - __METHOD__ . ' is deprecated, use deleteTranslation instead', - E_USER_DEPRECATED - ); - $this->deleteTranslation($contentInfo, $languageCode); - } - - /** - * Delete Content item Translation from all Versions (including archived ones) of a Content Object. - * - * NOTE: this operation is risky and permanent, so user interface should provide a warning before performing it. - * - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the specified Translation - * is the Main Translation of a Content Item. - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed - * to delete the content (in one of the locations of the given Content Item). - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if languageCode argument - * is invalid for the given content. - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - * @param string $languageCode - * - * @since 6.13 - */ - public function deleteTranslation(ContentInfo $contentInfo, $languageCode) - { - $this->service->deleteTranslation($contentInfo, $languageCode); - $this->signalDispatcher->emit( - new RemoveTranslationSignal(['contentId' => $contentInfo->id, 'languageCode' => $languageCode]) - ); - $this->signalDispatcher->emit( - new DeleteTranslationSignal(['contentId' => $contentInfo->id, 'languageCode' => $languageCode]) - ); - } - - /** - * Delete specified Translation from a Content Draft. - * - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the specified Translation - * is the only one the Content Draft has or it is the main Translation of a Content Object. - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed - * to edit the Content (in one of the locations of the given Content Object). - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if languageCode argument - * is invalid for the given Draft. - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if specified Version was not found - * - * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo Content Version Draft - * @param string $languageCode Language code of the Translation to be removed - * - * @return \eZ\Publish\API\Repository\Values\Content\Content Content Draft w/o the specified Translation - * - * @since 6.12 - */ - public function deleteTranslationFromDraft(VersionInfo $versionInfo, $languageCode) - { - return $this->service->deleteTranslationFromDraft($versionInfo, $languageCode); - } - - /** - * Bulk-load Content items by the list of ContentInfo Value Objects. - * - * Note: it does not throw exceptions on load, just ignores erroneous Content item. - * Moreover, since the method works on pre-loaded ContentInfo list, it is assumed that user is - * allowed to access every Content on the list. - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo[] $contentInfoList - * @param string[] $languages A language priority, filters returned fields and is used as prioritized language code on - * returned value object. If not given all languages are returned. - * @param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true, - * unless all languages have been asked for. - * - * @return \eZ\Publish\API\Repository\Values\Content\Content[] list of Content items with Content Ids as keys - */ - public function loadContentListByContentInfo( - array $contentInfoList, - array $languages = [], - $useAlwaysAvailable = true - ) { - return $this->service->loadContentListByContentInfo( - $contentInfoList, - $languages, - $useAlwaysAvailable - ); - } - - /** - * Hides Content by making all the Locations appear hidden. - * It does not persist hidden state on Location object itself. - * - * Content hidden by this API can be revealed by revealContent API. - * - * @see revealContent - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - */ - public function hideContent(ContentInfo $contentInfo): void - { - $this->service->hideContent($contentInfo); - $this->signalDispatcher->emit( - new HideContentSignal([ - 'contentId' => $contentInfo->id, - ]) - ); - } - - /** - * Reveals Content hidden by hideContent API. - * Locations which were hidden before hiding Content will remain hidden. - * - * @see hideContent - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - */ - public function revealContent(ContentInfo $contentInfo): void - { - $this->service->revealContent($contentInfo); - $this->signalDispatcher->emit( - new RevealContentSignal([ - 'contentId' => $contentInfo->id, - ]) - ); - } - - /** - * Instantiates a new content create struct object. - * - * alwaysAvailable is set to the ContentType's defaultAlwaysAvailable - * - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType - * @param string $mainLanguageCode - * - * @return \eZ\Publish\API\Repository\Values\Content\ContentCreateStruct - */ - public function newContentCreateStruct(ContentType $contentType, $mainLanguageCode) - { - return $this->service->newContentCreateStruct($contentType, $mainLanguageCode); - } - - /** - * Instantiates a new content meta data update struct. - * - * @return \eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct - */ - public function newContentMetadataUpdateStruct() - { - return $this->service->newContentMetadataUpdateStruct(); - } - - /** - * Instantiates a new content update struct. - * - * @return \eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct - */ - public function newContentUpdateStruct() - { - return $this->service->newContentUpdateStruct(); - } -} diff --git a/eZ/Publish/Core/SignalSlot/FieldTypeService.php b/eZ/Publish/Core/SignalSlot/FieldTypeService.php deleted file mode 100644 index 7e8fcc888b9..00000000000 --- a/eZ/Publish/Core/SignalSlot/FieldTypeService.php +++ /dev/null @@ -1,83 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * Returns a list of all field types. - * - * @return \eZ\Publish\API\Repository\FieldType[] - */ - public function getFieldTypes() - { - return $this->service->getFieldTypes(); - } - - /** - * Returns the FieldType registered with the given identifier. - * - * @param string $identifier - * - * @return \eZ\Publish\API\Repository\FieldType - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - * if there is no FieldType registered with $identifier - */ - public function getFieldType($identifier) - { - return $this->service->getFieldType($identifier); - } - - /** - * Returns if there is a FieldType registered under $identifier. - * - * @param string $identifier - * - * @return bool - */ - public function hasFieldType($identifier) - { - return $this->service->hasFieldType($identifier); - } -} diff --git a/eZ/Publish/Core/SignalSlot/LanguageService.php b/eZ/Publish/Core/SignalSlot/LanguageService.php deleted file mode 100644 index f701907b0bf..00000000000 --- a/eZ/Publish/Core/SignalSlot/LanguageService.php +++ /dev/null @@ -1,246 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * Creates the a new Language in the content repository. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If user does not have access to content translations - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the languageCode already exists - * - * @param \eZ\Publish\API\Repository\Values\Content\LanguageCreateStruct $languageCreateStruct - * - * @return \eZ\Publish\API\Repository\Values\Content\Language - */ - public function createLanguage(LanguageCreateStruct $languageCreateStruct) - { - $returnValue = $this->service->createLanguage($languageCreateStruct); - $this->signalDispatcher->emit( - new CreateLanguageSignal( - [ - 'languageId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Changes the name of the language in the content repository. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If user does not have access to content translations - * - * @param \eZ\Publish\API\Repository\Values\Content\Language $language - * @param string $newName - * - * @return \eZ\Publish\API\Repository\Values\Content\Language - */ - public function updateLanguageName(Language $language, $newName) - { - $returnValue = $this->service->updateLanguageName($language, $newName); - $this->signalDispatcher->emit( - new UpdateLanguageNameSignal( - [ - 'languageId' => $language->id, - 'newName' => $newName, - ] - ) - ); - - return $returnValue; - } - - /** - * Enables a language. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If user does not have access to content translations - * - * @param \eZ\Publish\API\Repository\Values\Content\Language $language - * - * @return \eZ\Publish\API\Repository\Values\Content\Language - */ - public function enableLanguage(Language $language) - { - $returnValue = $this->service->enableLanguage($language); - $this->signalDispatcher->emit( - new EnableLanguageSignal( - [ - 'languageId' => $language->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Disables a language. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If user does not have access to content translations - * - * @param \eZ\Publish\API\Repository\Values\Content\Language $language - * - * @return \eZ\Publish\API\Repository\Values\Content\Language - */ - public function disableLanguage(Language $language) - { - $returnValue = $this->service->disableLanguage($language); - $this->signalDispatcher->emit( - new DisableLanguageSignal( - [ - 'languageId' => $language->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Loads a Language from its language code ($languageCode). - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if language could not be found - * - * @param string $languageCode - * - * @return \eZ\Publish\API\Repository\Values\Content\Language - */ - public function loadLanguage($languageCode) - { - return $this->service->loadLanguage($languageCode); - } - - /** - * Loads all Languages. - * - * @return \eZ\Publish\API\Repository\Values\Content\Language[] - */ - public function loadLanguages() - { - return $this->service->loadLanguages(); - } - - /** - * Loads a Language by its id ($languageId). - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if language could not be found - * - * @param mixed $languageId - * - * @return \eZ\Publish\API\Repository\Values\Content\Language - */ - public function loadLanguageById($languageId) - { - return $this->service->loadLanguageById($languageId); - } - - /** - * {@inheritdoc} - */ - public function loadLanguageListByCode(array $languageCodes): iterable - { - return $this->service->loadLanguageListByCode($languageCodes); - } - - /** - * {@inheritdoc} - */ - public function loadLanguageListById(array $languageIds): iterable - { - return $this->service->loadLanguageListById($languageIds); - } - - /** - * Deletes a language from content repository. - * - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException - * if language can not be deleted - * because it is still assigned to some content / type / (...). - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If user is not allowed to delete a language - * - * @param \eZ\Publish\API\Repository\Values\Content\Language $language - */ - public function deleteLanguage(Language $language) - { - $returnValue = $this->service->deleteLanguage($language); - $this->signalDispatcher->emit( - new DeleteLanguageSignal( - [ - 'languageId' => $language->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Returns a configured default language code. - * - * @return string - */ - public function getDefaultLanguageCode() - { - return $this->service->getDefaultLanguageCode(); - } - - /** - * Instantiates an object to be used for creating languages. - * - * @return \eZ\Publish\API\Repository\Values\Content\LanguageCreateStruct - */ - public function newLanguageCreateStruct() - { - return $this->service->newLanguageCreateStruct(); - } -} diff --git a/eZ/Publish/Core/SignalSlot/LocationService.php b/eZ/Publish/Core/SignalSlot/LocationService.php deleted file mode 100644 index b4f5edc33a6..00000000000 --- a/eZ/Publish/Core/SignalSlot/LocationService.php +++ /dev/null @@ -1,384 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * Copies the subtree starting from $subtree as a new subtree of $targetLocation. - * - * Only the items on which the user has read access are copied. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed copy the subtree to the given parent location - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user does not have read access to the whole source subtree - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the target location is a sub location of the given location - * - * @param \eZ\Publish\API\Repository\Values\Content\Location $subtree - the subtree denoted by the location to copy - * @param \eZ\Publish\API\Repository\Values\Content\Location $targetParentLocation - the target parent location for the copy operation - * - * @return \eZ\Publish\API\Repository\Values\Content\Location The newly created location of the copied subtree - */ - public function copySubtree(Location $subtree, Location $targetParentLocation) - { - $returnValue = $this->service->copySubtree($subtree, $targetParentLocation); - $this->signalDispatcher->emit( - new CopySubtreeSignal( - [ - 'subtreeId' => $subtree->id, - 'targetParentLocationId' => $targetParentLocation->id, - 'targetNewSubtreeId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * {@inheritdoc} - */ - public function loadLocation($locationId, array $prioritizedLanguages = null, bool $useAlwaysAvailable = null) - { - return $this->service->loadLocation($locationId, $prioritizedLanguages, $useAlwaysAvailable); - } - - /** - * {@inheritdoc} - */ - public function loadLocationList(array $locationIds, array $prioritizedLanguages = null, bool $useAlwaysAvailable = null): iterable - { - return $this->service->loadLocationList($locationIds, $prioritizedLanguages, $useAlwaysAvailable); - } - - /** - * {@inheritdoc} - */ - public function loadLocationByRemoteId($remoteId, array $prioritizedLanguages = null, bool $useAlwaysAvailable = null) - { - return $this->service->loadLocationByRemoteId($remoteId, $prioritizedLanguages, $useAlwaysAvailable); - } - - /** - * {@inheritdoc} - */ - public function loadLocations(ContentInfo $contentInfo, Location $rootLocation = null, array $prioritizedLanguages = null) - { - return $this->service->loadLocations($contentInfo, $rootLocation, $prioritizedLanguages); - } - - /** - * {@inheritdoc} - */ - public function loadLocationChildren(Location $location, $offset = 0, $limit = 25, array $prioritizedLanguages = null) - { - return $this->service->loadLocationChildren($location, $offset, $limit, $prioritizedLanguages); - } - - /** - * {@inheritdoc} - */ - public function loadParentLocationsForDraftContent(VersionInfo $versionInfo, array $prioritizedLanguages = null) - { - return $this->service->loadParentLocationsForDraftContent($versionInfo, $prioritizedLanguages); - } - - /** - * Returns the number of children which are readable by the current user of a location object. - * - * @param \eZ\Publish\API\Repository\Values\Content\Location $location - * - * @return int - */ - public function getLocationChildCount(Location $location) - { - return $this->service->getLocationChildCount($location); - } - - /** - * Creates the new $location in the content repository for the given content. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to create this location - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the content is already below the specified parent - * or the parent is a sub location of the location of the content - * or if set the remoteId exists already - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - * @param \eZ\Publish\API\Repository\Values\Content\LocationCreateStruct $locationCreateStruct - * - * @return \eZ\Publish\API\Repository\Values\Content\Location the newly created Location - */ - public function createLocation(ContentInfo $contentInfo, LocationCreateStruct $locationCreateStruct) - { - $returnValue = $this->service->createLocation($contentInfo, $locationCreateStruct); - $this->signalDispatcher->emit( - new CreateLocationSignal( - [ - 'contentId' => $contentInfo->id, - 'locationId' => $returnValue->id, - 'parentLocationId' => $returnValue->parentLocationId, - ] - ) - ); - - return $returnValue; - } - - /** - * Updates $location in the content repository. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to update this location - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if if set the remoteId exists already - * - * @param \eZ\Publish\API\Repository\Values\Content\Location $location - * @param \eZ\Publish\API\Repository\Values\Content\LocationUpdateStruct $locationUpdateStruct - * - * @return \eZ\Publish\API\Repository\Values\Content\Location the updated Location - */ - public function updateLocation(Location $location, LocationUpdateStruct $locationUpdateStruct) - { - $returnValue = $this->service->updateLocation($location, $locationUpdateStruct); - $this->signalDispatcher->emit( - new UpdateLocationSignal( - [ - 'contentId' => $location->contentId, - 'locationId' => $location->id, - 'parentLocationId' => $location->parentLocationId, - ] - ) - ); - - return $returnValue; - } - - /** - * Swaps the contents held by $location1 and $location2. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to swap content - * - * @param \eZ\Publish\API\Repository\Values\Content\Location $location1 - * @param \eZ\Publish\API\Repository\Values\Content\Location $location2 - */ - public function swapLocation(Location $location1, Location $location2) - { - $returnValue = $this->service->swapLocation($location1, $location2); - $this->signalDispatcher->emit( - new SwapLocationSignal( - [ - 'location1Id' => $location1->id, - 'content1Id' => $location1->contentId, - 'parentLocation1Id' => $location1->parentLocationId, - 'location2Id' => $location2->id, - 'content2Id' => $location2->contentId, - 'parentLocation2Id' => $location2->parentLocationId, - ] - ) - ); - - return $returnValue; - } - - /** - * Hides the $location and marks invisible all descendants of $location. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to hide this location - * - * @param \eZ\Publish\API\Repository\Values\Content\Location $location - * - * @return \eZ\Publish\API\Repository\Values\Content\Location $location, with updated hidden value - */ - public function hideLocation(Location $location) - { - $returnValue = $this->service->hideLocation($location); - $this->signalDispatcher->emit( - new HideLocationSignal( - [ - 'locationId' => $location->id, - 'contentId' => $location->contentId, - 'currentVersionNo' => $returnValue->getContentInfo()->currentVersionNo, - 'parentLocationId' => $returnValue->parentLocationId, - ] - ) - ); - - return $returnValue; - } - - /** - * Unhides the $location. - * - * This method and marks visible all descendants of $locations - * until a hidden location is found. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to unhide this location - * - * @param \eZ\Publish\API\Repository\Values\Content\Location $location - * - * @return \eZ\Publish\API\Repository\Values\Content\Location $location, with updated hidden value - */ - public function unhideLocation(Location $location) - { - $returnValue = $this->service->unhideLocation($location); - $this->signalDispatcher->emit( - new UnhideLocationSignal( - [ - 'locationId' => $location->id, - 'contentId' => $location->contentId, - 'currentVersionNo' => $returnValue->getContentInfo()->currentVersionNo, - 'parentLocationId' => $returnValue->parentLocationId, - ] - ) - ); - - return $returnValue; - } - - /** - * Moves the subtree to $newParentLocation. - * - * If a user has the permission to move the location to a target location - * he can do it regardless of an existing descendant on which the user has no permission. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to move this location to the target - * - * @param \eZ\Publish\API\Repository\Values\Content\Location $location - * @param \eZ\Publish\API\Repository\Values\Content\Location $newParentLocation - */ - public function moveSubtree(Location $location, Location $newParentLocation) - { - $returnValue = $this->service->moveSubtree($location, $newParentLocation); - $this->signalDispatcher->emit( - new MoveSubtreeSignal( - [ - 'locationId' => $location->id, - 'newParentLocationId' => $newParentLocation->id, - 'oldParentLocationId' => $location->parentLocationId, - ] - ) - ); - - return $returnValue; - } - - /** - * Deletes $location and all its descendants. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user is not allowed to delete this location or a descendant - * - * @param \eZ\Publish\API\Repository\Values\Content\Location $location - */ - public function deleteLocation(Location $location) - { - $this->service->deleteLocation($location); - $this->signalDispatcher->emit( - new DeleteLocationSignal( - [ - 'contentId' => $location->contentId, - 'locationId' => $location->id, - 'parentLocationId' => $location->parentLocationId, - ] - ) - ); - } - - /** - * Instantiates a new location create class. - * - * @param mixed $parentLocationId the parent under which the new location should be created - * @param eZ\Publish\API\Repository\Values\ContentType\ContentType|null $contentType - * - * @return \eZ\Publish\API\Repository\Values\Content\LocationCreateStruct - */ - public function newLocationCreateStruct($parentLocationId, ContentType $contentType = null) - { - return $this->service->newLocationCreateStruct($parentLocationId, $contentType); - } - - /** - * Instantiates a new location update class. - * - * @return \eZ\Publish\API\Repository\Values\Content\LocationUpdateStruct - */ - public function newLocationUpdateStruct() - { - return $this->service->newLocationUpdateStruct(); - } - - /** - * Get the total number of all existing Locations. Can be combined with loadAllLocations. - * - * @see loadAllLocations - * - * @return int Total number of Locations - */ - public function getAllLocationsCount(): int - { - return $this->service->getAllLocationsCount(); - } - - /** - * Bulk-load all existing Locations, constrained by $limit and $offset to paginate results. - * - * @param int $limit - * @param int $offset - * - * @return \eZ\Publish\API\Repository\Values\Content\Location[] - */ - public function loadAllLocations(int $offset = 0, int $limit = 25): array - { - return $this->service->loadAllLocations($offset, $limit); - } -} diff --git a/eZ/Publish/Core/SignalSlot/NotificationService.php b/eZ/Publish/Core/SignalSlot/NotificationService.php deleted file mode 100644 index 39f8a0cc7c1..00000000000 --- a/eZ/Publish/Core/SignalSlot/NotificationService.php +++ /dev/null @@ -1,106 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * {@inheritdoc} - */ - public function loadNotifications(int $offset, int $limit): NotificationList - { - return $this->service->loadNotifications($offset, $limit); - } - - /** - * {@inheritdoc} - */ - public function getNotification(int $notificationId): Notification - { - return $this->service->getNotification($notificationId); - } - - /** - * {@inheritdoc} - */ - public function markNotificationAsRead(Notification $notification): void - { - $this->signalDispatcher->emit(new NotificationReadSignal([ - 'notificationId' => $notification->id, - ])); - - $this->service->markNotificationAsRead($notification); - } - - /** - * {@inheritdoc} - */ - public function getPendingNotificationCount(): int - { - return $this->service->getPendingNotificationCount(); - } - - /** - * {@inheritdoc} - */ - public function getNotificationCount(): int - { - return $this->service->getNotificationCount(); - } - - /** - * {@inheritdoc} - */ - public function deleteNotification(Notification $notification): void - { - $this->signalDispatcher->emit(new NotificationDeleteSignal([ - 'notificationId' => $notification->id, - ])); - - $this->service->deleteNotification($notification); - } - - /** - * {@inheritdoc} - */ - public function createNotification(CreateStruct $createStruct): Notification - { - $this->signalDispatcher->emit(new NotificationCreateSignal([ - 'ownerId' => $createStruct->ownerId, - 'type' => $createStruct->type, - 'data' => $createStruct->data, - ])); - - return $this->service->createNotification($createStruct); - } -} diff --git a/eZ/Publish/Core/SignalSlot/ObjectStateService.php b/eZ/Publish/Core/SignalSlot/ObjectStateService.php deleted file mode 100644 index 7bd55c4634f..00000000000 --- a/eZ/Publish/Core/SignalSlot/ObjectStateService.php +++ /dev/null @@ -1,359 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * Creates a new object state group. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to create an object state group - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the object state group with provided identifier already exists - * - * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupCreateStruct $objectStateGroupCreateStruct - * - * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup - */ - public function createObjectStateGroup(ObjectStateGroupCreateStruct $objectStateGroupCreateStruct) - { - $returnValue = $this->service->createObjectStateGroup($objectStateGroupCreateStruct); - $this->signalDispatcher->emit( - new CreateObjectStateGroupSignal( - [ - 'objectStateGroupId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * {@inheritdoc} - */ - public function loadObjectStateGroup($objectStateGroupId, array $prioritizedLanguages = []) - { - return $this->service->loadObjectStateGroup($objectStateGroupId, $prioritizedLanguages); - } - - /** - * {@inheritdoc} - */ - public function loadObjectStateGroups($offset = 0, $limit = -1, array $prioritizedLanguages = []) - { - return $this->service->loadObjectStateGroups($offset, $limit, $prioritizedLanguages); - } - - /** - * {@inheritdoc} - */ - public function loadObjectStates(ObjectStateGroup $objectStateGroup, array $prioritizedLanguages = []) - { - return $this->service->loadObjectStates($objectStateGroup, $prioritizedLanguages); - } - - /** - * Updates an object state group. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to update an object state group - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the object state group with provided identifier already exists - * - * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup - * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct - * - * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup - */ - public function updateObjectStateGroup(ObjectStateGroup $objectStateGroup, ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct) - { - $returnValue = $this->service->updateObjectStateGroup($objectStateGroup, $objectStateGroupUpdateStruct); - $this->signalDispatcher->emit( - new UpdateObjectStateGroupSignal( - [ - 'objectStateGroupId' => $objectStateGroup->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Deletes a object state group including all states and links to content. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to delete an object state group - * - * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup - */ - public function deleteObjectStateGroup(ObjectStateGroup $objectStateGroup) - { - $returnValue = $this->service->deleteObjectStateGroup($objectStateGroup); - $this->signalDispatcher->emit( - new DeleteObjectStateGroupSignal( - [ - 'objectStateGroupId' => $objectStateGroup->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Creates a new object state in the given group. - * - * Note: in current kernel: If it is the first state all content objects will - * set to this state. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to create an object state - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the object state with provided identifier already exists in the same group - * - * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup - * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateCreateStruct $objectStateCreateStruct - * - * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectState - */ - public function createObjectState(ObjectStateGroup $objectStateGroup, ObjectStateCreateStruct $objectStateCreateStruct) - { - $returnValue = $this->service->createObjectState($objectStateGroup, $objectStateCreateStruct); - $this->signalDispatcher->emit( - new CreateObjectStateSignal( - [ - 'objectStateGroupId' => $objectStateGroup->id, - 'objectStateId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * {@inheritdoc} - */ - public function loadObjectState($stateId, array $prioritizedLanguages = []) - { - return $this->service->loadObjectState($stateId, $prioritizedLanguages); - } - - /** - * Updates an object state. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to update an object state - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the object state with provided identifier already exists in the same group - * - * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectState $objectState - * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateUpdateStruct $objectStateUpdateStruct - * - * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectState - */ - public function updateObjectState(ObjectState $objectState, ObjectStateUpdateStruct $objectStateUpdateStruct) - { - $returnValue = $this->service->updateObjectState($objectState, $objectStateUpdateStruct); - $this->signalDispatcher->emit( - new UpdateObjectStateSignal( - [ - 'objectStateId' => $objectState->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Changes the priority of the state. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to change priority on an object state - * - * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectState $objectState - * @param int $priority - */ - public function setPriorityOfObjectState(ObjectState $objectState, $priority) - { - $returnValue = $this->service->setPriorityOfObjectState($objectState, $priority); - $this->signalDispatcher->emit( - new SetPriorityOfObjectStateSignal( - [ - 'objectStateId' => $objectState->id, - 'priority' => $priority, - ] - ) - ); - - return $returnValue; - } - - /** - * Deletes a object state. The state of the content objects is reset to the - * first object state in the group. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to delete an object state - * - * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectState $objectState - */ - public function deleteObjectState(ObjectState $objectState) - { - $returnValue = $this->service->deleteObjectState($objectState); - $this->signalDispatcher->emit( - new DeleteObjectStateSignal( - [ - 'objectStateId' => $objectState->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Sets the object-state of a state group to $state for the given content. - * - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the object state does not belong to the given group - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to change the object state - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup - * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectState $objectState - */ - public function setContentState(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup, ObjectState $objectState) - { - $returnValue = $this->service->setContentState($contentInfo, $objectStateGroup, $objectState); - $this->signalDispatcher->emit( - new SetContentStateSignal( - [ - 'contentId' => $contentInfo->id, - 'objectStateGroupId' => $objectStateGroup->id, - 'objectStateId' => $objectState->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Gets the object-state of object identified by $contentId. - * - * The $state is the id of the state within one group. - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup - * - * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectState - */ - public function getContentState(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup) - { - return $this->service->getContentState($contentInfo, $objectStateGroup); - } - - /** - * Returns the number of objects which are in this state. - * - * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectState $objectState - * - * @return int - */ - public function getContentCount(ObjectState $objectState) - { - return $this->service->getContentCount($objectState); - } - - /** - * Instantiates a new Object State Group Create Struct and sets $identified in it. - * - * @param string $identifier - * - * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupCreateStruct - */ - public function newObjectStateGroupCreateStruct($identifier) - { - return $this->service->newObjectStateGroupCreateStruct($identifier); - } - - /** - * Instantiates a new Object State Group Update Struct. - * - * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupUpdateStruct - */ - public function newObjectStateGroupUpdateStruct() - { - return $this->service->newObjectStateGroupUpdateStruct(); - } - - /** - * Instantiates a new Object State Create Struct and sets $identifier in it. - * - * @param string $identifier - * - * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateCreateStruct - */ - public function newObjectStateCreateStruct($identifier) - { - return $this->service->newObjectStateCreateStruct($identifier); - } - - /** - * Instantiates a new Object State Update Struct. - * - * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateUpdateStruct - */ - public function newObjectStateUpdateStruct() - { - return $this->service->newObjectStateUpdateStruct(); - } -} diff --git a/eZ/Publish/Core/SignalSlot/Repository.php b/eZ/Publish/Core/SignalSlot/Repository.php deleted file mode 100644 index eb3c32d5af6..00000000000 --- a/eZ/Publish/Core/SignalSlot/Repository.php +++ /dev/null @@ -1,549 +0,0 @@ -signalDispatcher = $signalDispatcher; - $this->repository = $repository; - $this->contentService = $contentService; - $this->contentTypeService = $contentTypeService; - $this->fieldTypeService = $fieldTypeService; - $this->roleService = $roleService; - $this->objectStateService = $objectStateService; - $this->urlWildcardService = $urlWildcardService; - $this->urlAliasService = $urlAliasService; - $this->userService = $userService; - $this->searchService = $searchService; - $this->sectionService = $sectionService; - $this->trashService = $trashService; - $this->locationService = $locationService; - $this->languageService = $languageService; - $this->urlService = $urlService; - $this->bookmarkService = $bookmarkService; - $this->notificationService = $notificationService; - $this->userPreferenceService = $userPreferenceService; - } - - /** - * @deprecated since 6.6, to be removed. Use PermissionResolver::getCurrentUserReference() instead. - * - * Get current user. - * - * @return \eZ\Publish\API\Repository\Values\User\User - */ - public function getCurrentUser() - { - return $this->repository->getCurrentUser(); - } - - /** - * @deprecated since 6.6, to be removed. Use PermissionResolver::getCurrentUserReference() instead. - * - * Get current user ref. - * - * @return \eZ\Publish\API\Repository\Values\User\UserReference - */ - public function getCurrentUserReference() - { - return $this->repository->getCurrentUserReference(); - } - - /** - * @deprecated since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() instead. - * - * Sets the current user to the given $user. - * - * @param \eZ\Publish\API\Repository\Values\User\UserReference $user - */ - public function setCurrentUser(UserReference $user) - { - return $this->repository->setCurrentUser($user); - } - - /** - * {@inheritdoc} - */ - public function sudo(callable $callback, RepositoryInterface $outerRepository = null) - { - return $this->repository->sudo($callback, $outerRepository ?? $this); - } - - /** - * @deprecated since 6.6, to be removed. Use PermissionResolver::hasAccess() instead. - * - * Check if user has access to a given module / function. - * - * Low level function, use canUser instead if you have objects to check against. - * - * @param string $module - * @param string $function - * @param \eZ\Publish\API\Repository\Values\User\UserReference $user - * - * @return bool|array Bool if user has full or no access, array if limitations if not - */ - public function hasAccess($module, $function, UserReference $user = null) - { - return $this->repository->hasAccess($module, $function, $user); - } - - /** - * @deprecated since 6.6, to be removed. Use PermissionResolver::canUser() instead. - * - * Check if user has access to a given action on a given value object. - * - * Indicates if the current user is allowed to perform an action given by the function on the given - * objects. - * - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If any of the arguments are invalid - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException If value of the LimitationValue is unsupported - * - * @param string $module The module, aka controller identifier to check permissions on - * @param string $function The function, aka the controller action to check permissions on - * @param \eZ\Publish\API\Repository\Values\ValueObject $object The object to check if the user has access to - * @param mixed $targets The location, parent or "assignment" value object, or an array of the same - * - * @return bool - */ - public function canUser($module, $function, ValueObject $object, $targets = null) - { - return $this->repository->canUser($module, $function, $object, $targets); - } - - /** - * Get Content Service. - * - * Get service object to perform operations on Content objects and it's aggregate members. - * - * @return \eZ\Publish\API\Repository\ContentService - */ - public function getContentService() - { - return $this->contentService; - } - - /** - * Get Content Language Service. - * - * Get service object to perform operations on Content language objects - * - * @return \eZ\Publish\API\Repository\LanguageService - */ - public function getContentLanguageService() - { - return $this->languageService; - } - - /** - * Get Content Type Service. - * - * Get service object to perform operations on Content Type objects and it's aggregate members. - * ( Group, Field & FieldCategory ) - * - * @return \eZ\Publish\API\Repository\ContentTypeService - */ - public function getContentTypeService() - { - return $this->contentTypeService; - } - - /** - * Get Content Location Service. - * - * Get service object to perform operations on Location objects and subtrees - * - * @return \eZ\Publish\API\Repository\LocationService - */ - public function getLocationService() - { - return $this->locationService; - } - - /** - * Get Content Trash service. - * - * Trash service allows to perform operations related to location trash - * (trash/untrash, load/list from trash...) - * - * @return \eZ\Publish\API\Repository\TrashService - */ - public function getTrashService() - { - return $this->trashService; - } - - /** - * Get Content Section Service. - * - * Get Section service that lets you manipulate section objects - * - * @return \eZ\Publish\API\Repository\SectionService - */ - public function getSectionService() - { - return $this->sectionService; - } - - /** - * Get User Service. - * - * Get service object to perform operations on Users and UserGroup - * - * @return \eZ\Publish\API\Repository\UserService - */ - public function getUserService() - { - return $this->userService; - } - - /** - * Get URLAliasService. - * - * @return \eZ\Publish\API\Repository\URLAliasService - */ - public function getURLAliasService() - { - return $this->urlAliasService; - } - - /** - * Get URLWildcardService. - * - * @return \eZ\Publish\API\Repository\URLWildcardService - */ - public function getURLWildcardService() - { - return $this->urlWildcardService; - } - - /** - * Get URLService. - * - * @return \eZ\Publish\API\Repository\URLService - */ - public function getURLService() - { - return $this->urlService; - } - - /** - * Get BookmarkService. - * - * @return \eZ\Publish\API\Repository\BookmarkService - */ - public function getBookmarkService() - { - return $this->bookmarkService; - } - - /** - * Get NotificationService. - * - * @return \eZ\Publish\API\Repository\NotificationService - */ - public function getNotificationService() - { - return $this->notificationService; - } - - /** - * Get UserPreferenceService. - * - * @return \eZ\Publish\API\Repository\UserPreferenceService - */ - public function getUserPreferenceService() - { - return $this->userPreferenceService; - } - - /** - * Get ObjectStateService. - * - * @return \eZ\Publish\API\Repository\ObjectStateService - */ - public function getObjectStateService() - { - return $this->objectStateService; - } - - /** - * Get RoleService. - * - * @return \eZ\Publish\API\Repository\RoleService - */ - public function getRoleService() - { - return $this->roleService; - } - - /** - * Get SearchService. - * - * @return \eZ\Publish\API\Repository\SearchService - */ - public function getSearchService() - { - return $this->searchService; - } - - /** - * Get FieldTypeService. - * - * @return \eZ\Publish\API\Repository\FieldTypeService - */ - public function getFieldTypeService() - { - return $this->fieldTypeService; - } - - /** - * Get PermissionResolver. - * - * @return \eZ\Publish\API\Repository\PermissionResolver - */ - public function getPermissionResolver() - { - return $this->repository->getPermissionResolver(); - } - - /** - * Begin transaction. - * - * Begins an transaction, make sure you'll call commit or rollback when done, - * otherwise work will be lost. - */ - public function beginTransaction() - { - $return = $this->repository->beginTransaction(); - - if ($this->signalDispatcher instanceof TransactionHandler) { - $this->signalDispatcher->beginTransaction(); - } - - return $return; - } - - /** - * Commit transaction. - * - * Commit transaction, or throw exceptions if no transactions has been started. - * - * @throws \RuntimeException If no transaction has been started - */ - public function commit() - { - $return = $this->repository->commit(); - - if ($this->signalDispatcher instanceof TransactionHandler) { - $this->signalDispatcher->commit(); - } - - return $return; - } - - /** - * Rollback transaction. - * - * Rollback transaction, or throw exceptions if no transactions has been started. - * - * @throws \RuntimeException If no transaction has been started - */ - public function rollback() - { - if ($this->signalDispatcher instanceof TransactionHandler) { - $this->signalDispatcher->rollback(); - } - - return $this->repository->rollback(); - } -} diff --git a/eZ/Publish/Core/SignalSlot/RoleService.php b/eZ/Publish/Core/SignalSlot/RoleService.php deleted file mode 100644 index ebd9d27a7db..00000000000 --- a/eZ/Publish/Core/SignalSlot/RoleService.php +++ /dev/null @@ -1,761 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * Creates a new RoleDraft. - * - * @since 6.0 - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to create a role - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException - * if the name of the role already exists or if limitation of the same type - * is repeated in the policy create struct or if limitation is not allowed on module/function - * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if a policy limitation in the $roleCreateStruct is not valid - * - * @param \eZ\Publish\API\Repository\Values\User\RoleCreateStruct $roleCreateStruct - * - * @return \eZ\Publish\API\Repository\Values\User\RoleDraft - */ - public function createRole(RoleCreateStruct $roleCreateStruct) - { - $returnValue = $this->service->createRole($roleCreateStruct); - $this->signalDispatcher->emit( - new CreateRoleSignal( - [ - 'roleId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Creates a new RoleDraft for existing Role. - * - * @since 6.0 - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to create a role - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the Role already has a Role Draft that will need to be removed first - * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if a policy limitation in the $roleCreateStruct is not valid - * - * @param \eZ\Publish\API\Repository\Values\User\Role $role - * - * @return \eZ\Publish\API\Repository\Values\User\RoleDraft - */ - public function createRoleDraft(Role $role) - { - $returnValue = $this->service->createRoleDraft($role); - $this->signalDispatcher->emit( - new CreateRoleDraftSignal( - [ - 'roleId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Loads a role for the given id. - * - * @since 6.0 - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read this role - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a role with the given id was not found - * - * @param mixed $id - * - * @return \eZ\Publish\API\Repository\Values\User\RoleDraft - */ - public function loadRoleDraft($id) - { - return $this->service->loadRoleDraft($id); - } - - /** - * Loads a RoleDraft by the ID of the role it was created from. - * - * @param mixed $roleId ID of the role the draft was created from. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read this role - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a RoleDraft with the given id was not found - * - * @return \eZ\Publish\API\Repository\Values\User\RoleDraft - */ - public function loadRoleDraftByRoleId($roleId) - { - return $this->service->loadRoleDraftByRoleId($roleId); - } - - /** - * Updates the properties of a role draft. - * - * @since 6.0 - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to update a role - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the identifier of the role already exists - * - * @param \eZ\Publish\API\Repository\Values\User\RoleDraft $roleDraft - * @param \eZ\Publish\API\Repository\Values\User\RoleUpdateStruct $roleUpdateStruct - * - * @return \eZ\Publish\API\Repository\Values\User\RoleDraft - */ - public function updateRoleDraft(RoleDraft $roleDraft, RoleUpdateStruct $roleUpdateStruct) - { - $returnValue = $this->service->updateRoleDraft($roleDraft, $roleUpdateStruct); - $this->signalDispatcher->emit( - new UpdateRoleDraftSignal( - [ - 'roleId' => $roleDraft->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Adds a new policy to the role draft. - * - * @since 6.0 - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to add a policy - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if limitation of the same type is repeated in policy create - * struct or if limitation is not allowed on module/function - * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if a limitation in the $policyCreateStruct is not valid - * - * @param \eZ\Publish\API\Repository\Values\User\RoleDraft $roleDraft - * @param \eZ\Publish\API\Repository\Values\User\PolicyCreateStruct $policyCreateStruct - * - * @return \eZ\Publish\API\Repository\Values\User\RoleDraft - */ - public function addPolicyByRoleDraft(RoleDraft $roleDraft, PolicyCreateStruct $policyCreateStruct) - { - $returnValue = $this->service->addPolicyByRoleDraft($roleDraft, $policyCreateStruct); - $this->signalDispatcher->emit( - new AddPolicyByRoleDraftSignal( - [ - 'roleId' => $roleDraft->id, - 'policyId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Removes a policy from a role draft. - * - * @since 6.0 - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove a policy - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if policy does not belong to the given RoleDraft - * - * @param \eZ\Publish\API\Repository\Values\User\RoleDraft $roleDraft - * @param PolicyDraft $policyDraft the policy to remove from the role - * @return RoleDraft if the authenticated user is not allowed to remove a policy - */ - public function removePolicyByRoleDraft(RoleDraft $roleDraft, PolicyDraft $policyDraft) - { - $returnValue = $this->service->removePolicyByRoleDraft($roleDraft, $policyDraft); - $this->signalDispatcher->emit( - new RemovePolicyByRoleDraftSignal( - [ - 'roleId' => $roleDraft->id, - 'policyId' => $policyDraft->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Updates the limitations of a policy. The module and function cannot be changed and - * the limitations are replaced by the ones in $roleUpdateStruct. - * - * @since 6.0 - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to update a policy - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if limitation of the same type is repeated in policy update - * struct or if limitation is not allowed on module/function - * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if a limitation in the $policyUpdateStruct is not valid - * - * @param \eZ\Publish\API\Repository\Values\User\RoleDraft $roleDraft - * @param \eZ\Publish\API\Repository\Values\User\PolicyDraft $policy - * @param \eZ\Publish\API\Repository\Values\User\PolicyUpdateStruct $policyUpdateStruct - * - * @return \eZ\Publish\API\Repository\Values\User\PolicyDraft - */ - public function updatePolicyByRoleDraft(RoleDraft $roleDraft, PolicyDraft $policy, PolicyUpdateStruct $policyUpdateStruct) - { - $returnValue = $this->service->updatePolicyByRoleDraft($roleDraft, $policy, $policyUpdateStruct); - $this->signalDispatcher->emit( - new UpdatePolicySignal( - [ - 'policyId' => $policy->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Deletes the given role draft. - * - * @since 6.0 - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to delete this role - * - * @param \eZ\Publish\API\Repository\Values\User\RoleDraft $roleDraft - */ - public function deleteRoleDraft(RoleDraft $roleDraft) - { - $returnValue = $this->service->deleteRoleDraft($roleDraft); - $this->signalDispatcher->emit( - new DeleteRoleDraftSignal( - [ - 'roleId' => $roleDraft->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Publishes a given Role draft. - * - * @since 6.0 - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to publish this role - * - * @param \eZ\Publish\API\Repository\Values\User\RoleDraft $roleDraft - */ - public function publishRoleDraft(RoleDraft $roleDraft) - { - $returnValue = $this->service->publishRoleDraft($roleDraft); - $this->signalDispatcher->emit( - new PublishRoleDraftSignal( - [ - 'roleId' => $roleDraft->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Updates the name of the role. - * - * @deprecated since 6.0, use {@see updateRoleDraft} - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to update a role - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the name of the role already exists - * - * @param \eZ\Publish\API\Repository\Values\User\Role $role - * @param \eZ\Publish\API\Repository\Values\User\RoleUpdateStruct $roleUpdateStruct - * - * @return \eZ\Publish\API\Repository\Values\User\Role - */ - public function updateRole(Role $role, RoleUpdateStruct $roleUpdateStruct) - { - $returnValue = $this->service->updateRole($role, $roleUpdateStruct); - $this->signalDispatcher->emit( - new UpdateRoleSignal( - [ - 'roleId' => $role->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Adds a new policy to the role. - * - * @deprecated since 6.0, use {@see addPolicyByRoleDraft} - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to add a policy - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if limitation of the same type is repeated in policy create - * struct or if limitation is not allowed on module/function - * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if a limitation in the $policyCreateStruct is not valid - * - * @param \eZ\Publish\API\Repository\Values\User\Role $role - * @param \eZ\Publish\API\Repository\Values\User\PolicyCreateStruct $policyCreateStruct - * - * @return \eZ\Publish\API\Repository\Values\User\Role - */ - public function addPolicy(Role $role, PolicyCreateStruct $policyCreateStruct) - { - $returnValue = $this->service->addPolicy($role, $policyCreateStruct); - $this->signalDispatcher->emit( - new AddPolicySignal( - [ - 'roleId' => $role->id, - 'policyId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Delete a policy. - * - * @deprecated since 6.0, use {@link removePolicyByRoleDraft()} instead. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove a policy - * - * @param \eZ\Publish\API\Repository\Values\User\Policy $policy the policy to delete - */ - public function deletePolicy(Policy $policy) - { - $returnValue = $this->service->deletePolicy($policy); - $this->signalDispatcher->emit( - new RemovePolicySignal( - [ - 'roleId' => $policy->roleId, - 'policyId' => $policy->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Updates the limitations of a policy. The module and function cannot be changed and - * the limitations are replaced by the ones in $roleUpdateStruct. - * - * @deprecated since 6.0, use {@link updatePolicyByRoleDraft()} instead. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to update a policy - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if limitation of the same type is repeated in policy update - * struct or if limitation is not allowed on module/function - * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if a limitation in the $policyUpdateStruct is not valid - * - * @param \eZ\Publish\API\Repository\Values\User\PolicyUpdateStruct $policyUpdateStruct - * @param \eZ\Publish\API\Repository\Values\User\Policy $policy - * - * @return \eZ\Publish\API\Repository\Values\User\Policy - */ - public function updatePolicy(Policy $policy, PolicyUpdateStruct $policyUpdateStruct) - { - $returnValue = $this->service->updatePolicy($policy, $policyUpdateStruct); - $this->signalDispatcher->emit( - new UpdatePolicySignal( - [ - 'policyId' => $policy->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Loads a role for the given id. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read this role - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a role with the given name was not found - * - * @param mixed $id - * - * @return \eZ\Publish\API\Repository\Values\User\Role - */ - public function loadRole($id) - { - return $this->service->loadRole($id); - } - - /** - * Loads a role for the given identifier. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read this role - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a role with the given name was not found - * - * @param string $identifier - * - * @return \eZ\Publish\API\Repository\Values\User\Role - */ - public function loadRoleByIdentifier($identifier) - { - return $this->service->loadRoleByIdentifier($identifier); - } - - /** - * Loads all roles. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read the roles - * - * @return \eZ\Publish\API\Repository\Values\User\Role[] - */ - public function loadRoles() - { - return $this->service->loadRoles(); - } - - /** - * Deletes the given role. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to delete this role - * - * @param \eZ\Publish\API\Repository\Values\User\Role $role - */ - public function deleteRole(Role $role) - { - $returnValue = $this->service->deleteRole($role); - $this->signalDispatcher->emit( - new DeleteRoleSignal( - [ - 'roleId' => $role->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Loads all policies from roles which are assigned to a user or to user groups to which the user belongs. - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a user with the given id was not found - * - * @param mixed $userId - * - * @return \eZ\Publish\API\Repository\Values\User\Policy[] - */ - public function loadPoliciesByUserId($userId) - { - return $this->service->loadPoliciesByUserId($userId); - } - - /** - * Assigns a role to the given user group. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to assign a role - * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if $roleLimitation is not valid - * - * @param \eZ\Publish\API\Repository\Values\User\Role $role - * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup - * @param \eZ\Publish\API\Repository\Values\User\Limitation\RoleLimitation $roleLimitation an optional role limitation (which is either a subtree limitation or section limitation) - */ - public function assignRoleToUserGroup(Role $role, UserGroup $userGroup, RoleLimitation $roleLimitation = null) - { - $returnValue = $this->service->assignRoleToUserGroup($role, $userGroup, $roleLimitation); - $this->signalDispatcher->emit( - new AssignRoleToUserGroupSignal( - [ - 'roleId' => $role->id, - 'userGroupId' => $userGroup->id, - 'roleLimitation' => $roleLimitation, - ] - ) - ); - - return $returnValue; - } - - /** - * removes a role from the given user group. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove a role - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the role is not assigned to the given user group - * - * @param \eZ\Publish\API\Repository\Values\User\Role $role - * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup - */ - public function unassignRoleFromUserGroup(Role $role, UserGroup $userGroup) - { - $returnValue = $this->service->unassignRoleFromUserGroup($role, $userGroup); - $this->signalDispatcher->emit( - new UnassignRoleFromUserGroupSignal( - [ - 'roleId' => $role->id, - 'userGroupId' => $userGroup->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Assigns a role to the given user. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to assign a role - * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if $roleLimitation is not valid - * - * @param \eZ\Publish\API\Repository\Values\User\Role $role - * @param \eZ\Publish\API\Repository\Values\User\User $user - * @param \eZ\Publish\API\Repository\Values\User\Limitation\RoleLimitation $roleLimitation an optional role limitation (which is either a subtree limitation or section limitation) - */ - public function assignRoleToUser(Role $role, User $user, RoleLimitation $roleLimitation = null) - { - $returnValue = $this->service->assignRoleToUser($role, $user, $roleLimitation); - $this->signalDispatcher->emit( - new AssignRoleToUserSignal( - [ - 'roleId' => $role->id, - 'userId' => $user->id, - 'roleLimitation' => $roleLimitation, - ] - ) - ); - - return $returnValue; - } - - /** - * removes a role from the given user. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove a role - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the role is not assigned to the user - * - * @param \eZ\Publish\API\Repository\Values\User\Role $role - * @param \eZ\Publish\API\Repository\Values\User\User $user - */ - public function unassignRoleFromUser(Role $role, User $user) - { - $returnValue = $this->service->unassignRoleFromUser($role, $user); - $this->signalDispatcher->emit( - new UnassignRoleFromUserSignal( - [ - 'roleId' => $role->id, - 'userId' => $user->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Removes the given role assignment. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove a role assignment - * - * @param \eZ\Publish\API\Repository\Values\User\RoleAssignment $roleAssignment - */ - public function removeRoleAssignment(RoleAssignment $roleAssignment) - { - $returnValue = $this->service->removeRoleAssignment($roleAssignment); - $this->signalDispatcher->emit( - new RemoveRoleAssignmentSignal([ - 'roleAssignmentId' => $roleAssignment->id, - ]) - ); - - return $returnValue; - } - - /** - * Loads a role assignment for the given id. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read this role - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If the role assignment was not found - * - * @param mixed $roleAssignmentId - * - * @return \eZ\Publish\API\Repository\Values\User\RoleAssignment - */ - public function loadRoleAssignment($roleAssignmentId) - { - return $this->service->loadRoleAssignment($roleAssignmentId); - } - - /** - * Returns the assigned user and user groups to this role. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read a role - * - * @param \eZ\Publish\API\Repository\Values\User\Role $role - * - * @return \eZ\Publish\API\Repository\Values\User\RoleAssignment[] - */ - public function getRoleAssignments(Role $role) - { - return $this->service->getRoleAssignments($role); - } - - /** - * @see \eZ\Publish\API\Repository\RoleService::getRoleAssignmentsForUser() - */ - public function getRoleAssignmentsForUser(User $user, $inherited = false) - { - return $this->service->getRoleAssignmentsForUser($user, $inherited); - } - - /** - * Returns the roles assigned to the given user group. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read a user group - * - * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup - * - * @return \eZ\Publish\API\Repository\Values\User\UserGroupRoleAssignment[] - */ - public function getRoleAssignmentsForUserGroup(UserGroup $userGroup) - { - return $this->service->getRoleAssignmentsForUserGroup($userGroup); - } - - /** - * Instantiates a role create class. - * - * @param string $name - * - * @return \eZ\Publish\API\Repository\Values\User\RoleCreateStruct - */ - public function newRoleCreateStruct($name) - { - return $this->service->newRoleCreateStruct($name); - } - - /** - * Instantiates a policy create class. - * - * @param string $module - * @param string $function - * - * @return \eZ\Publish\API\Repository\Values\User\PolicyCreateStruct - */ - public function newPolicyCreateStruct($module, $function) - { - return $this->service->newPolicyCreateStruct($module, $function); - } - - /** - * Instantiates a policy update class. - * - * @return \eZ\Publish\API\Repository\Values\User\PolicyUpdateStruct - */ - public function newPolicyUpdateStruct() - { - return $this->service->newPolicyUpdateStruct(); - } - - /** - * Instantiates a policy update class. - * - * @return \eZ\Publish\API\Repository\Values\User\RoleUpdateStruct - */ - public function newRoleUpdateStruct() - { - return $this->service->newRoleUpdateStruct(); - } - - /** - * Returns the LimitationType registered with the given identifier. - * - * @param string $identifier - * - * @return \eZ\Publish\SPI\Limitation\Type - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if there is no LimitationType with $identifier - */ - public function getLimitationType($identifier) - { - return $this->service->getLimitationType($identifier); - } - - /** - * Returns the LimitationType's assigned to a given module/function. - * - * Typically used for: - * - Internal validation limitation value use on Policies - * - Role admin gui for editing policy limitations incl list limitation options via valueSchema() - * - * @param string $module Legacy name of "controller", it's a unique identifier like "content" - * @param string $function Legacy name of a controller "action", it's a unique within the controller like "read" - * - * @return \eZ\Publish\SPI\Limitation\Type[] - * - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException If module/function to limitation type mapping - * refers to a non existing identifier. - */ - public function getLimitationTypesByModuleFunction($module, $function) - { - return $this->service->getLimitationTypesByModuleFunction($module, $function); - } -} diff --git a/eZ/Publish/Core/SignalSlot/SearchService.php b/eZ/Publish/Core/SignalSlot/SearchService.php deleted file mode 100644 index 6a834e42a72..00000000000 --- a/eZ/Publish/Core/SignalSlot/SearchService.php +++ /dev/null @@ -1,142 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * Finds content objects for the given query. - * - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if query is not valid - * - * @param \eZ\Publish\API\Repository\Values\Content\Query $query - * @param array $languageFilter Configuration for specifying prioritized languages query will be performed on. - * Currently supported: array("languages" => array(,..)). - * @param bool $filterOnUserPermissions if true only the objects which the user is allowed to read are returned. - * - * @return \eZ\Publish\API\Repository\Values\Content\Search\SearchResult - */ - public function findContent(Query $query, array $languageFilter = [], $filterOnUserPermissions = true) - { - return $this->service->findContent($query, $languageFilter, $filterOnUserPermissions); - } - - /** - * Finds contentInfo objects for the given query. - * - * @see SearchServiceInterface::findContentInfo() - * - * @since 5.4.5 - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if query is not valid - * - * @param \eZ\Publish\API\Repository\Values\Content\Query $query - * @param array $languageFilter - a map of filters for the returned fields. - * Currently supports: array("languages" => array(,..), "useAlwaysAvailable" => bool) - * useAlwaysAvailable defaults to true to avoid exceptions on missing translations. - * @param bool $filterOnUserPermissions if true (default) only the objects which is the user allowed to read are returned. - * - * @return \eZ\Publish\API\Repository\Values\Content\Search\SearchResult - */ - public function findContentInfo(Query $query, array $languageFilter = [], $filterOnUserPermissions = true) - { - return $this->service->findContentInfo($query, $languageFilter, $filterOnUserPermissions); - } - - /** - * Performs a query for a single content object. - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if the object was not found by the query or due to permissions - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if criterion is not valid - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if there is more than than one result matching the criterions - * - * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $filter - * @param array $languageFilter Configuration for specifying prioritized languages query will be performed on. - * Currently supported: array("languages" => array(,..)). - * @param bool $filterOnUserPermissions if true only the objects which is the user allowed to read are returned. - * - * @return \eZ\Publish\API\Repository\Values\Content\Content - */ - public function findSingle(Criterion $filter, array $languageFilter = [], $filterOnUserPermissions = true) - { - return $this->service->findSingle($filter, $languageFilter, $filterOnUserPermissions); - } - - /** - * Suggests a list of values for the given prefix. - * - * @param string $prefix - * @param string[] $fieldPaths - * @param int $limit - * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $filter - */ - public function suggest($prefix, $fieldPaths = [], $limit = 10, Criterion $filter = null) - { - return $this->service->suggest($prefix, $fieldPaths, $limit, $filter); - } - - /** - * Finds Locations for the given query. - * - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if query is not valid - * - * @param \eZ\Publish\API\Repository\Values\Content\LocationQuery $query - * @param array $languageFilter Configuration for specifying prioritized languages query will be performed on. - * Currently supports: array("languages" => array(,..), "useAlwaysAvailable" => bool) - * useAlwaysAvailable defaults to true to avoid exceptions on missing translations - * @param bool $filterOnUserPermissions if true only the objects which is the user allowed to read are returned. - * - * @return \eZ\Publish\API\Repository\Values\Content\Search\SearchResult - */ - public function findLocations(LocationQuery $query, array $languageFilter = [], $filterOnUserPermissions = true) - { - return $this->service->findLocations($query, $languageFilter, $filterOnUserPermissions); - } - - public function supports($capabilityFlag) - { - return $this->service->supports($capabilityFlag); - } -} diff --git a/eZ/Publish/Core/SignalSlot/Signal.php b/eZ/Publish/Core/SignalSlot/Signal.php deleted file mode 100644 index 5365942f74a..00000000000 --- a/eZ/Publish/Core/SignalSlot/Signal.php +++ /dev/null @@ -1,21 +0,0 @@ -$translations argument of - * the ContentService::publishVersion API. - * - * @see \eZ\Publish\API\Repository\ContentService::publishVersion - * - * Other translations were copied from the previously published Version. - * - * @var string[] - */ - public $affectedTranslations = Language::ALL; -} diff --git a/eZ/Publish/Core/SignalSlot/Signal/ContentService/RemoveTranslationSignal.php b/eZ/Publish/Core/SignalSlot/Signal/ContentService/RemoveTranslationSignal.php deleted file mode 100644 index c820bf6d4e5..00000000000 --- a/eZ/Publish/Core/SignalSlot/Signal/ContentService/RemoveTranslationSignal.php +++ /dev/null @@ -1,25 +0,0 @@ -$trashItemDeleteResult->trashItemId instead. - */ - public $trashItemId; - - /** @var \eZ\Publish\API\Repository\Values\Content\Trash\TrashItemDeleteResult */ - public $trashItemDeleteResult; -} diff --git a/eZ/Publish/Core/SignalSlot/Signal/TrashService/EmptyTrashSignal.php b/eZ/Publish/Core/SignalSlot/Signal/TrashService/EmptyTrashSignal.php deleted file mode 100644 index 64515de1ae2..00000000000 --- a/eZ/Publish/Core/SignalSlot/Signal/TrashService/EmptyTrashSignal.php +++ /dev/null @@ -1,20 +0,0 @@ -signalSlotMap = $signalSlotMap; - if (!isset($this->signalSlotMap['*'])) { - $this->signalSlotMap['*'] = []; - } - } - - /** - * Emits the given $signal. - * - * All assigned slots will eventually receive the $signal - * - * @param Signal $signal - */ - public function emit(Signal $signal) - { - $signalName = get_class($signal); - if (!isset($this->signalSlotMap[$signalName])) { - $this->signalSlotMap[$signalName] = []; - } - - foreach (array_merge($this->signalSlotMap['*'], $this->signalSlotMap[$signalName]) as $slot) { - /* @var \eZ\Publish\Core\SignalSlot\Slot $slot */ - $slot->receive($signal); - } - } - - /** - * Attaches the Slot with $slotIdentifier to the signal with - * $signalIdentifier. - * - * - * @param string $signalIdentifier - * @param \eZ\Publish\Core\SignalSlot\Slot $slot - * - * @deprecated pass signal slots directly to the constructor ({@see __construct()}) - */ - public function attach($signalIdentifier, Slot $slot) - { - if ($signalIdentifier[0] === '\\') { - $signalIdentifier = substr($signalIdentifier, 1); - } elseif ($signalIdentifier !== '*') { - $signalIdentifier = static::RELATIVE_SIGNAL_NAMESPACE . "\\$signalIdentifier"; - } - - $this->signalSlotMap[$signalIdentifier][] = $slot; - } -} diff --git a/eZ/Publish/Core/SignalSlot/SignalDispatcher/SignalDispatcherTransactionWrapper.php b/eZ/Publish/Core/SignalSlot/SignalDispatcher/SignalDispatcherTransactionWrapper.php deleted file mode 100644 index cc969971a8f..00000000000 --- a/eZ/Publish/Core/SignalSlot/SignalDispatcher/SignalDispatcherTransactionWrapper.php +++ /dev/null @@ -1,115 +0,0 @@ -signalDispatcher = $signalDispatcher; - } - - /** - * Emits the given $signal or queue if in transaction. - * - * All assigned slots will eventually receive the $signal - * - * @param Signal $signal - */ - public function emit(Signal $signal) - { - if ($this->transactionDepth === 0) { - $this->signalDispatcher->emit($signal); - } else { - $this->signalsQueue[$this->transactionCount][] = $signal; - } - } - - /** - * Captures Begin transaction call. - */ - public function beginTransaction() - { - ++$this->transactionDepth; - $this->signalsQueue[++$this->transactionCount] = []; - } - - /** - * Captures Commit transaction call and emits queued signals. - */ - public function commit() - { - // Ignore if no transaction - if ($this->transactionDepth === 0) { - return; - } - - --$this->transactionDepth; - if ($this->transactionDepth === 0) { - foreach ($this->signalsQueue as $signalsQueue) { - foreach ($signalsQueue as $signal) { - $this->signalDispatcher->emit($signal); - } - } - - // To avoid possible int overflow on long running processes - $this->transactionCount = 0; - $this->signalsQueue = []; - } - } - - /** - * Captures Rollback transaction call. - */ - public function rollback() - { - // Ignore if no transaction - if ($this->transactionDepth === 0) { - return; - } - - --$this->transactionDepth; - unset($this->signalsQueue[$this->transactionCount]); - --$this->transactionCount; // In case several rollbacks will happen on hierarchical transactions. - } -} diff --git a/eZ/Publish/Core/SignalSlot/Slot.php b/eZ/Publish/Core/SignalSlot/Slot.php deleted file mode 100644 index e457335c824..00000000000 --- a/eZ/Publish/Core/SignalSlot/Slot.php +++ /dev/null @@ -1,22 +0,0 @@ -slots = $slots; - } - - /** - * Returns a Slot with the given $slotIdentifier. - * - * @param string $slotIdentifier - * - * @throws \eZ\Publish\Core\Base\Exceptions\NotFoundException When no slot is found - * - * @return \eZ\Publish\Core\SignalSlot\Slot - */ - public function getSlot($slotIdentifier) - { - if (!isset($this->slots[$slotIdentifier])) { - throw new NotFoundException('slot', $slotIdentifier); - } - - return $this->slots[$slotIdentifier]; - } -} diff --git a/eZ/Publish/Core/SignalSlot/SlotFactory/NullSlotFactory.php b/eZ/Publish/Core/SignalSlot/SlotFactory/NullSlotFactory.php deleted file mode 100644 index 7eaa0aae0dd..00000000000 --- a/eZ/Publish/Core/SignalSlot/SlotFactory/NullSlotFactory.php +++ /dev/null @@ -1,27 +0,0 @@ - 60, - ]); - - return [ - [ - 'createBookmark', - [$location], - null, - 1, - CreateBookmarkSignal::class, - [ - 'locationId' => $location->id, - ], - ], - [ - 'deleteBookmark', - [$location], - null, - 1, - DeleteBookmarkSignal::class, - [ - 'locationId' => $location->id, - ], - ], - [ - 'loadBookmarks', - [0, 25], - new BookmarkList(), - 0, - ], - [ - 'isBookmarked', - [$location], - false, - 0, - ], - ]; - } - - protected function getServiceMock() - { - return $this->createMock(APIBookmarkService::class); - } - - protected function getSignalSlotService($innerService, SignalDispatcher $dispatcher) - { - return new BookmarkService($innerService, $dispatcher); - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/ContentServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/ContentServiceTest.php deleted file mode 100644 index 946679ade5b..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/ContentServiceTest.php +++ /dev/null @@ -1,299 +0,0 @@ -createMock(APIContentService::class); - } - - protected function getSignalSlotService($coreService, SignalDispatcher $dispatcher) - { - return new ContentService($coreService, $dispatcher); - } - - public function serviceProvider() - { - $contentId = 42; - $versionNo = 2; - $remoteId = md5('One Ring to rule them all'); - $language = 'fre-FR'; - $userId = 14; - $userVersionNo = 5; - $copiedContentId = 43; - $copiedVersionNo = 1; - $copyParentLocationId = 50; - $relationDestContentId = 44; - - $contentCreateStruct = new ContentCreateStruct(); - $locationCreateStruct = new LocationCreateStruct(); - $copyLocationCreateStruct = new LocationCreateStruct( - ['parentLocationId' => $copyParentLocationId] - ); - $contentMetadataUpdateStruct = new ContentMetadataUpdateStruct(); - $contentUpdateStruct = new ContentUpdateStruct(); - - $contentType = new ContentType( - [ - 'fieldDefinitions' => [], - ] - ); - $contentInfo = $this->getContentInfo($contentId, $remoteId); - $versionInfo = $this->getVersionInfo($contentInfo, $versionNo); - $content = $this->getContent($versionInfo); - - $user = $this->getUser($userId, md5('Sauron'), $userVersionNo); - $usersDraft = [$versionInfo]; - - $copiedContent = $this->getContent( - $this->getVersionInfo( - $this->getContentInfo($copiedContentId, md5('Backup ring, just in case ;-)')), - $copiedVersionNo - ) - ); - - $relations = [new Relation()]; - $newRelation = new Relation(); - $relationDestContentInfo = $this->getContentInfo($relationDestContentId, md5('Mordor')); - - $translationInfoFilter = []; - - return [ - [ - 'loadContentInfo', - [$contentId], - $contentInfo, - 0, - ], - [ - 'loadContentInfoList', - [[$contentId]], - [$contentInfo], - 0, - ], - [ - 'loadContentInfoByRemoteId', - [$remoteId], - $contentInfo, - 0, - ], - [ - 'loadVersionInfo', - [$contentInfo, $versionNo], - $versionInfo, - 0, - ], - [ - 'loadVersionInfoById', - [$contentId, $versionNo], - $versionInfo, - 0, - ], - [ - 'loadContentByContentInfo', - [$contentInfo, [$language], $versionNo, true], - $content, - 0, - ], - [ - 'loadContentByVersionInfo', - [$versionInfo, [$language], true], - $content, - 0, - ], - [ - 'loadContent', - [$contentId, [$language], $versionNo, true], - $content, - 0, - ], - [ - 'loadContentByRemoteId', - [$remoteId, [$language], $versionNo, true], - $content, - 0, - ], - [ - 'createContent', - [$contentCreateStruct, [$locationCreateStruct]], - $content, - 1, - ContentServiceSignals\CreateContentSignal::class, - [ - 'contentId' => $contentId, - 'versionNo' => $versionNo, - ], - ], - [ - 'updateContentMetadata', - [$contentInfo, $contentMetadataUpdateStruct], - $content, - 1, - ContentServiceSignals\UpdateContentMetadataSignal::class, - ['contentId' => $contentId], - ], - [ - 'deleteContent', - [$contentInfo], - $contentInfo, - 1, - ContentServiceSignals\DeleteContentSignal::class, - ['contentId' => $contentId], - ], - [ - 'createContentDraft', - [$contentInfo, $versionInfo, $user], - $content, - 1, - ContentServiceSignals\CreateContentDraftSignal::class, - [ - 'contentId' => $contentId, - 'versionNo' => $versionNo, - 'newVersionNo' => $content->getVersionInfo()->versionNo, - 'userId' => $userId, - ], - ], - [ - 'loadContentDrafts', - [$user], - $usersDraft, - 0, - ], - [ - 'updateContent', - [$versionInfo, $contentUpdateStruct], - $content, - 1, - ContentServiceSignals\UpdateContentSignal::class, - [ - 'contentId' => $contentId, - 'versionNo' => $versionNo, - ], - ], - [ - 'publishVersion', - [$versionInfo, []], - $content, - 1, - ContentServiceSignals\PublishVersionSignal::class, - [ - 'contentId' => $contentId, - 'versionNo' => $versionNo, - ], - ], - [ - 'deleteVersion', - [$versionInfo], - $versionInfo, - 1, - ContentServiceSignals\DeleteVersionSignal::class, - [ - 'contentId' => $contentId, - 'versionNo' => $versionNo, - ], - ], - [ - 'loadVersions', - [$contentInfo, null], - [$versionInfo], - 0, - ], - [ - 'copyContent', - [$contentInfo, $copyLocationCreateStruct, $versionInfo], - $copiedContent, - 1, - ContentServiceSignals\CopyContentSignal::class, - [ - 'srcContentId' => $contentId, - 'srcVersionNo' => $versionNo, - 'dstContentId' => $copiedContentId, - 'dstVersionNo' => $copiedVersionNo, - 'dstParentLocationId' => $copyParentLocationId, - ], - ], - [ - 'loadRelations', - [$versionInfo], - $relations, - 0, - ], - [ - 'loadReverseRelations', - [$contentInfo], - $relations, - 0, - ], - [ - 'addRelation', - [$versionInfo, $relationDestContentInfo], - $newRelation, - 1, - ContentServiceSignals\AddRelationSignal::class, - [ - 'srcContentId' => $contentId, - 'srcVersionNo' => $versionNo, - 'dstContentId' => $relationDestContentId, - ], - ], - [ - 'deleteRelation', - [$versionInfo, $relationDestContentInfo], - null, - 1, - ContentServiceSignals\DeleteRelationSignal::class, - [ - 'srcContentId' => $contentId, - 'srcVersionNo' => $versionNo, - 'dstContentId' => $relationDestContentId, - ], - ], - [ - 'deleteTranslation', - [$contentInfo, $language], - null, - 2, - DeleteTranslationSignal::class, - ['contentId' => $contentId, 'languageCode' => $language], - ], - [ - 'newContentCreateStruct', - [$contentType, $language], - [$contentCreateStruct], - 0, - ], - [ - 'newContentMetadataUpdateStruct', - [], - [$contentMetadataUpdateStruct], - 0, - ], - [ - 'newContentUpdateStruct', - [], - [$contentUpdateStruct], - 0, - ], - ]; - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/FieldTypeServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/FieldTypeServiceTest.php deleted file mode 100644 index bd11b9b6509..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/FieldTypeServiceTest.php +++ /dev/null @@ -1,66 +0,0 @@ -createMock(APIFieldTypeService::class); - } - - protected function getSignalSlotService($coreService, SignalDispatcher $dispatcher) - { - return new FieldTypeService($coreService, $dispatcher); - } - - protected function getTransformationProcessorMock() - { - return $this->getMockForAbstractClass( - TransformationProcessor::class, - [], - '', - false, - true, - true - ); - } - - public function serviceProvider() - { - $fieldType = new Type($this->getTransformationProcessorMock()); - - return [ - [ - 'getFieldTypes', - [], - [$fieldType], - 0, - ], - [ - 'getFieldType', - ['ezstring'], - $fieldType, - 0, - ], - [ - 'hasFieldType', - ['ezstring'], - true, - 0, - ], - ]; - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/LanguageServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/LanguageServiceTest.php deleted file mode 100644 index c8be7b3bdcb..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/LanguageServiceTest.php +++ /dev/null @@ -1,144 +0,0 @@ -createMock(APILanguageService::class); - } - - protected function getSignalSlotService($coreService, SignalDispatcher $dispatcher) - { - return new LanguageService($coreService, $dispatcher); - } - - public function serviceProvider() - { - $languageId = 2; - $languageCode = 'elv-TO'; - $languageName = 'Elvish'; - $languageEnabled = true; - $languageNewName = 'Elfique'; - - $language = new Language( - [ - 'id' => $languageId, - 'languageCode' => $languageCode, - 'name' => $languageName, - 'enabled' => $languageEnabled, - ] - ); - - $languageCreateStruct = new LanguageCreateStruct(); - - // string $method, array $parameters, mixed $return, int $emitNr, ?string $signalClass - return [ - [ - 'createLanguage', - [$languageCreateStruct], - $language, - 1, - LanguageServiceSignals\CreateLanguageSignal::class, - ['languageId' => $languageId], - ], - [ - 'updateLanguageName', - [$language, $languageNewName], - $language, - 1, - LanguageServiceSignals\UpdateLanguageNameSignal::class, - [ - 'languageId' => $languageId, - 'newName' => $languageNewName, - ], - ], - [ - 'enableLanguage', - [$language], - $language, - 1, - LanguageServiceSignals\EnableLanguageSignal::class, - [ - 'languageId' => $languageId, - ], - ], - [ - 'disableLanguage', - [$language], - $language, - 1, - LanguageServiceSignals\DisableLanguageSignal::class, - [ - 'languageId' => $languageId, - ], - ], - [ - 'loadLanguage', - [$languageCode], - $language, - 0, - ], - [ - 'loadLanguageListByCode', - [[$languageCode]], - [$languageCode => $language], - 0, - ], - [ - 'loadLanguages', - [], - [$language], - 0, - ], - [ - 'loadLanguageById', - [$languageId], - $language, - 0, - ], - [ - 'loadLanguageListById', - [[$languageId]], - [$languageId => $language], - 0, - ], - [ - 'deleteLanguage', - [$language], - null, - 1, - LanguageServiceSignals\DeleteLanguageSignal::class, - [ - 'languageId' => $languageId, - ], - ], - [ - 'getDefaultLanguageCode', - [], - $languageCode, - 0, - ], - [ - 'newLanguageCreateStruct', - [], - $languageCreateStruct, - 0, - ], - ]; - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/LocationServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/LocationServiceTest.php deleted file mode 100644 index dd7bff506a4..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/LocationServiceTest.php +++ /dev/null @@ -1,229 +0,0 @@ -createMock(APILocationService::class); - } - - protected function getSignalSlotService($coreService, SignalDispatcher $dispatcher) - { - return new LocationService($coreService, $dispatcher); - } - - public function serviceProvider() - { - $rootId = 2; - $rootPath = '/1/2'; - $rootContentId = 57; - $rootContentRemoteId = md5('content root'); - $rootRemoteId = md5('root'); - $locationId = 60; - $locationPath = '/1/2/60'; - $locationContentId = 59; - $locationContentRemoteId = md5('not content root'); - $locationRemoteId = md5('not root'); - - $rootContentInfo = $this->getContentInfo($rootContentId, $rootContentRemoteId); - $root = new Location( - [ - 'id' => $rootId, - 'path' => $rootPath, - 'remoteId' => $rootRemoteId, - 'contentInfo' => $rootContentInfo, - 'parentLocationId' => 1, - ] - ); - $locationContentInfo = $this->getContentInfo($locationContentId, $locationContentRemoteId); - $location = new Location( - [ - 'id' => $locationId, - 'path' => $locationPath, - 'remoteId' => $locationRemoteId, - 'contentInfo' => $locationContentInfo, - 'parentLocationId' => $rootId, - ] - ); - - $rootChildren = new LocationList( - [ - 'totalCount' => 1, - 'locations' => [$location], - ] - ); - - $locationCreateStruct = new LocationCreateStruct(); - $locationUpdateStruct = new LocationUpdateStruct(); - - return [ - [ - 'copySubtree', - [$location, $root], - $location, - 1, - LocationServiceSignals\CopySubtreeSignal::class, - [ - 'subtreeId' => $locationId, - 'targetParentLocationId' => $rootId, - ], - ], - [ - 'loadLocation', - [$rootId, [], true], - $root, - 0, - ], - [ - 'loadLocationList', - [[$rootId], [], true], - [$root], - 0, - ], - [ - 'loadLocationByRemoteId', - [$rootRemoteId, [], true], - $root, - 0, - ], - [ - 'loadLocations', - [$locationContentInfo, $root, []], - [$location], - 0, - ], - [ - 'loadLocationChildren', - [$root, 0, 1, []], - $rootChildren, - 0, - ], - /*array( - 'loadParentLocationsForDraftContent', - array($root, 0, 1, []), - $rootChildren, - 0, - ),*/ - [ - 'getLocationChildCount', - [$root], - 1, - 0, - ], - [ - 'createLocation', - [$locationContentInfo, $locationCreateStruct], - $location, - 1, - LocationServiceSignals\CreateLocationSignal::class, - [ - 'contentId' => $locationContentId, - 'locationId' => $locationId, - 'parentLocationId' => $rootId, - ], - ], - [ - 'updateLocation', - [$location, $locationUpdateStruct], - $location, - 1, - LocationServiceSignals\UpdateLocationSignal::class, - [ - 'contentId' => $locationContentId, - 'locationId' => $locationId, - 'parentLocationId' => $rootId, - ], - ], - [ - 'swapLocation', - [$location, $root], - null, - 1, - LocationServiceSignals\SwapLocationSignal::class, - [ - 'location1Id' => $locationId, - 'content1Id' => $locationContentId, - 'parentLocation1Id' => $rootId, - 'location2Id' => $rootId, - 'content2Id' => $rootContentId, - 'parentLocation2Id' => 1, - ], - ], - [ - 'hideLocation', - [$location], - $location, - 1, - LocationServiceSignals\HideLocationSignal::class, - [ - 'locationId' => $locationId, - 'parentLocationId' => $rootId, - ], - ], - [ - 'unhideLocation', - [$location], - $location, - 1, - LocationServiceSignals\UnhideLocationSignal::class, - [ - 'locationId' => $locationId, - 'parentLocationId' => $rootId, - ], - ], - [ - 'moveSubtree', - [$location, $root], - $location, - 1, - LocationServiceSignals\MoveSubtreeSignal::class, - [ - 'locationId' => $locationId, - 'newParentLocationId' => $rootId, - 'oldParentLocationId' => $rootId, - ], - ], - [ - 'deleteLocation', - [$location], - null, - 1, - LocationServiceSignals\DeleteLocationSignal::class, - [ - 'locationId' => $locationId, - 'contentId' => $locationContentId, - 'parentLocationId' => $rootId, - ], - ], - [ - 'newLocationCreateStruct', - [$rootId, null], - $locationCreateStruct, - 0, - ], - [ - 'newLocationUpdateStruct', - [], - $locationUpdateStruct, - 0, - ], - ]; - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/NotificationServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/NotificationServiceTest.php deleted file mode 100644 index 4b8882f3f86..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/NotificationServiceTest.php +++ /dev/null @@ -1,106 +0,0 @@ - $notificationId, - ]); - - $createStruct = new CreateStruct([ - 'ownerId' => 10, - 'type' => 'Foo', - 'data' => [], - ]); - - return [ - [ - 'loadNotifications', - [0, 25], - new NotificationList(), - 0, - ], - [ - 'getNotification', - [$notificationId], - new Notification(), - 0, - ], - [ - 'markNotificationAsRead', - [$notification], - null, - 1, - NotificationReadSignal::class, - [ - 'notificationId' => $notificationId, - ], - ], - [ - 'getPendingNotificationCount', - [], - 10, - 0, - ], - [ - 'deleteNotification', - [$notification], - null, - 1, - NotificationDeleteSignal::class, - [ - 'notificationId' => $notificationId, - ], - ], - [ - 'createNotification', - [$createStruct], - $notification, - 1, - NotificationCreateSignal::class, - [ - 'ownerId' => $createStruct->ownerId, - 'type' => $createStruct->type, - 'data' => $createStruct->data, - ], - ], - ]; - } - - /** - * {@inheritdoc} - */ - protected function getServiceMock() - { - return $this->createMock(APINotificationService::class); - } - - /** - * {@inheritdoc} - */ - protected function getSignalSlotService($innerService, SignalDispatcher $dispatcher) - { - return new NotificationService($innerService, $dispatcher); - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/ObjectStateServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/ObjectStateServiceTest.php deleted file mode 100644 index 9b2001eef57..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/ObjectStateServiceTest.php +++ /dev/null @@ -1,199 +0,0 @@ -createMock(APIObjectStateService::class); - } - - protected function getSignalSlotService($coreService, SignalDispatcher $dispatcher) - { - return new ObjectStateService($coreService, $dispatcher); - } - - public function serviceProvider() - { - $objectStateGroupId = 4; - $objectStateId = 42; - $priority = 50; - $contentId = 59; - $contentRemoteId = md5("What's up doc ?"); - - $objectStateGroupCreateStruct = new ObjectStateGroupCreateStruct(); - $objectStateGroupUpdateStruct = new ObjectStateGroupUpdateStruct(); - $objectStateCreateStruct = new ObjectStateCreateStruct(); - $objectStateUpdateStruct = new ObjectStateUpdateStruct(); - $objectStateGroup = new ObjectStateGroup( - [ - 'id' => $objectStateGroupId, - ] - ); - $objectState = new ObjectState( - [ - 'id' => $objectStateId, - ] - ); - $contentInfo = $this->getContentInfo($contentId, $contentRemoteId); - - return [ - [ - 'createObjectStateGroup', - [$objectStateGroupCreateStruct], - $objectStateGroup, - 1, - ObjectStateServiceSignals\CreateObjectStateGroupSignal::class, - ['objectStateGroupId' => $objectStateGroupId], - ], - [ - 'loadObjectStateGroup', - [4, []], - $objectStateGroup, - 0, - ], - [ - 'loadObjectStateGroups', - [1, 1, []], - [$objectStateGroup], - 0, - ], - [ - 'loadObjectStates', - [$objectStateGroup, []], - [$objectState], - 0, - ], - [ - 'updateObjectStateGroup', - [$objectStateGroup, $objectStateGroupUpdateStruct], - $objectStateGroup, - 1, - ObjectStateServiceSignals\UpdateObjectStateGroupSignal::class, - ['objectStateGroupId' => $objectStateGroupId], - ], - [ - 'deleteObjectStateGroup', - [$objectStateGroup], - null, - 1, - ObjectStateServiceSignals\DeleteObjectStateGroupSignal::class, - ['objectStateGroupId' => $objectStateGroupId], - ], - [ - 'createObjectState', - [$objectStateGroup, $objectStateCreateStruct], - $objectState, - 1, - ObjectStateServiceSignals\CreateObjectStateSignal::class, - [ - 'objectStateGroupId' => $objectStateGroupId, - 'objectStateId' => $objectStateId, - ], - ], - [ - 'loadObjectState', - [$objectStateId, []], - $objectState, - 0, - ], - [ - 'updateObjectState', - [$objectState, $objectStateUpdateStruct], - $objectState, - 1, - ObjectStateServiceSignals\UpdateObjectStateSignal::class, - [ - 'objectStateId' => $objectStateId, - ], - ], - [ - 'setPriorityOfObjectState', - [$objectState, $priority], - null, - 1, - ObjectStateServiceSignals\SetPriorityOfObjectStateSignal::class, - [ - 'objectStateId' => $objectStateId, - 'priority' => $priority, - ], - ], - [ - 'deleteObjectState', - [$objectState], - null, - 1, - ObjectStateServiceSignals\DeleteObjectStateSignal::class, - [ - 'objectStateId' => $objectStateId, - ], - ], - [ - 'setContentState', - [$contentInfo, $objectStateGroup, $objectState], - null, - 1, - ObjectStateServiceSignals\SetContentStateSignal::class, - [ - 'objectStateId' => $objectStateId, - 'contentId' => $contentId, - 'objectStateGroupId' => $objectStateGroupId, - ], - ], - [ - 'getContentState', - [$contentInfo, $objectStateGroup], - $objectState, - 0, - ], - [ - 'getContentCount', - [$objectState], - 35, - 0, - ], - [ - 'newObjectStateGroupCreateStruct', - ['identifier'], - $objectStateGroupCreateStruct, - 0, - ], - [ - 'newObjectStateGroupUpdateStruct', - [], - $objectStateGroupUpdateStruct, - 0, - ], - [ - 'newObjectStateUpdateStruct', - [], - $objectStateUpdateStruct, - 0, - ], - [ - 'newObjectStateCreateStruct', - ['identifier'], - $objectStateCreateStruct, - 0, - ], - ]; - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/RepositoryTest.php b/eZ/Publish/Core/SignalSlot/Tests/RepositoryTest.php deleted file mode 100644 index 78f8ce5b496..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/RepositoryTest.php +++ /dev/null @@ -1,212 +0,0 @@ -getMockBuilder(InnerRepository::class)->disableOriginalConstructor()->getMock(); - $signalDispatcherMock = $this->createMock(SignalDispatcher::class); - - $contentServiceMock = $this->getMockBuilder(ContentService::class)->disableOriginalConstructor()->getMock(); - $contentTypeServiceMock = $this->getMockBuilder(ContentTypeService::class)->disableOriginalConstructor()->getMock(); - $fieldTypeServiceMock = $this->getMockBuilder(FieldTypeService::class)->disableOriginalConstructor()->getMock(); - $roleServiceMock = $this->getMockBuilder(RoleService::class)->disableOriginalConstructor()->getMock(); - $objectStateServiceMock = $this->getMockBuilder(ObjectStateService::class)->disableOriginalConstructor()->getMock(); - $urlWildcardServiceMock = $this->getMockBuilder(URLWildcardService::class)->disableOriginalConstructor()->getMock(); - $urlAliasServiceMock = $this->getMockBuilder(URLAliasService::class)->disableOriginalConstructor()->getMock(); - $userServiceMock = $this->getMockBuilder(UserService::class)->disableOriginalConstructor()->getMock(); - $searchServiceMock = $this->getMockBuilder(SearchService::class)->disableOriginalConstructor()->getMock(); - $sectionServiceMock = $this->getMockBuilder(SectionService::class)->disableOriginalConstructor()->getMock(); - $trashServiceMock = $this->getMockBuilder(TrashService::class)->disableOriginalConstructor()->getMock(); - $locationServiceMock = $this->getMockBuilder(LocationService::class)->disableOriginalConstructor()->getMock(); - $languageServiceMock = $this->getMockBuilder(LanguageService::class)->disableOriginalConstructor()->getMock(); - $urlServiceMock = $this->getMockBuilder(URLService::class)->disableOriginalConstructor()->getMock(); - $bookmarkServiceMock = $this->getMockBuilder(BookmarkService::class)->disableOriginalConstructor()->getMock(); - $notificationServiceMock = $this->getMockBuilder(NotificationService::class)->disableOriginalConstructor()->getMock(); - $userPreferenceServiceMock = $this->getMockBuilder(UserPreferenceService::class)->disableOriginalConstructor()->getMock(); - - $repository = new Repository( - $innerRepositoryMock, - $signalDispatcherMock, - $contentServiceMock, - $contentTypeServiceMock, - $fieldTypeServiceMock, - $roleServiceMock, - $objectStateServiceMock, - $urlWildcardServiceMock, - $urlAliasServiceMock, - $userServiceMock, - $searchServiceMock, - $sectionServiceMock, - $trashServiceMock, - $locationServiceMock, - $languageServiceMock, - $urlServiceMock, - $bookmarkServiceMock, - $notificationServiceMock, - $userPreferenceServiceMock - ); - - $service = $repository->{$method}(); - $this->assertInstanceOf($class, $service); - $service2 = $repository->{$method}(); - $this->assertTrue($service === $service2); - } - - public function serviceMethods() - { - return [ - ['getContentService', ContentService::class], - ['getContentLanguageService', LanguageService::class], - ['getContentTypeService', ContentTypeService::class], - ['getLocationService', LocationService::class], - ['getTrashService', TrashService::class], - ['getSectionService', SectionService::class], - ['getUserService', UserService::class], - ['getURLAliasService', URLAliasService::class], - ['getURLWildcardService', URLWildcardService::class], - ['getObjectStateService', ObjectStateService::class], - ['getRoleService', RoleService::class], - ['getSearchService', SearchService::class], - ['getFieldTypeService', FieldTypeService::class], - ]; - } - - /** - * @dataProvider aggregatedMethods - */ - public function testAggregation($method, $parameters, $return) - { - $innerRepositoryMock = $this->getMockBuilder(InnerRepository::class)->disableOriginalConstructor()->getMock(); - $signalDispatcherMock = $this->createMock(SignalDispatcher::class); - - $contentServiceMock = $this->getMockBuilder(ContentService::class)->disableOriginalConstructor()->getMock(); - $contentTypeServiceMock = $this->getMockBuilder(ContentTypeService::class)->disableOriginalConstructor()->getMock(); - $fieldTypeServiceMock = $this->getMockBuilder(FieldTypeService::class)->disableOriginalConstructor()->getMock(); - $roleServiceMock = $this->getMockBuilder(RoleService::class)->disableOriginalConstructor()->getMock(); - $objectStateServiceMock = $this->getMockBuilder(ObjectStateService::class)->disableOriginalConstructor()->getMock(); - $urlWildcardServiceMock = $this->getMockBuilder(URLWildcardService::class)->disableOriginalConstructor()->getMock(); - $urlAliasServiceMock = $this->getMockBuilder(URLAliasService::class)->disableOriginalConstructor()->getMock(); - $userServiceMock = $this->getMockBuilder(UserService::class)->disableOriginalConstructor()->getMock(); - $searchServiceMock = $this->getMockBuilder(SearchService::class)->disableOriginalConstructor()->getMock(); - $sectionServiceMock = $this->getMockBuilder(SectionService::class)->disableOriginalConstructor()->getMock(); - $trashServiceMock = $this->getMockBuilder(TrashService::class)->disableOriginalConstructor()->getMock(); - $locationServiceMock = $this->getMockBuilder(LocationService::class)->disableOriginalConstructor()->getMock(); - $languageServiceMock = $this->getMockBuilder(LanguageService::class)->disableOriginalConstructor()->getMock(); - $bookmarkServiceMock = $this->getMockBuilder(BookmarkService::class)->disableOriginalConstructor()->getMock(); - $urlServiceMock = $this->getMockBuilder(URLService::class)->disableOriginalConstructor()->getMock(); - $notificationServiceMock = $this->getMockBuilder(NotificationService::class)->disableOriginalConstructor()->getMock(); - $userPreferenceServiceMock = $this->getMockBuilder(UserPreferenceService::class)->disableOriginalConstructor()->getMock(); - - $innerRepositoryMock->expects($this->once()) - ->method($method) - ->will( - $this->returnValueMap([ - array_merge($parameters, [$return]), - ]) - ); - - $repository = new Repository( - $innerRepositoryMock, - $signalDispatcherMock, - $contentServiceMock, - $contentTypeServiceMock, - $fieldTypeServiceMock, - $roleServiceMock, - $objectStateServiceMock, - $urlWildcardServiceMock, - $urlAliasServiceMock, - $userServiceMock, - $searchServiceMock, - $sectionServiceMock, - $trashServiceMock, - $locationServiceMock, - $languageServiceMock, - $urlServiceMock, - $bookmarkServiceMock, - $notificationServiceMock, - $userPreferenceServiceMock - ); - - $result = call_user_func_array([$repository, $method], $parameters); - $this->assertTrue($result === $return); - } - - public function aggregatedMethods() - { - $ts = 374390100; - $dt = new \DateTime(); - $dt->setTimestamp($ts); - - return [ - [ - 'getCurrentUser', - [], - new User(), - ], - [ - 'setCurrentUser', - [new User()], - null, - ], - [ - 'hasAccess', - ['module', 'function', new User()], - ['limitations'], - ], - [ - 'canUser', - ['module', 'function', new User(), new Location()], - false, - ], - [ - 'beginTransaction', - [], - true, - ], - [ - 'commit', - [], - true, - ], - [ - 'rollback', - [], - true, - ], - ]; - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/RoleServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/RoleServiceTest.php deleted file mode 100644 index 5cf2459dc02..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/RoleServiceTest.php +++ /dev/null @@ -1,325 +0,0 @@ -createMock(APIRoleService::class); - } - - protected function getSignalSlotService($coreService, SignalDispatcher $dispatcher) - { - return new RoleService($coreService, $dispatcher); - } - - public function serviceProvider() - { - $roleId = 3; - $roleIdentifier = 'role_identifier'; - $policyId = 42; - $userId = 14; - $userGroupId = 25; - - $role = new Role( - [ - 'id' => $roleId, - 'identifier' => $roleIdentifier, - ] - ); - $roleDraft = new RoleDraft(['innerRole' => $role]); - $policy = new Policy( - [ - 'id' => $policyId, - 'roleId' => $roleId, - ] - ); - $policyDraft = new PolicyDraft(['innerPolicy' => $policy]); - $roleCreateStruct = new RoleCreateStruct(); - $roleUpdateStruct = new RoleUpdateStruct(); - $policyCreateStruct = new PolicyCreateStruct(); - $policyUpdateStruct = new PolicyUpdateStruct(); - - $userGroup = $this->getUserGroup($userGroupId, md5('user group'), 3); - $roleLimitation = new SectionLimitation(); - - $user = $this->getUser($userId, md5('user'), 4); - $roleAssignement = new UserRoleAssignment( - [ - 'user' => $user, - 'role' => $role, - ] - ); - $userGroupRoleAssignement = new UserGroupRoleAssignment( - [ - 'userGroup' => $userGroup, - 'role' => $role, - ] - ); - - return [ - [ - 'createRole', - [$roleCreateStruct], - $role, - 1, - RoleServiceSignals\CreateRoleSignal::class, - ['roleId' => $roleId], - ], - [ - 'createRoleDraft', - [$role], - $role, - 1, - RoleServiceSignals\CreateRoleDraftSignal::class, - ['roleId' => $roleId], - ], - [ - 'updateRole', - [$role, $roleUpdateStruct], - $role, - 1, - RoleServiceSignals\UpdateRoleSignal::class, - ['roleId' => $roleId], - ], - [ - 'updateRoleDraft', - [$roleDraft, $roleUpdateStruct], - $roleDraft, - 1, - RoleServiceSignals\UpdateRoleDraftSignal::class, - ['roleId' => $roleId], - ], - [ - 'publishRoleDraft', - [$roleDraft], - $roleDraft, - 1, - RoleServiceSignals\PublishRoleDraftSignal::class, - ['roleId' => $roleId], - ], - [ - 'addPolicy', - [$role, $policyCreateStruct], - $role, - 1, - RoleServiceSignals\AddPolicySignal::class, - [ - 'roleId' => $roleId, - 'policyId' => $roleId, - ], - ], - [ - 'addPolicyByRoleDraft', - [$roleDraft, $policyCreateStruct], - $roleDraft, - 1, - RoleServiceSignals\AddPolicyByRoleDraftSignal::class, - [ - 'roleId' => $roleId, - 'policyId' => $roleId, - ], - ], - [ - 'removePolicyByRoleDraft', - [$roleDraft, $policyDraft], - $roleDraft, - 1, - RoleServiceSignals\RemovePolicyByRoleDraftSignal::class, - [ - 'roleId' => $roleId, - 'policyId' => $policyId, - ], - ], - [ - 'deletePolicy', - [$policy], - null, - 1, - RoleServiceSignals\RemovePolicySignal::class, - [ - 'roleId' => $roleId, - 'policyId' => $policyId, - ], - ], - [ - 'updatePolicy', - [$policy, $policyUpdateStruct], - $policy, - 1, - RoleServiceSignals\UpdatePolicySignal::class, - ['policyId' => $policyId], - ], - [ - 'loadRole', - [$roleId], - $role, - 0, - ], - [ - 'loadRoleDraft', - [$roleId], - $roleDraft, - 0, - ], - [ - 'loadRoleByIdentifier', - [$roleIdentifier], - $role, - 0, - ], - [ - 'loadRoles', - [], - [$role], - 0, - ], - [ - 'deleteRole', - [$role], - null, - 1, - RoleServiceSignals\DeleteRoleSignal::class, - ['roleId' => $roleId], - ], - [ - 'deleteRoleDraft', - [$roleDraft], - null, - 1, - RoleServiceSignals\DeleteRoleDraftSignal::class, - ['roleId' => $roleId], - ], - [ - 'loadPoliciesByUserId', - [$userId], - [$policy], - 0, - ], - [ - 'assignRoleToUserGroup', - [$role, $userGroup, $roleLimitation], - null, - 1, - RoleServiceSignals\AssignRoleToUserGroupSignal::class, - [ - 'roleId' => $roleId, - 'userGroupId' => $userGroupId, - 'roleLimitation' => $roleLimitation, - ], - ], - [ - 'unassignRoleFromUserGroup', - [$role, $userGroup], - null, - 1, - RoleServiceSignals\UnassignRoleFromUserGroupSignal::class, - [ - 'roleId' => $roleId, - 'userGroupId' => $userGroupId, - ], - ], - [ - 'assignRoleToUser', - [$role, $user, $roleLimitation], - null, - 1, - RoleServiceSignals\AssignRoleToUserSignal::class, - [ - 'roleId' => $roleId, - 'userId' => $userId, - 'roleLimitation' => $roleLimitation, - ], - ], - [ - 'unassignRoleFromUser', - [$role, $user], - null, - 1, - RoleServiceSignals\UnassignRoleFromUserSignal::class, - [ - 'roleId' => $roleId, - 'userId' => $userId, - ], - ], - [ - 'getRoleAssignments', - [$role], - [$roleAssignement], - 0, - ], - [ - 'getRoleAssignmentsForUser', - [$user, true], - [$roleAssignement], - 0, - ], - [ - 'getRoleAssignmentsForUserGroup', - [$userGroup], - [$userGroupRoleAssignement], - 0, - ], - [ - 'newRoleCreateStruct', - ['new role name'], - $roleCreateStruct, - 0, - ], - [ - 'newPolicyCreateStruct', - ['section', 'view'], - $policyCreateStruct, - 0, - ], - [ - 'newPolicyUpdateStruct', - [], - $policyUpdateStruct, - 0, - ], - [ - 'newRoleUpdateStruct', - [], - $roleUpdateStruct, - 0, - ], - [ - 'getLimitationType', - ['identifier'], - $this->createMock(LimitationType::class), - 0, - ], - [ - 'getLimitationTypesByModuleFunction', - ['module', 'function'], - [$this->createMock(LimitationType::class)], - 0, - ], - ]; - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/SearchServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/SearchServiceTest.php deleted file mode 100644 index 8948cb0b756..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/SearchServiceTest.php +++ /dev/null @@ -1,96 +0,0 @@ -createMock(APISearchService::class); - } - - protected function getSignalSlotService($coreService, SignalDispatcher $dispatcher) - { - return new SearchService($coreService, $dispatcher); - } - - public function serviceProvider() - { - $languageFilter = ['languages' => ['fre-FR']]; - $content = $this->getContent( - $this->getVersionInfo( - $this->getContentInfo(42, md5(__METHOD__)), - 4 - ) - ); - $criterion = new Visibility(Visibility::VISIBLE); - - return [ - [ - 'findContent', - [ - new Query(), - $languageFilter, - false, - ], - new SearchResult(['totalCount' => 0]), - 0, - ], - [ - 'findContentInfo', - [ - new Query(), - $languageFilter, - false, - ], - new SearchResult(['totalCount' => 0]), - 0, - ], - [ - 'findSingle', - [ - $criterion, - $languageFilter, - false, - ], - $content, - 0, - ], - [ - 'findLocations', - [ - new LocationQuery(), - $languageFilter, - false, - ], - new SearchResult(['totalCount' => 0]), - 0, - ], - [ - 'suggest', - [ - 'awesome', - [], - 20, - $criterion, - ], - null, - 0, - ], - ]; - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/SectionServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/SectionServiceTest.php deleted file mode 100644 index 72a6333bdb3..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/SectionServiceTest.php +++ /dev/null @@ -1,150 +0,0 @@ -createMock(APISectionService::class); - } - - protected function getSignalSlotService($coreService, SignalDispatcher $dispatcher) - { - return new SectionService($coreService, $dispatcher); - } - - public function serviceProvider() - { - $sectionId = 1; - $sectionIdentifier = 'mordor'; - $sectionName = 'Mordor'; - $locationId = 46; - $contentId = 42; - - $section = new Section( - [ - 'id' => $sectionId, - 'identifier' => $sectionIdentifier, - 'name' => $sectionName, - ] - ); - - $location = new Location([ - 'id' => $locationId, - ]); - - $contentInfo = $this->getContentInfo($contentId, md5('Osgiliath')); - - $sectionCreateStruct = new SectionCreateStruct(); - $sectionUpdateStruct = new SectionUpdateStruct(); - - return [ - [ - 'createSection', - [$sectionCreateStruct], - $section, - 1, - SectionServiceSignal\CreateSectionSignal::class, - ['sectionId' => $sectionId], - ], - [ - 'updateSection', - [$section, $sectionUpdateStruct], - $section, - 1, - SectionServiceSignal\UpdateSectionSignal::class, - ['sectionId' => $sectionId], - ], - [ - 'loadSection', - [$sectionId], - $section, - 0, - ], - [ - 'loadSections', - [], - [$section], - 0, - ], - [ - 'loadSectionByIdentifier', - [$sectionIdentifier], - $section, - 0, - ], - [ - 'countAssignedContents', - [$section], - 42, - 0, - ], - [ - 'isSectionUsed', - [$section], - true, - 0, - ], - [ - 'assignSection', - [$contentInfo, $section], - null, - 1, - SectionServiceSignal\AssignSectionSignal::class, - [ - 'contentId' => $contentId, - 'sectionId' => $sectionId, - ], - ], - [ - 'assignSectionToSubtree', - [$location, $section], - null, - 1, - SectionServiceSignal\AssignSectionToSubtreeSignal::class, - [ - 'locationId' => $locationId, - 'sectionId' => $sectionId, - ], - ], - [ - 'deleteSection', - [$section], - null, - 1, - SectionServiceSignal\DeleteSectionSignal::class, - [ - 'sectionId' => $sectionId, - ], - ], - [ - 'newSectionCreateStruct', - [], - $sectionCreateStruct, - 0, - ], - [ - 'newSectionUpdateStruct', - [], - $sectionUpdateStruct, - 0, - ], - ]; - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/ServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/ServiceTest.php deleted file mode 100644 index 4d700362bbd..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/ServiceTest.php +++ /dev/null @@ -1,199 +0,0 @@ -getServiceMock(); - $innerService->expects($this->once()) - ->method($method) - ->will( - $this->returnValueMap( - [ - array_merge($parameters, [$return]), - ] - ) - ); - - $dispatcher = $this->createMock(SignalDispatcher::class); - $that = $this; - $d = $dispatcher->expects($this->exactly($emitNr)) - ->method('emit'); - if ($emitNr && $signalClass && $signalAttr) { - $d->with( - $this->callback( - function ($signal) use ($that, $signalClass, $signalAttr) { - if (!$signal instanceof $signalClass) { - $that->fail( - "The signal is not an instance of $signalClass" - ); - - return false; - } - foreach ($signalAttr as $attr => $val) { - if ($signal->{$attr} !== $val) { - $that->fail( - "The attribute '{$attr}' of the signal does not have the correct value '{$val}'" - ); - - return false; - } - } - - return true; - } - ) - ); - } - $service = $this->getSignalSlotService($innerService, $dispatcher); - $result = call_user_func_array([$service, $method], $parameters); - - $this->assertTrue($result === $return); - } - - /** - * Creates a content info from $contentId and $remoteId. - * - * @param mixed $contentId - * @param mixed $remoteId - * - * @return \eZ\Publish\API\Repository\Values\Content\ContentInfo - */ - protected function getContentInfo($contentId, $remoteId) - { - return new ContentInfo( - ['id' => $contentId, 'remoteId' => $remoteId] - ); - } - - /** - * Creates a version info object from $contentInfo and $versionNo. - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - * @param int $versionNo - * - * @return \eZ\Publish\API\Repository\Values\Content\VersionInfo - */ - protected function getVersionInfo(ContentInfo $contentInfo, $versionNo) - { - return new VersionInfo( - [ - 'contentInfo' => $contentInfo, - 'versionNo' => $versionNo, - ] - ); - } - - /** - * Creates a content object from $versionInfo. - * - * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo - * - * @return \eZ\Publish\API\Repository\Values\Content\Content - */ - protected function getContent(VersionInfo $versionInfo) - { - return new Content( - [ - 'versionInfo' => $versionInfo, - 'internalFields' => [], - ] - ); - } - - /** - * Creates a User object from $userId, $userRemoteId and $userVersionNo. - * - * @param mixed $userId - * @param mixed $userRemoteId - * @param int $userVersionNo - * - * @return \eZ\Publish\Core\Repository\Values\User\User - */ - protected function getUser($userId, $userRemoteId, $userVersionNo) - { - return new User( - [ - 'content' => $this->getContent( - $this->getVersionInfo( - $this->getContentInfo($userId, $userRemoteId), - $userVersionNo - ) - ), - ] - ); - } - - /** - * Returns a new UserGroup. - * - * @param mixed $groupId - * @param mixed $groupRemoteId - * @param int $groupVersioNo - * - * @return \eZ\Publish\Core\Repository\Values\User\UserGroup - */ - protected function getUserGroup($groupId, $groupRemoteId, $groupVersioNo) - { - return new UserGroup( - [ - 'content' => $this->getContent( - $this->getVersionInfo( - $this->getContentInfo($groupId, $groupRemoteId), - $groupVersioNo - ) - ), - ] - ); - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/SignalDispatcher/DefaultSignalDispatcherTest.php b/eZ/Publish/Core/SignalSlot/Tests/SignalDispatcher/DefaultSignalDispatcherTest.php deleted file mode 100644 index 8d686d2afea..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/SignalDispatcher/DefaultSignalDispatcherTest.php +++ /dev/null @@ -1,81 +0,0 @@ -createMock(SignalSlot\Signal::class); - - $dispatcher = new SignalSlot\SignalDispatcher\DefaultSignalDispatcher(); - $dispatcher->emit($signal); - } - - public function testEmitSignalSingleSlot() - { - $signal = $this->createMock(SignalSlot\Signal::class); - $slot = $this->createMock(SignalSlot\Slot::class); - $slot - ->expects($this->once()) - ->method('receive') - ->with($signal); - - $dispatcher = new SignalSlot\SignalDispatcher\DefaultSignalDispatcher(); - $dispatcher->attach('\\' . get_class($signal), $slot); - $dispatcher->emit($signal); - } - - public function testEmitSignalSingleSlotRelative() - { - $signal = new SignalSlot\Signal\ContentService\PublishVersionSignal(); - $slot = $this->createMock(SignalSlot\Slot::class); - $slot - ->expects($this->once()) - ->method('receive') - ->with($signal); - - $dispatcher = new SignalSlot\SignalDispatcher\DefaultSignalDispatcher(); - $dispatcher->attach('ContentService\\PublishVersionSignal', $slot); - $dispatcher->emit($signal); - } - - public function testEmitSignalMultipleSlots() - { - $signal = $this->createMock(SignalSlot\Signal::class); - $slot = $this->createMock(SignalSlot\Slot::class); - $slot - ->expects($this->once()) - ->method('receive') - ->with($signal); - $slot2 = $this->createMock(SignalSlot\Slot::class); - $slot2 - ->expects($this->once()) - ->method('receive') - ->with($signal); - $slot3 = $this->createMock(SignalSlot\Slot::class); - $slot3 - ->expects($this->once()) - ->method('receive') - ->with($signal); - - $dispatcher = new SignalSlot\SignalDispatcher\DefaultSignalDispatcher(); - $dispatcher->attach('\\' . get_class($signal), $slot); - $dispatcher->attach('\\' . get_class($signal), $slot2); - // Registering a wildcard slot. It is supposed to receive all the signals, whatever they are. - $dispatcher->attach('*', $slot3); - $dispatcher->emit($signal); - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/SlotFactory/GeneralSlotFactoryTest.php b/eZ/Publish/Core/SignalSlot/Tests/SlotFactory/GeneralSlotFactoryTest.php deleted file mode 100644 index b8d8084268e..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/SlotFactory/GeneralSlotFactoryTest.php +++ /dev/null @@ -1,64 +0,0 @@ - true, 'slot2' => true]], - [ - [ - 'slot1' => $this->createMock(SignalSlot\Slot::class), - 'slot2' => $this->createMock(SignalSlot\Slot::class), - ], - ], - ]; - } - - /** - * @dataProvider providerForFactoryTests - */ - public function testValidSlot($slots) - { - $factory = $this->setUpFactory($slots); - foreach ($slots as $slotIdentifier => $slotValue) { - $this->assertEquals($slotValue, $factory->getSlot($slotIdentifier)); - } - } - - /** - * @dataProvider providerForFactoryTests - */ - public function testInValidSlot($slots) - { - $factory = $this->setUpFactory($slots); - foreach (array_keys($slots) as $slotIdentifier) { - try { - $factory->getSlot($slotIdentifier . '42'); - $this->fail('expected NotFoundException '); - } catch (NotFoundException $e) { - } - } - } - - private function setUpFactory($slots) - { - return new SignalSlot\SlotFactory\GeneralSlotFactory($slots); - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/TrashServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/TrashServiceTest.php deleted file mode 100644 index f7314bf1738..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/TrashServiceTest.php +++ /dev/null @@ -1,153 +0,0 @@ -createMock(APITrashService::class); - } - - protected function getSignalSlotService($coreService, SignalDispatcher $dispatcher) - { - return new TrashService($coreService, $dispatcher); - } - - public function serviceProvider() - { - $newParentLocationId = 2; - $trashItemId = $locationId = 60; - $contentId = 59; - $trashItemContentInfo = $this->getContentInfo($contentId, md5('trash')); - $trashItemParentLocationId = 17; - - $trashItem = new TrashItem( - [ - 'id' => $trashItemId, - 'contentInfo' => $trashItemContentInfo, - 'parentLocationId' => $trashItemParentLocationId, - ] - ); - - $newParentLocation = new Location( - [ - 'id' => $newParentLocationId, - 'contentInfo' => $this->getContentInfo(53, md5('root')), - ] - ); - - $location = new Location( - [ - 'id' => $locationId, - 'contentInfo' => $trashItemContentInfo, - 'parentLocationId' => $trashItemParentLocationId, - ] - ); - - $locationWithNewParent = new Location( - [ - 'id' => $locationId, - 'contentInfo' => $trashItemContentInfo, - 'parentLocationId' => $newParentLocationId, - ] - ); - - $trashItemDeleteResult = new TrashItemDeleteResult( - [ - 'trashItemId' => $trashItemId, - 'contentId' => $contentId, - 'contentRemoved' => true, - ] - ); - - $trashItemDeleteResultList = new TrashItemDeleteResultList( - [ - 'items' => [$trashItemDeleteResult], - ] - ); - - return [ - [ - 'loadTrashItem', - [$trashItemId], - $trashItem, - 0, - ], - [ - 'trash', - [$location], - $trashItem, - 1, - TrashServiceSignals\TrashSignal::class, - ['locationId' => $locationId], - ], - [ - 'recover', - [$trashItem, $newParentLocation], - $locationWithNewParent, - 1, - 'eZ\Publish\Core\SignalSlot\Signal\TrashService\RecoverSignal', - [ - 'trashItemId' => $trashItemId, - 'newParentLocationId' => $newParentLocationId, - 'newLocationId' => $locationId, - ], - ], - [ - 'recover', - [$trashItem, null], - $location, - 1, - TrashServiceSignals\RecoverSignal::class, - [ - 'trashItemId' => $trashItemId, - 'newParentLocationId' => $trashItemParentLocationId, - 'newLocationId' => $locationId, - ], - ], - [ - 'emptyTrash', - [], - $trashItemDeleteResultList, - 1, - TrashServiceSignals\EmptyTrashSignal::class, - ['trashItemDeleteResultList' => $trashItemDeleteResultList], - ], - [ - 'deleteTrashItem', - [$trashItem], - $trashItemDeleteResult, - 1, - TrashServiceSignals\DeleteTrashItemSignal::class, - [ - 'trashItemId' => $trashItemId, - 'trashItemDeleteResult' => $trashItemDeleteResult, - ], - ], - [ - 'findTrashItems', - [new Query()], - new SearchResult(['totalCount' => 0]), - 0, - ], - ]; - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/URLAliasServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/URLAliasServiceTest.php deleted file mode 100644 index eab4cee2851..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/URLAliasServiceTest.php +++ /dev/null @@ -1,147 +0,0 @@ -createMock(APIURLAliasService::class); - } - - protected function getSignalSlotService($coreService, SignalDispatcher $dispatcher) - { - return new URLAliasService($coreService, $dispatcher); - } - - public function serviceProvider() - { - $locationId = 60; - $locationPath = '/bugs-bunny'; - $locationRemoteId = md5('bugs bunny'); - - $urlAliasId = '42-foobar'; - $globalUrlAliasId = 'rabbit'; - $path = '/lapin'; - $globalPath = '/lapins'; - $globalDestination = '/characters/rabbits'; - $languageCode = 'fre-FR'; - $forward = true; - $alwaysAvailable = true; - - $contentInfo = $this->getContentInfo(59, md5('bugs bunny contnet')); - - $location = new Location( - [ - 'id' => $locationId, - 'path' => $locationPath, - 'remoteId' => $locationRemoteId, - 'contentInfo' => $contentInfo, - ] - ); - - $locationUrlAlias = new URLAlias( - [ - 'id' => $urlAliasId, - 'type' => URLAlias::LOCATION, - 'destination' => $locationId, - 'path' => $path, - 'languageCodes' => [$languageCode], - 'forward' => $forward, - ] - ); - - $globalUrlAlias = new URLAlias( - [ - 'id' => $globalUrlAliasId, - 'type' => URLAlias::RESOURCE, - 'destination' => $globalDestination, - 'path' => $globalPath, - 'languageCodes' => [$languageCode], - 'forward' => $forward, - ] - ); - - $aliasList = [$globalUrlAlias, $locationUrlAlias]; - - return [ - [ - 'createUrlAlias', - [ - $location, $path, $languageCode, $forward, $alwaysAvailable, - ], - $locationUrlAlias, - 1, - URLAliasServiceSignals\CreateUrlAliasSignal::class, - ['urlAliasId' => $urlAliasId], - ], - [ - 'createGlobalUrlAlias', - [ - $globalPath, - $globalDestination, - $languageCode, - $forward, - $alwaysAvailable, - ], - $globalUrlAlias, - 1, - URLAliasServiceSignals\CreateGlobalUrlAliasSignal::class, - ['urlAliasId' => $globalUrlAliasId], - ], - [ - 'listLocationAliases', - [$location, false, $languageCode, false, []], - [$locationUrlAlias], - 0, - ], - [ - 'listGlobalAliases', - [$languageCode, 1, 2], - [$globalUrlAlias], - 0, - ], - [ - 'removeAliases', - [$aliasList], - null, - 1, - URLAliasServiceSignals\RemoveAliasesSignal::class, - [ - 'aliasList' => $aliasList, - ], - ], - [ - 'lookup', - [$path, $languageCode], - $locationUrlAlias, - 0, - ], - [ - 'reverseLookup', - [$location, $languageCode, false, []], - $locationUrlAlias, - 0, - ], - [ - 'load', - [$urlAliasId], - $locationUrlAlias, - 0, - ], - ]; - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/URLServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/URLServiceTest.php deleted file mode 100644 index 639309dc0bf..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/URLServiceTest.php +++ /dev/null @@ -1,96 +0,0 @@ -getApiUrl(12, 'http://ez.no'); - - return [ - [ - 'updateUrl', - [ - $url, - new URLUpdateStruct([ - 'url' => 'http://ezplatform.com', - ]), - ], - $this->getApiUrl(12, 'http://ezplatform.com', true), - 1, - UpdateUrlSignal::class, - ['urlId' => $url->id, 'urlChanged' => true], - ], - [ - 'updateUrl', - [ - $url, - new URLUpdateStruct([ - 'isValid' => false, - ]), - ], - $this->getApiUrl(12, 'http://ez.no', false), - 1, - UpdateUrlSignal::class, - ['urlId' => $url->id, 'urlChanged' => false], - ], - [ - 'createUpdateStruct', - [], - new URLUpdateStruct(), - 0, - ], - [ - 'findUrls', - [new URLQuery()], - new SearchResult(), - 0, - ], - [ - 'loadById', - [12], - $url, - 0, - ], - [ - 'loadByUrl', - ['http://ez.no'], - $url, - 0, - ], - ]; - } - - protected function getServiceMock() - { - return $this->createMock(APIURLService::class); - } - - protected function getSignalSlotService($innerService, SignalDispatcher $dispatcher) - { - return new URLService($innerService, $dispatcher); - } - - private function getApiUrl($id = null, $url = null, $isValid = false) - { - return new URL([ - 'id' => $id, - 'url' => $url, - 'isValid' => $isValid, - ]); - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/URLWildcardServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/URLWildcardServiceTest.php deleted file mode 100644 index 168322c36e3..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/URLWildcardServiceTest.php +++ /dev/null @@ -1,89 +0,0 @@ -createMock(APIURLWildcardService::class); - } - - protected function getSignalSlotService($coreService, SignalDispatcher $dispatcher) - { - return new URLWildcardService($coreService, $dispatcher); - } - - public function serviceProvider() - { - $wildcardId = 42; - $sourceUrl = '/cms'; - $destinationUrl = '/cxm'; - $forward = true; - $wildcard = new URLWildcard( - [ - 'id' => $wildcardId, - 'sourceUrl' => $sourceUrl, - 'destinationUrl' => $destinationUrl, - 'forward' => $forward, - ] - ); - - return [ - [ - 'create', - [$sourceUrl, $destinationUrl, $forward], - $wildcard, - 1, - URLWildcardServiceSignals\CreateSignal::class, - ['urlWildcardId' => $wildcardId], - ], - [ - 'remove', - [$wildcard], - null, - 1, - URLWildcardServiceSignals\RemoveSignal::class, - ['urlWildcardId' => $wildcardId], - ], - [ - 'load', - [$wildcardId], - $wildcard, - 0, - ], - [ - 'loadAll', - [0, 1], - [$wildcard], - 0, - ], - [ - 'translate', - [$sourceUrl], - new URLWildcardTranslationResult( - [ - 'uri' => $destinationUrl, - 'forward' => $forward, - ] - ), - 1, - URLWildcardServiceSignals\TranslateSignal::class, - ['url' => $sourceUrl], - ], - ]; - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/UserPreferenceServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/UserPreferenceServiceTest.php deleted file mode 100644 index fbfdeff0f2e..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/UserPreferenceServiceTest.php +++ /dev/null @@ -1,69 +0,0 @@ - 'timezone', - 'value' => 'America/New_York', - ]); - - return [ - [ - 'loadUserPreferences', - [0, 25], - new UserPreferenceList(), - 0, - ], - [ - 'setUserPreference', - [[$setStruct]], - null, - 1, - UserPreferenceSetSignal::class, - [ - 'name' => $setStruct->name, - 'value' => $setStruct->value, - ], - ], - [ - 'getUserPreferenceCount', - [], - 10, - 0, - ], - ]; - } - - /** - * {@inheritdoc} - */ - protected function getServiceMock() - { - return $this->createMock(APIUserPreferenceService::class); - } - - /** - * {@inheritdoc} - */ - protected function getSignalSlotService($innerService, SignalDispatcher $dispatcher) - { - return new UserPreferenceService($innerService, $dispatcher); - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/UserServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/UserServiceTest.php deleted file mode 100644 index ae43a49a4cd..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/UserServiceTest.php +++ /dev/null @@ -1,315 +0,0 @@ -createMock(APIUserService::class); - } - - protected function getSignalSlotService($coreService, SignalDispatcher $dispatcher) - { - return new UserService($coreService, $dispatcher); - } - - public function serviceProvider() - { - $userGroupId = 12; - $parentGroup2Id = 13; - $userId = 14; - - $parentGroup = $this->getUserGroup(11, md5('parent'), 1); - $userGroup = $this->getUserGroup($userGroupId, md5('user group'), 2); - $parentGroup2 = $this->getUserGroup($parentGroup2Id, md5('parent2'), 1); - - $user = $this->getUser($userId, md5("I'm the boss"), 4); - $anonymous = $this->getUser(10, md5('invisible man'), 1); - $login = 'bugsbunny'; - $password = "what's up doc?"; - $email = 'bugs@warnerbros.com'; - $mainLanguageCode = 'eng-US'; - $contentType = new ContentType( - [ - 'id' => 42, - 'identifier' => 'rabbit', - 'fieldDefinitions' => [], - ] - ); - $groupContentType = new ContentType( - [ - 'id' => 43, - 'identifier' => 'characters', - 'fieldDefinitions' => [], - ] - ); - - $userCreateStruct = new UserCreateStruct( - [ - 'contentType' => $contentType, - 'mainLanguageCode' => $mainLanguageCode, - 'login' => $login, - 'password' => $password, - 'enabled' => true, - 'fields' => [], - ] - ); - $userUpdateStruct = new UserUpdateStruct(); - $userGroupCreateStruct = new UserGroupCreateStruct( - [ - 'mainLanguageCode' => $mainLanguageCode, - 'contentType' => $contentType, - ] - ); - $userGroupUpdateStruct = new UserGroupUpdateStruct(); - $passwordValidationContext = new PasswordValidationContext(); - - return [ - [ - 'createUserGroup', - [$userGroupCreateStruct, $parentGroup], - $userGroup, - 1, - UserServiceSignals\CreateUserGroupSignal::class, - ['userGroupId' => $userGroupId], - ], - [ - 'loadUserGroup', - [$userGroupId, []], - $userGroup, - 0, - ], - [ - 'loadUserGroup', - [$userGroupId, ['eng-GB', 'eng-US']], - $userGroup, - 0, - ], - [ - 'loadSubUserGroups', - [$parentGroup, 1, 1, []], - [$userGroup], - 0, - ], - [ - 'loadSubUserGroups', - [$parentGroup, 1, 1, ['eng-GB', 'eng-US']], - [$userGroup], - 0, - ], - [ - 'deleteUserGroup', - [$userGroup], - null, - 1, - UserServiceSignals\DeleteUserGroupSignal::class, - ['userGroupId' => $userGroupId], - ], - [ - 'moveUserGroup', - [$userGroup, $parentGroup2], - null, - 1, - UserServiceSignals\MoveUserGroupSignal::class, - [ - 'userGroupId' => $userGroupId, - 'newParentId' => $parentGroup2Id, - ], - ], - [ - 'updateUserGroup', - [$userGroup, $userGroupUpdateStruct], - $userGroup, - 1, - UserServiceSignals\UpdateUserGroupSignal::class, - ['userGroupId' => $userGroupId], - ], - [ - 'createUser', - [$userCreateStruct, [$userGroup]], - $user, - 1, - UserServiceSignals\CreateUserSignal::class, - ['userId' => $userId], - ], - [ - 'loadUser', - [$userId, []], - $user, - 0, - ], - [ - 'loadUser', - [$userId, ['eng-GB', 'eng-US']], - $user, - 0, - ], - [ - 'loadAnonymousUser', - [], - $user, - 0, - ], - [ - 'loadUserByCredentials', - ['admin', 'with great power comes great responsibility', []], - $user, - 0, - ], - [ - 'loadUserByCredentials', - ['admin', 'with great power comes great responsibility', ['eng-GB', 'eng-US']], - $user, - 0, - ], - [ - 'loadUserByLogin', - ['admin', []], - $user, - 0, - ], - [ - 'loadUserByLogin', - ['admin', ['eng-GB', 'eng-US']], - $user, - 0, - ], - [ - 'loadUsersByEmail', - ['admin@ez.no', []], - [$user], - 0, - ], - [ - 'loadUsersByEmail', - ['admin@ez.no', ['eng-GB', 'eng-US']], - [$user], - 0, - ], - [ - 'deleteUser', - [$user], - null, - 1, - UserServiceSignals\DeleteUserSignal::class, - ['userId' => $userId], - ], - [ - 'updateUser', - [$user, $userUpdateStruct], - null, - 1, - UserServiceSignals\UpdateUserSignal::class, - ['userId' => $userId], - ], - [ - 'assignUserToUserGroup', - [$user, $parentGroup2], - null, - 1, - UserServiceSignals\AssignUserToUserGroupSignal::class, - [ - 'userId' => $userId, - 'userGroupId' => $parentGroup2Id, - ], - ], - [ - 'unassignUserFromUserGroup', - [$user, $parentGroup2], - null, - 1, - UserServiceSignals\UnAssignUserFromUserGroupSignal::class, - [ - 'userId' => $userId, - 'userGroupId' => $parentGroup2Id, - ], - ], - [ - 'loadUserGroupsOfUser', - [$user, 1, 1, []], - [$userGroup], - 0, - ], - [ - 'loadUserGroupsOfUser', - [$user, 1, 1, ['eng-GB', 'eng-US']], - [$userGroup], - 0, - ], - [ - 'loadUsersOfUserGroup', - [$userGroup, 1, 1, []], - [$user], - 0, - ], - [ - 'loadUsersOfUserGroup', - [$userGroup, 1, 1, ['eng-GB', 'eng-US']], - [$user], - 0, - ], - [ - 'isUser', - [$userGroup], - false, - 0, - ], - [ - 'isUserGroup', - [$userGroup], - true, - 0, - ], - [ - 'newUserCreateStruct', - [ - $login, $email, $password, $mainLanguageCode, $contentType, - ], - $userCreateStruct, - 0, - ], - [ - 'newUserGroupCreateStruct', - [$mainLanguageCode, $groupContentType], - $userGroupCreateStruct, - 0, - ], - [ - 'newUserUpdateStruct', - [], - $userUpdateStruct, - 0, - ], - [ - 'newUserGroupUpdateStruct', - [], - $userGroupUpdateStruct, - 0, - ], - [ - 'validatePassword', - [$password, $passwordValidationContext], - [], - 0, - ], - ]; - } -} diff --git a/eZ/Publish/Core/SignalSlot/TrashService.php b/eZ/Publish/Core/SignalSlot/TrashService.php deleted file mode 100644 index c7dbd948ce9..00000000000 --- a/eZ/Publish/Core/SignalSlot/TrashService.php +++ /dev/null @@ -1,186 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * Loads a trashed location object from its $id. - * - * Note that $id is identical to original location, which has been previously trashed - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read the trashed location - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the location with the given id does not exist - * - * @param mixed $trashItemId - * - * @return \eZ\Publish\API\Repository\Values\Content\TrashItem - */ - public function loadTrashItem($trashItemId) - { - return $this->service->loadTrashItem($trashItemId); - } - - /** - * Sends $location and all its children to trash and returns the corresponding trash item. - * - * The current user may not have access to the returned trash item, check before using it. - * Content is left untouched. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to trash the given location - * - * @param \eZ\Publish\API\Repository\Values\Content\Location $location - * - * @return null|\eZ\Publish\API\Repository\Values\Content\TrashItem null if location was deleted, otherwise TrashItem - */ - public function trash(Location $location) - { - $returnValue = $this->service->trash($location); - $this->signalDispatcher->emit( - new TrashSignal( - [ - 'locationId' => $location->id, - 'parentLocationId' => $location->parentLocationId, - 'contentId' => $location->contentId, - 'contentTrashed' => $returnValue instanceof TrashItem, - ] - ) - ); - - return $returnValue; - } - - /** - * Recovers the $trashedLocation at its original place if possible. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to recover the trash item at the parent location location - * - * If $newParentLocation is provided, $trashedLocation will be restored under it. - * - * @param \eZ\Publish\API\Repository\Values\Content\TrashItem $trashItem - * @param \eZ\Publish\API\Repository\Values\Content\Location $newParentLocation - * - * @return \eZ\Publish\API\Repository\Values\Content\Location the newly created or recovered location - */ - public function recover(TrashItem $trashItem, Location $newParentLocation = null) - { - $newLocation = $this->service->recover($trashItem, $newParentLocation); - $this->signalDispatcher->emit( - new RecoverSignal( - [ - 'trashItemId' => $trashItem->id, - 'contentId' => $trashItem->contentId, - 'newParentLocationId' => $newLocation->parentLocationId, - 'newLocationId' => $newLocation->id, - ] - ) - ); - - return $newLocation; - } - - /** - * Empties trash. - * - * All locations contained in the trash will be removed. Content objects will be removed - * if all locations of the content are gone. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to empty the trash - */ - public function emptyTrash() - { - $returnValue = $this->service->emptyTrash(); - - $signal = new EmptyTrashSignal(); - $signal->trashItemDeleteResultList = $returnValue; - - $this->signalDispatcher->emit($signal); - - return $returnValue; - } - - /** - * Deletes a trash item. - * - * The corresponding content object will be removed - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to delete this trash item - * - * @param \eZ\Publish\API\Repository\Values\Content\TrashItem $trashItem - */ - public function deleteTrashItem(TrashItem $trashItem) - { - $returnValue = $this->service->deleteTrashItem($trashItem); - $this->signalDispatcher->emit( - new DeleteTrashItemSignal( - [ - 'trashItemId' => $trashItem->id, - 'trashItemDeleteResult' => $returnValue, - ] - ) - ); - - return $returnValue; - } - - /** - * Returns a collection of Trashed locations contained in the trash, which are readable by the current user. - * - * $query allows to filter/sort the elements to be contained in the collection. - * - * @param \eZ\Publish\API\Repository\Values\Content\Query $query - * - * @return \eZ\Publish\API\Repository\Values\Content\Trash\SearchResult - */ - public function findTrashItems(Query $query) - { - return $this->service->findTrashItems($query); - } -} diff --git a/eZ/Publish/Core/SignalSlot/URLAliasService.php b/eZ/Publish/Core/SignalSlot/URLAliasService.php deleted file mode 100644 index e52972ad6c8..00000000000 --- a/eZ/Publish/Core/SignalSlot/URLAliasService.php +++ /dev/null @@ -1,269 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * Create a user chosen $alias pointing to $location in $languageCode. - * - * This method runs URL filters and transformers before storing them. - * Hence the path returned in the URLAlias Value may differ from the given. - * $alwaysAvailable makes the alias available in all languages. - * - * @param \eZ\Publish\API\Repository\Values\Content\Location $location - * @param string $path - * @param string $languageCode the languageCode for which this alias is valid - * @param bool $forwarding if true a redirect is performed - * @param bool $alwaysAvailable - * - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the path already exists for the given language - * - * @return \eZ\Publish\API\Repository\Values\Content\URLAlias - */ - public function createUrlAlias(Location $location, $path, $languageCode, $forwarding = false, $alwaysAvailable = false) - { - $returnValue = $this->service->createUrlAlias($location, $path, $languageCode, $forwarding, $alwaysAvailable); - $this->signalDispatcher->emit( - new CreateUrlAliasSignal( - [ - 'urlAliasId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Create a user chosen $alias pointing to a resource in $languageCode. - * - * This method does not handle location resources - if a user enters a location target - * the createCustomUrlAlias method has to be used. - * This method runs URL filters and and transformers before storing them. - * Hence the path returned in the URLAlias Value may differ from the given. - * - * $alwaysAvailable makes the alias available in all languages. - * - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the path already exists for the given - * language or if resource is not valid - * - * @param string $resource - * @param string $path - * @param string $languageCode - * @param bool $forwarding - * @param bool $alwaysAvailable - * - * @return \eZ\Publish\API\Repository\Values\Content\URLAlias - */ - public function createGlobalUrlAlias($resource, $path, $languageCode, $forwarding = false, $alwaysAvailable = false) - { - $returnValue = $this->service->createGlobalUrlAlias($resource, $path, $languageCode, $forwarding, $alwaysAvailable); - $this->signalDispatcher->emit( - new CreateGlobalUrlAliasSignal( - [ - 'urlAliasId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * List of url aliases pointing to $location, sorted by language priority. - * - * @param \eZ\Publish\API\Repository\Values\Content\Location $location - * @param bool $custom if true the user generated aliases are listed otherwise the autogenerated - * @param string $languageCode filters those which are valid for the given language - * @param bool|null $showAllTranslations Default false from config, include all alias as if they where always available. - * @param array|null $prioritizedLanguageList By default taken from config, used as prioritized language codes for order of returned objects. - * - * @return \eZ\Publish\API\Repository\Values\Content\URLAlias[] - */ - public function listLocationAliases( - Location $location, - $custom = true, - $languageCode = null, - bool $showAllTranslations = null, - array $prioritizedLanguageList = null - ) { - return $this->service->listLocationAliases( - $location, - $custom, - $languageCode, - $showAllTranslations, - $prioritizedLanguageList - ); - } - - /** - * List global aliases. - * - * @param string $languageCode filters those which are valid for the given language - * @param int $offset - * @param int $limit - * - * @return \eZ\Publish\API\Repository\Values\Content\URLAlias[] - */ - public function listGlobalAliases($languageCode = null, $offset = 0, $limit = -1) - { - return $this->service->listGlobalAliases($languageCode, $offset, $limit); - } - - /** - * Removes urls aliases. - * - * This method does not remove autogenerated aliases for locations. - * - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if alias list contains - * autogenerated alias - * - * @param \eZ\Publish\API\Repository\Values\Content\URLAlias[] $aliasList - */ - public function removeAliases(array $aliasList) - { - $returnValue = $this->service->removeAliases($aliasList); - $this->signalDispatcher->emit( - new RemoveAliasesSignal( - [ - 'aliasList' => $aliasList, - ] - ) - ); - - return $returnValue; - } - - /** - * looks up the URLAlias for the given url. - * - * @param string $url - * @param string $languageCode - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if the path does not exist or is not valid for the given language - * - * @return \eZ\Publish\API\Repository\Values\Content\URLAlias - */ - public function lookup($url, $languageCode = null) - { - return $this->service->lookup($url, $languageCode); - } - - /** - * Returns the URL alias for the given location in the given language. - * - * If $languageCode is null the method returns the url alias in the most prioritized language. - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if no url alias exist for the given language - * - * @param \eZ\Publish\API\Repository\Values\Content\Location $location - * @param string $languageCode - * @param bool|null $showAllTranslations Default false from config, include all alias as if they where always available. - * @param array|null $prioritizedLanguageList By default taken from config, used as prioritized language codes for order of returned objects. - * - * @return \eZ\Publish\API\Repository\Values\Content\URLAlias - */ - public function reverseLookup( - Location $location, - $languageCode = null, - bool $showAllTranslations = null, - array $prioritizedLanguageList = null - ) { - return $this->service->reverseLookup( - $location, - $languageCode, - $showAllTranslations, - $prioritizedLanguageList - ); - } - - /** - * Loads URL alias by given $id. - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - * - * @param string $id - * - * @return \eZ\Publish\API\Repository\Values\Content\URLAlias - */ - public function load($id) - { - return $this->service->load($id); - } - - /** - * Refresh all system URL aliases for the given Location (and historize outdated if needed). - * - * @param \eZ\Publish\API\Repository\Values\Content\Location $location - */ - public function refreshSystemUrlAliasesForLocation(Location $location): void - { - $this->service->refreshSystemUrlAliasesForLocation($location); - - $this->signalDispatcher->emit( - new UpdateLocationSignal( - [ - 'contentId' => $location->contentId, - 'locationId' => $location->id, - 'parentLocationId' => $location->parentLocationId, - ] - ) - ); - } - - /** - * Delete global, system or custom URL alias pointing to non-existent Locations. - * - * @return int Number of deleted URL aliases - */ - public function deleteCorruptedUrlAliases(): int - { - return $this->service->deleteCorruptedUrlAliases(); - } -} diff --git a/eZ/Publish/Core/SignalSlot/URLService.php b/eZ/Publish/Core/SignalSlot/URLService.php deleted file mode 100644 index 1298f218131..00000000000 --- a/eZ/Publish/Core/SignalSlot/URLService.php +++ /dev/null @@ -1,99 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * {@inheritdoc} - */ - public function createUpdateStruct() - { - return $this->service->createUpdateStruct(); - } - - /** - * {@inheritdoc} - */ - public function findUrls(URLQuery $query) - { - return $this->service->findUrls($query); - } - - /** - * {@inheritdoc} - */ - public function findUsages(URL $url, $offset = 0, $limit = -1) - { - return $this->service->findUsages($url, $offset, $limit); - } - - /** - * {@inheritdoc} - */ - public function loadById($id) - { - return $this->service->loadById($id); - } - - /** - * {@inheritdoc} - */ - public function loadByUrl($url) - { - return $this->service->loadByUrl($url); - } - - /** - * {@inheritdoc} - */ - public function updateUrl(URL $url, URLUpdateStruct $struct) - { - $returnValue = $this->service->updateUrl($url, $struct); - - $this->signalDispatcher->emit( - new UpdateUrlSignal([ - 'urlId' => $returnValue->id, - 'urlChanged' => $struct->url !== null, - ]) - ); - - return $returnValue; - } -} diff --git a/eZ/Publish/Core/SignalSlot/URLWildcardService.php b/eZ/Publish/Core/SignalSlot/URLWildcardService.php deleted file mode 100644 index 003d1d96f18..00000000000 --- a/eZ/Publish/Core/SignalSlot/URLWildcardService.php +++ /dev/null @@ -1,154 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * Creates a new url wildcard. - * - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the $sourceUrl pattern already exists - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to create url wildcards - * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if the number of "*" patterns in $sourceUrl and - * the number of {\d} placeholders in $destinationUrl doesn't match or - * if the placeholders aren't a valid number sequence({1}/{2}/{3}), starting with 1. - * - * @param string $sourceUrl - * @param string $destinationUrl - * @param bool $forward - * - * @return \eZ\Publish\API\Repository\Values\Content\UrlWildcard - */ - public function create($sourceUrl, $destinationUrl, $forward = false) - { - $returnValue = $this->service->create($sourceUrl, $destinationUrl, $forward); - $this->signalDispatcher->emit( - new CreateSignal( - [ - 'urlWildcardId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * removes an url wildcard. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to remove url wildcards - * - * @param \eZ\Publish\API\Repository\Values\Content\URLWildcard $urlWildcard the url wildcard to remove - */ - public function remove(URLWildcard $urlWildcard) - { - $returnValue = $this->service->remove($urlWildcard); - $this->signalDispatcher->emit( - new RemoveSignal( - [ - 'urlWildcardId' => $urlWildcard->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Loads a url wild card. - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if the url wild card was not found - * - * @param mixed $id - * - * @return \eZ\Publish\API\Repository\Values\Content\UrlWildcard - */ - public function load($id) - { - return $this->service->load($id); - } - - /** - * Loads all url wild card (paged). - * - * @param int $offset - * @param int $limit - * - * @return \eZ\Publish\API\Repository\Values\Content\UrlWildcard[] - */ - public function loadAll($offset = 0, $limit = -1) - { - return $this->service->loadAll($offset, $limit); - } - - /** - * translates an url to an existing uri resource based on the - * source/destination patterns of the url wildcard. If the resulting - * url is an alias it will be translated to the system uri. - * - * This method runs also configured url translations and filter - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if the url could not be translated - * - * @param mixed $url - * - * @return \eZ\Publish\API\Repository\Values\Content\URLWildcardTranslationResult - */ - public function translate($url) - { - $returnValue = $this->service->translate($url); - $this->signalDispatcher->emit( - new TranslateSignal( - [ - 'url' => $url, - ] - ) - ); - - return $returnValue; - } -} diff --git a/eZ/Publish/Core/SignalSlot/UserPreferenceService.php b/eZ/Publish/Core/SignalSlot/UserPreferenceService.php deleted file mode 100644 index e42ca3ae86e..00000000000 --- a/eZ/Publish/Core/SignalSlot/UserPreferenceService.php +++ /dev/null @@ -1,72 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * {@inheritdoc} - */ - public function setUserPreference(array $userPreferenceSetStructs): void - { - $this->service->setUserPreference($userPreferenceSetStructs); - - foreach ($userPreferenceSetStructs as $userPreferenceSetStruct) { - $this->signalDispatcher->emit(new UserPreferenceSetSignal([ - 'name' => $userPreferenceSetStruct->name, - 'value' => $userPreferenceSetStruct->value, - ])); - } - } - - /** - * {@inheritdoc} - */ - public function getUserPreference(string $userPreferenceName): UserPreference - { - return $this->service->getUserPreference($userPreferenceName); - } - - /** - * {@inheritdoc} - */ - public function loadUserPreferences(int $offset = 0, int $limit = 25): UserPreferenceList - { - return $this->service->loadUserPreferences($offset, $limit); - } - - /** - * {@inheritdoc} - */ - public function getUserPreferenceCount(): int - { - return $this->service->getUserPreferenceCount(); - } -} diff --git a/eZ/Publish/Core/SignalSlot/UserService.php b/eZ/Publish/Core/SignalSlot/UserService.php deleted file mode 100644 index d73fd4366d3..00000000000 --- a/eZ/Publish/Core/SignalSlot/UserService.php +++ /dev/null @@ -1,577 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * Creates a new user group using the data provided in the ContentCreateStruct parameter. - * - * In 4.x in the content type parameter in the profile is ignored - * - the content type is determined via configuration and can be set to null. - * The returned version is published. - * - * @param \eZ\Publish\API\Repository\Values\User\UserGroupCreateStruct $userGroupCreateStruct a structure for setting all necessary data to create this user group - * @param \eZ\Publish\API\Repository\Values\User\UserGroup $parentGroup - * - * @return \eZ\Publish\API\Repository\Values\User\UserGroup - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to create a user group - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the input structure has invalid data - * @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException if a field in the $userGroupCreateStruct is not valid - * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if a required field is missing or set to an empty value - */ - public function createUserGroup(UserGroupCreateStruct $userGroupCreateStruct, UserGroup $parentGroup) - { - $returnValue = $this->service->createUserGroup($userGroupCreateStruct, $parentGroup); - $this->signalDispatcher->emit( - new CreateUserGroupSignal( - [ - 'userGroupId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Loads a user group for the given id. - * - * @param mixed $id - * @param string[] $prioritizedLanguages Used as prioritized language code on translated properties of returned object. - * - * @return \eZ\Publish\API\Repository\Values\User\UserGroup - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to create a user group - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if the user group with the given id was not found - */ - public function loadUserGroup($id, array $prioritizedLanguages = []) - { - return $this->service->loadUserGroup($id, $prioritizedLanguages); - } - - /** - * Loads the sub groups of a user group. - * - * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup - * @param int $offset the start offset for paging - * @param int $limit the number of user groups returned - * @param string[] $prioritizedLanguages Used as prioritized language code on translated properties of returned object. - * - * @return \eZ\Publish\API\Repository\Values\User\UserGroup[] - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read the user group - */ - public function loadSubUserGroups(UserGroup $userGroup, $offset = 0, $limit = 25, array $prioritizedLanguages = []) - { - return $this->service->loadSubUserGroups($userGroup, $offset, $limit, $prioritizedLanguages); - } - - /** - * Removes a user group. - * - * the users which are not assigned to other groups will be deleted. - * - * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to create a user group - */ - public function deleteUserGroup(UserGroup $userGroup) - { - $returnValue = $this->service->deleteUserGroup($userGroup); - $this->signalDispatcher->emit( - new DeleteUserGroupSignal( - [ - 'userGroupId' => $userGroup->id, - 'affectedLocationIds' => $returnValue, - ] - ) - ); - - return $returnValue; - } - - /** - * Moves the user group to another parent. - * - * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup - * @param \eZ\Publish\API\Repository\Values\User\UserGroup $newParent - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to move the user group - */ - public function moveUserGroup(UserGroup $userGroup, UserGroup $newParent) - { - $returnValue = $this->service->moveUserGroup($userGroup, $newParent); - $this->signalDispatcher->emit( - new MoveUserGroupSignal( - [ - 'userGroupId' => $userGroup->id, - 'newParentId' => $newParent->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Updates the group profile with fields and meta data. - * - * 4.x: If the versionUpdateStruct is set in $userGroupUpdateStruct, this method internally creates a content draft, updates ts with the provided data - * and publishes the draft. If a draft is explicitly required, the user group can be updated via the content service methods. - * - * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup - * @param \eZ\Publish\API\Repository\Values\User\UserGroupUpdateStruct $userGroupUpdateStruct - * - * @return \eZ\Publish\API\Repository\Values\User\UserGroup - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to move the user group - * @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException if a field in the $userGroupUpdateStruct is not valid - * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if a required field is set empty - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if a field value is not accepted by the field type - */ - public function updateUserGroup(UserGroup $userGroup, UserGroupUpdateStruct $userGroupUpdateStruct) - { - $returnValue = $this->service->updateUserGroup($userGroup, $userGroupUpdateStruct); - $this->signalDispatcher->emit( - new UpdateUserGroupSignal( - [ - 'userGroupId' => $userGroup->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Create a new user. The created user is published by this method. - * - * @param \eZ\Publish\API\Repository\Values\User\UserCreateStruct $userCreateStruct the data used for creating the user - * @param array $parentGroups the groups of type {@link \eZ\Publish\API\Repository\Values\User\UserGroup} which are assigned to the user after creation - * - * @return \eZ\Publish\API\Repository\Values\User\User - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to move the user group - * @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException if a field in the $userCreateStruct is not valid - * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if a required field is missing or set to an empty value - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if a field value is not accepted by the field type - * if a user with provided login already exists - */ - public function createUser(UserCreateStruct $userCreateStruct, array $parentGroups) - { - $returnValue = $this->service->createUser($userCreateStruct, $parentGroups); - $this->signalDispatcher->emit( - new CreateUserSignal( - [ - 'userId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Loads a user. - * - * @param mixed $userId - * @param string[] $prioritizedLanguages Used as prioritized language code on translated properties of returned object. - * - * @return \eZ\Publish\API\Repository\Values\User\User - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a user with the given id was not found - */ - public function loadUser($userId, array $prioritizedLanguages = []) - { - return $this->service->loadUser($userId, $prioritizedLanguages); - } - - /** - * Loads anonymous user. - * - * @deprecated since 5.3, use loadUser( $anonymousUserId ) instead - * - * @uses ::loadUser() - * - * @return \eZ\Publish\API\Repository\Values\User\User - */ - public function loadAnonymousUser() - { - return $this->service->loadAnonymousUser(); - } - - /** - * Loads a user for the given login and password. - * - * {@inheritdoc} - * - * @param string $login - * @param string $password the plain password - * @param string[] $prioritizedLanguages Used as prioritized language code on translated properties of returned object. - * - * @return \eZ\Publish\API\Repository\Values\User\User - * - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if credentials are invalid - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a user with the given credentials was not found - */ - public function loadUserByCredentials($login, $password, array $prioritizedLanguages = []) - { - return $this->service->loadUserByCredentials($login, $password, $prioritizedLanguages); - } - - /** - * Loads a user for the given login. - * - * {@inheritdoc} - * - * @param string $login - * @param string[] $prioritizedLanguages Used as prioritized language code on translated properties of returned object. - * - * @return \eZ\Publish\API\Repository\Values\User\User - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a user with the given credentials was not found - */ - public function loadUserByLogin($login, array $prioritizedLanguages = []) - { - return $this->service->loadUserByLogin($login, $prioritizedLanguages); - } - - /** - * Loads a user for the given email. - * - * {@inheritdoc} - * - * @param string $email - * @param string[] $prioritizedLanguages Used as prioritized language code on translated properties of returned object. - * - * @return \eZ\Publish\API\Repository\Values\User\User[] - */ - public function loadUsersByEmail($email, array $prioritizedLanguages = []) - { - return $this->service->loadUsersByEmail($email, $prioritizedLanguages); - } - - /** - * Loads a user with user hash key. - * - * {@inheritdoc} - * - * @param string $hash - * @param string[] $prioritizedLanguages Used as prioritized language code on translated properties of returned object. - * - * @return \eZ\Publish\API\Repository\Values\User\User - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a user with the given hash was not found - */ - public function loadUserByToken($hash, array $prioritizedLanguages = []) - { - return $this->service->loadUserByToken($hash, $prioritizedLanguages); - } - - /** - * This method deletes a user. - * - * @param \eZ\Publish\API\Repository\Values\User\User $user - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to delete the user - */ - public function deleteUser(User $user) - { - $returnValue = $this->service->deleteUser($user); - $this->signalDispatcher->emit( - new DeleteUserSignal( - [ - 'userId' => $user->id, - 'affectedLocationIds' => $returnValue, - ] - ) - ); - - return $returnValue; - } - - /** - * Updates a user. - * - * 4.x: If the versionUpdateStruct is set in the user update structure, this method internally creates a content draft, updates ts with the provided data - * and publishes the draft. If a draft is explicitly required, the user group can be updated via the content service methods. - * - * @param \eZ\Publish\API\Repository\Values\User\User $user - * @param \eZ\Publish\API\Repository\Values\User\UserUpdateStruct $userUpdateStruct - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to update the user - * @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException if a field in the $userUpdateStruct is not valid - * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if a required field is set empty - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if a field value is not accepted by the field type - * - * @return \eZ\Publish\API\Repository\Values\User\User - */ - public function updateUser(User $user, UserUpdateStruct $userUpdateStruct) - { - $returnValue = $this->service->updateUser($user, $userUpdateStruct); - $this->signalDispatcher->emit( - new UpdateUserSignal( - [ - 'userId' => $user->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Update the user account key information specified by the user account key struct. - * - * @param \eZ\Publish\API\Repository\Values\User\User $user - * @param \eZ\Publish\API\Repository\Values\User\UserTokenUpdateStruct $userTokenUpdateStruct - * - * @return \eZ\Publish\API\Repository\Values\User\User - */ - public function updateUserToken(User $user, UserTokenUpdateStruct $userTokenUpdateStruct) - { - $returnValue = $this->service->updateUserToken($user, $userTokenUpdateStruct); - $this->signalDispatcher->emit( - new UpdateUserTokenSignal( - ['userId' => $user->id] - ) - ); - - return $returnValue; - } - - /** - * Expires user token with user hash. - * - * @param string $hash - */ - public function expireUserToken($hash) - { - return $this->service->expireUserToken($hash); - } - - /** - * Assigns a new user group to the user. - * - * @param \eZ\Publish\API\Repository\Values\User\User $user - * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to assign the user group to the user - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the user is already in the given user group - */ - public function assignUserToUserGroup(User $user, UserGroup $userGroup) - { - $returnValue = $this->service->assignUserToUserGroup($user, $userGroup); - $this->signalDispatcher->emit( - new AssignUserToUserGroupSignal( - [ - 'userId' => $user->id, - 'userGroupId' => $userGroup->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Removes a user group from the user. - * - * @param \eZ\Publish\API\Repository\Values\User\User $user - * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove the user group from the user - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the user is not in the given user group - */ - public function unAssignUserFromUserGroup(User $user, UserGroup $userGroup) - { - $returnValue = $this->service->unAssignUserFromUserGroup($user, $userGroup); - $this->signalDispatcher->emit( - new UnAssignUserFromUserGroupSignal( - [ - 'userId' => $user->id, - 'userGroupId' => $userGroup->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Loads the user groups the user belongs to. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed read the user or user group - * - * @param \eZ\Publish\API\Repository\Values\User\User $user - * @param int $offset the start offset for paging - * @param int $limit the number of user groups returned - * @param string[] $prioritizedLanguages Used as prioritized language code on translated properties of returned object. - * - * @return \eZ\Publish\API\Repository\Values\User\UserGroup[] - */ - public function loadUserGroupsOfUser(User $user, $offset = 0, $limit = 25, array $prioritizedLanguages = []) - { - return $this->service->loadUserGroupsOfUser($user, $offset, $limit, $prioritizedLanguages); - } - - /** - * Loads the users of a user group. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read the users or user group - * - * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup - * @param int $offset the start offset for paging - * @param int $limit the number of users returned - * @param string[] $prioritizedLanguages Used as prioritized language code on translated properties of returned object. - * - * @return \eZ\Publish\API\Repository\Values\User\User[] - */ - public function loadUsersOfUserGroup( - UserGroup $userGroup, - $offset = 0, - $limit = 25, - array $prioritizedLanguages = [] - ) { - return $this->service->loadUsersOfUserGroup( - $userGroup, - $offset, - $limit, - $prioritizedLanguages - ); - } - - /** - * {@inheritdoc} - */ - public function isUser(Content $content): bool - { - return $this->service->isUser($content); - } - - /** - * {@inheritdoc} - */ - public function isUserGroup(Content $content): bool - { - return $this->service->isUserGroup($content); - } - - /** - * Instantiate a user create class. - * - * @param string $login the login of the new user - * @param string $email the email of the new user - * @param string $password the plain password of the new user - * @param string $mainLanguageCode the main language for the underlying content object - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType 5.x the content type for the underlying content object. In 4.x it is ignored and taken from the configuration - * - * @return \eZ\Publish\API\Repository\Values\User\UserCreateStruct - */ - public function newUserCreateStruct($login, $email, $password, $mainLanguageCode, $contentType = null) - { - return $this->service->newUserCreateStruct($login, $email, $password, $mainLanguageCode, $contentType); - } - - /** - * Instantiate a user group create class. - * - * @param string $mainLanguageCode The main language for the underlying content object - * @param null|\eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType 5.x the content type for the underlying content object. In 4.x it is ignored and taken from the configuration - * - * @return \eZ\Publish\API\Repository\Values\User\UserGroupCreateStruct - */ - public function newUserGroupCreateStruct($mainLanguageCode, $contentType = null) - { - return $this->service->newUserGroupCreateStruct($mainLanguageCode, $contentType); - } - - /** - * Instantiate a new user update struct. - * - * @return \eZ\Publish\API\Repository\Values\User\UserUpdateStruct - */ - public function newUserUpdateStruct() - { - return $this->service->newUserUpdateStruct(); - } - - /** - * Instantiate a new user group update struct. - * - * @return \eZ\Publish\API\Repository\Values\User\UserGroupUpdateStruct - */ - public function newUserGroupUpdateStruct() - { - return $this->service->newUserGroupUpdateStruct(); - } - - /** - * {@inheritdoc} - */ - public function validatePassword(string $password, PasswordValidationContext $context = null): array - { - return $this->service->validatePassword($password, $context); - } -} diff --git a/eZ/Publish/Core/settings/containerBuilder.php b/eZ/Publish/Core/settings/containerBuilder.php index 4aa4e24819f..45338f543b7 100644 --- a/eZ/Publish/Core/settings/containerBuilder.php +++ b/eZ/Publish/Core/settings/containerBuilder.php @@ -37,7 +37,7 @@ $loader->load('io.yml'); $loader->load('repository.yml'); $loader->load('repository/inner.yml'); -$loader->load('repository/signalslot.yml'); +$loader->load('repository/event.yml'); $loader->load('repository/siteaccessaware.yml'); $loader->load('roles.yml'); $loader->load('storage_engines/common.yml'); diff --git a/eZ/Publish/Core/settings/notification.yml b/eZ/Publish/Core/settings/notification.yml index 274f507673a..6f9157e41cf 100644 --- a/eZ/Publish/Core/settings/notification.yml +++ b/eZ/Publish/Core/settings/notification.yml @@ -7,4 +7,4 @@ services: notification.renderer.registry: '@eZ\Publish\Core\Notification\Renderer\Registry' eZ\Publish\API\Repository\NotificationService: - alias: eZ\Publish\Core\SignalSlot\NotificationService + alias: eZ\Publish\Core\Event\NotificationService diff --git a/eZ/Publish/Core/settings/repository.yml b/eZ/Publish/Core/settings/repository.yml index 4654998ea88..c9cc3ef10ff 100644 --- a/eZ/Publish/Core/settings/repository.yml +++ b/eZ/Publish/Core/settings/repository.yml @@ -1,73 +1,73 @@ services: # API Aliases ezpublish.api.repository: - alias: ezpublish.signalslot.repository + alias: eZ\Publish\Core\Event\Repository public: true ezpublish.api.service.bookmark: - alias: ezpublish.signalslot.service.bookmark + alias: eZ\Publish\Core\Event\BookmarkService public: true ezpublish.api.service.content: - alias: ezpublish.signalslot.service.content + alias: eZ\Publish\Core\Event\ContentService public: true ezpublish.api.service.content_type: - alias: ezpublish.signalslot.service.content_type + alias: eZ\Publish\Core\Event\ContentTypeService public: true ezpublish.api.service.field_type: - alias: ezpublish.signalslot.service.field_type + alias: eZ\Publish\Core\Event\FieldTypeService public: true ezpublish.api.service.role: - alias: ezpublish.signalslot.service.role + alias: eZ\Publish\Core\Event\RoleService public: true ezpublish.api.service.object_state: - alias: ezpublish.signalslot.service.object_state + alias: eZ\Publish\Core\Event\ObjectStateService public: true ezpublish.api.service.url_wildcard: - alias: ezpublish.signalslot.service.url_wildcard + alias: eZ\Publish\Core\Event\URLWildcardService public: true ezpublish.api.service.url_alias: - alias: ezpublish.signalslot.service.url_alias + alias: eZ\Publish\Core\Event\URLAliasService public: true ezpublish.api.service.user: - alias: ezpublish.signalslot.service.user + alias: eZ\Publish\Core\Event\UserService public: true ezpublish.api.service.search: - alias: ezpublish.signalslot.service.search + alias: eZ\Publish\Core\Event\SearchService public: true ezpublish.api.service.section: - alias: ezpublish.signalslot.service.section + alias: eZ\Publish\Core\Event\SectionService public: true ezpublish.api.service.trash: - alias: ezpublish.signalslot.service.trash + alias: eZ\Publish\Core\Event\TrashService public: true ezpublish.api.service.location: - alias: ezpublish.signalslot.service.location + alias: eZ\Publish\Core\Event\LocationService public: true ezpublish.api.service.language: - alias: ezpublish.signalslot.service.language + alias: eZ\Publish\Core\Event\LanguageService public: true ezpublish.api.service.url: - alias: ezpublish.signalslot.service.url + alias: eZ\Publish\Core\Event\URLService public: true ezpublish.api.service.notification: - alias: eZ\Publish\Core\SignalSlot\NotificationService + alias: eZ\Publish\Core\Event\NotificationService public: true ezpublish.api.service.user_preference: - alias: eZ\Publish\Core\SignalSlot\UserPreferenceService + alias: eZ\Publish\Core\Event\UserPreferenceService public: true diff --git a/eZ/Publish/Core/settings/repository/event.yml b/eZ/Publish/Core/settings/repository/event.yml new file mode 100644 index 00000000000..73140f746c6 --- /dev/null +++ b/eZ/Publish/Core/settings/repository/event.yml @@ -0,0 +1,94 @@ +services: + _defaults: + autowire: true + autoconfigure: true + public: false + + eZ\Publish\Core\Event\Repository: + arguments: + $repository: '@ezpublish.api.inner_repository' + $bookmarkService: '@eZ\Publish\Core\Event\BookmarkService' + $contentService: '@eZ\Publish\Core\Event\ContentService' + $contentTypeService: '@eZ\Publish\Core\Event\ContentTypeService' + $fieldTypeService: '@eZ\Publish\Core\Event\FieldTypeService' + $languageService: '@eZ\Publish\Core\Event\LanguageService' + $locationService: '@eZ\Publish\Core\Event\LocationService' + $notificationService: '@eZ\Publish\Core\Event\NotificationService' + $objectStateService: '@eZ\Publish\Core\Event\ObjectStateService' + $roleService: '@eZ\Publish\Core\Event\RoleService' + $searchService: '@eZ\Publish\Core\Event\SearchService' + $sectionService: '@eZ\Publish\Core\Event\SectionService' + $trashService: '@eZ\Publish\Core\Event\TrashService' + $urlAliasService: '@eZ\Publish\Core\Event\URLAliasService' + $urlService: '@eZ\Publish\Core\Event\URLService' + $urlWildcardService: '@eZ\Publish\Core\Event\URLWildcardService' + $userPreferenceService: '@eZ\Publish\Core\Event\UserPreferenceService' + $userService: '@eZ\Publish\Core\Event\UserService' + + eZ\Publish\Core\Event\BookmarkService: + arguments: + $innerService: '@ezpublish.api.service.inner_bookmark' + + eZ\Publish\Core\Event\ContentService: + arguments: + $innerService: '@ezpublish.api.service.inner_content' + + eZ\Publish\Core\Event\ContentTypeService: + arguments: + $innerService: '@ezpublish.api.service.inner_content_type' + + eZ\Publish\Core\Event\FieldTypeService: + arguments: + $innerService: '@ezpublish.api.service.inner_field_type' + + eZ\Publish\Core\Event\LanguageService: + arguments: + $innerService: '@ezpublish.api.service.inner_language' + + eZ\Publish\Core\Event\LocationService: + arguments: + $innerService: '@ezpublish.api.service.inner_location' + + eZ\Publish\Core\Event\NotificationService: + arguments: + $innerService: '@ezpublish.api.service.inner_notification' + + eZ\Publish\Core\Event\ObjectStateService: + arguments: + $innerService: '@ezpublish.api.service.inner_object_state' + + eZ\Publish\Core\Event\RoleService: + arguments: + $innerService: '@ezpublish.api.service.inner_role' + + eZ\Publish\Core\Event\SearchService: + arguments: + $innerService: '@ezpublish.api.service.inner_search' + + eZ\Publish\Core\Event\SectionService: + arguments: + $innerService: '@ezpublish.api.service.inner_section' + + eZ\Publish\Core\Event\TrashService: + arguments: + $innerService: '@ezpublish.api.service.inner_trash' + + eZ\Publish\Core\Event\URLAliasService: + arguments: + $innerService: '@ezpublish.api.service.inner_url_alias' + + eZ\Publish\Core\Event\URLService: + arguments: + $innerService: '@ezpublish.api.service.inner_url' + + eZ\Publish\Core\Event\URLWildcardService: + arguments: + $innerService: '@ezpublish.api.service.inner_url_wildcard' + + eZ\Publish\Core\Event\UserPreferenceService: + arguments: + $innerService: '@ezpublish.api.service.inner_user_preference' + + eZ\Publish\Core\Event\UserService: + arguments: + $innerService: '@ezpublish.api.service.inner_user' diff --git a/eZ/Publish/Core/settings/repository/signalslot.yml b/eZ/Publish/Core/settings/repository/signalslot.yml deleted file mode 100644 index 14240730c1b..00000000000 --- a/eZ/Publish/Core/settings/repository/signalslot.yml +++ /dev/null @@ -1,163 +0,0 @@ -parameters: - ezpublish.signalslot.repository.class: eZ\Publish\Core\SignalSlot\Repository - ezpublish.signalslot.service.content.class: eZ\Publish\Core\SignalSlot\ContentService - ezpublish.signalslot.service.content_type.class: eZ\Publish\Core\SignalSlot\ContentTypeService - ezpublish.signalslot.service.field_type.class: eZ\Publish\Core\SignalSlot\FieldTypeService - ezpublish.signalslot.service.role.class: eZ\Publish\Core\SignalSlot\RoleService - ezpublish.signalslot.service.object_state.class: eZ\Publish\Core\SignalSlot\ObjectStateService - ezpublish.signalslot.service.url_wildcard.class: eZ\Publish\Core\SignalSlot\URLWildcardService - ezpublish.signalslot.service.url_alias.class: eZ\Publish\Core\SignalSlot\URLAliasService - ezpublish.signalslot.service.user.class: eZ\Publish\Core\SignalSlot\UserService - ezpublish.signalslot.service.search.class: eZ\Publish\Core\SignalSlot\SearchService - ezpublish.signalslot.service.section.class: eZ\Publish\Core\SignalSlot\SectionService - ezpublish.signalslot.service.trash.class: eZ\Publish\Core\SignalSlot\TrashService - ezpublish.signalslot.service.location.class: eZ\Publish\Core\SignalSlot\LocationService - ezpublish.signalslot.service.language.class: eZ\Publish\Core\SignalSlot\LanguageService - ezpublish.signalslot.service.url.class: eZ\Publish\Core\SignalSlot\URLService - ezpublish.signalslot.service.bookmark.class: eZ\Publish\Core\SignalSlot\BookmarkService - - # Single slot internal services - ezpublish.signalslot.signal_dispatcher.class: eZ\Publish\Core\SignalSlot\SignalDispatcher\DefaultSignalDispatcher - ezpublish.signalslot.signal_dispatcher_transaction_wrapper.class: eZ\Publish\Core\SignalSlot\SignalDispatcher\SignalDispatcherTransactionWrapper - ezpublish.signalslot.signal_dispatcher.factory.class: eZ\Publish\Core\Base\Container\ApiLoader\SignalSlot\SignalDispatcherFactory - -services: - ezpublish.signalslot.repository: - class: "%ezpublish.signalslot.repository.class%" - arguments: - - "@ezpublish.api.inner_repository" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - "@ezpublish.signalslot.service.content" - - "@ezpublish.signalslot.service.content_type" - - "@ezpublish.signalslot.service.field_type" - - "@ezpublish.signalslot.service.role" - - "@ezpublish.signalslot.service.object_state" - - "@ezpublish.signalslot.service.url_wildcard" - - "@ezpublish.signalslot.service.url_alias" - - "@ezpublish.signalslot.service.user" - - "@ezpublish.signalslot.service.search" - - "@ezpublish.signalslot.service.section" - - "@ezpublish.signalslot.service.trash" - - "@ezpublish.signalslot.service.location" - - "@ezpublish.signalslot.service.language" - - "@ezpublish.signalslot.service.url" - - "@ezpublish.signalslot.service.bookmark" - - '@eZ\Publish\Core\SignalSlot\NotificationService' - - '@eZ\Publish\Core\SignalSlot\UserPreferenceService' - - ezpublish.signalslot.service.content: - class: "%ezpublish.signalslot.service.content.class%" - arguments: - - "@ezpublish.api.service.inner_content" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - ezpublish.signalslot.service.content_type: - class: "%ezpublish.signalslot.service.content_type.class%" - arguments: - - "@ezpublish.api.service.inner_content_type" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - ezpublish.signalslot.service.field_type: - class: "%ezpublish.signalslot.service.field_type.class%" - arguments: - - "@ezpublish.api.service.inner_field_type" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - ezpublish.signalslot.service.role: - class: "%ezpublish.signalslot.service.role.class%" - arguments: - - "@ezpublish.api.service.inner_role" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - ezpublish.signalslot.service.object_state: - class: "%ezpublish.signalslot.service.object_state.class%" - arguments: - - "@ezpublish.api.service.inner_object_state" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - ezpublish.signalslot.service.url_wildcard: - class: "%ezpublish.signalslot.service.url_wildcard.class%" - arguments: - - "@ezpublish.api.service.inner_url_wildcard" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - ezpublish.signalslot.service.url_alias: - class: "%ezpublish.signalslot.service.url_alias.class%" - arguments: - - "@ezpublish.api.service.inner_url_alias" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - ezpublish.signalslot.service.user: - class: "%ezpublish.signalslot.service.user.class%" - arguments: - - "@ezpublish.api.service.inner_user" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - ezpublish.signalslot.service.search: - class: "%ezpublish.signalslot.service.search.class%" - arguments: - - "@ezpublish.api.service.inner_search" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - ezpublish.signalslot.service.section: - class: "%ezpublish.signalslot.service.section.class%" - arguments: - - "@ezpublish.api.service.inner_section" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - ezpublish.signalslot.service.trash: - class: "%ezpublish.signalslot.service.trash.class%" - arguments: - - "@ezpublish.api.service.inner_trash" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - ezpublish.signalslot.service.location: - class: "%ezpublish.signalslot.service.location.class%" - arguments: - - "@ezpublish.api.service.inner_location" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - ezpublish.signalslot.service.language: - class: "%ezpublish.signalslot.service.language.class%" - arguments: - - "@ezpublish.api.service.inner_language" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - ezpublish.signalslot.service.url: - class: "%ezpublish.signalslot.service.url.class%" - arguments: - - "@ezpublish.api.service.inner_url" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - ezpublish.signalslot.service.bookmark: - class: "%ezpublish.signalslot.service.bookmark.class%" - arguments: - - "@ezpublish.api.service.inner_bookmark" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - eZ\Publish\Core\SignalSlot\NotificationService: - arguments: - - "@ezpublish.api.service.inner_notification" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - eZ\Publish\Core\SignalSlot\UserPreferenceService: - arguments: - - "@ezpublish.api.service.inner_user_preference" - - "@ezpublish.signalslot.signal_dispatcher_transaction_wrapper" - - # Single slot internal services - ezpublish.signalslot.signal_dispatcher_transaction_wrapper: - class: "%ezpublish.signalslot.signal_dispatcher_transaction_wrapper.class%" - arguments: ["@ezpublish.signalslot.signal_dispatcher"] - - ezpublish.signalslot.signal_dispatcher: - class: "%ezpublish.signalslot.signal_dispatcher.class%" - factory: ["@ezpublish.signalslot.signal_dispatcher.factory", buildSignalDispatcher] - lazy: true - - ezpublish.signalslot.signal_dispatcher.factory: - class: "%ezpublish.signalslot.signal_dispatcher.factory.class%" - arguments: - - "%ezpublish.signalslot.signal_dispatcher.class%" - - "legacy" - lazy: true diff --git a/eZ/Publish/Core/settings/repository/siteaccessaware.yml b/eZ/Publish/Core/settings/repository/siteaccessaware.yml index aa8f302f94c..7b72bc52ea9 100644 --- a/eZ/Publish/Core/settings/repository/siteaccessaware.yml +++ b/eZ/Publish/Core/settings/repository/siteaccessaware.yml @@ -5,7 +5,7 @@ services: ezpublish.siteaccessaware.repository: class: eZ\Publish\Core\Repository\SiteAccessAware\Repository arguments: - - '@ezpublish.signalslot.repository' + - '@eZ\Publish\Core\Event\Repository' - '@ezpublish.siteaccessaware.service.content' - '@ezpublish.siteaccessaware.service.content_type' - '@ezpublish.siteaccessaware.service.object_state' @@ -22,65 +22,65 @@ services: ezpublish.siteaccessaware.service.content: class: eZ\Publish\Core\Repository\SiteAccessAware\ContentService arguments: - - '@ezpublish.signalslot.service.content' + - '@eZ\Publish\Core\Event\ContentService' - '@ezpublish.helper.language_resolver' ezpublish.siteaccessaware.service.content_type: class: eZ\Publish\Core\Repository\SiteAccessAware\ContentTypeService arguments: - - '@ezpublish.signalslot.service.content_type' + - '@eZ\Publish\Core\Event\ContentTypeService' - '@ezpublish.helper.language_resolver' ezpublish.siteaccessaware.service.object_state: class: eZ\Publish\Core\Repository\SiteAccessAware\ObjectStateService arguments: - - '@ezpublish.signalslot.service.object_state' + - '@eZ\Publish\Core\Event\ObjectStateService' - '@ezpublish.helper.language_resolver' ezpublish.siteaccessaware.service.url_alias: class: eZ\Publish\Core\Repository\SiteAccessAware\URLAliasService arguments: - - '@ezpublish.signalslot.service.url_alias' + - '@eZ\Publish\Core\Event\URLAliasService' - '@ezpublish.helper.language_resolver' ezpublish.siteaccessaware.service.user: class: eZ\Publish\Core\Repository\SiteAccessAware\UserService arguments: - - '@ezpublish.signalslot.service.user' + - '@eZ\Publish\Core\Event\UserService' - '@ezpublish.helper.language_resolver' ezpublish.siteaccessaware.service.search: class: eZ\Publish\Core\Repository\SiteAccessAware\SearchService arguments: - - '@ezpublish.signalslot.service.search' + - '@eZ\Publish\Core\Event\SearchService' - '@ezpublish.helper.language_resolver' ezpublish.siteaccessaware.service.section: class: eZ\Publish\Core\Repository\SiteAccessAware\SectionService arguments: - - '@ezpublish.signalslot.service.section' + - '@eZ\Publish\Core\Event\SectionService' ezpublish.siteaccessaware.service.trash: class: eZ\Publish\Core\Repository\SiteAccessAware\TrashService arguments: - - '@ezpublish.signalslot.service.trash' + - '@eZ\Publish\Core\Event\TrashService' ezpublish.siteaccessaware.service.location: class: eZ\Publish\Core\Repository\SiteAccessAware\LocationService arguments: - - '@ezpublish.signalslot.service.location' + - '@eZ\Publish\Core\Event\LocationService' - '@ezpublish.helper.language_resolver' ezpublish.siteaccessaware.service.language: class: eZ\Publish\Core\Repository\SiteAccessAware\LanguageService arguments: - - '@ezpublish.signalslot.service.language' + - '@eZ\Publish\Core\Event\LanguageService' ezpublish.siteaccessaware.service.notification: class: eZ\Publish\Core\Repository\SiteAccessAware\NotificationService arguments: - - '@eZ\Publish\Core\SignalSlot\NotificationService' + - '@eZ\Publish\Core\Event\NotificationService' # Helpers eZ\Publish\Core\Repository\SiteAccessAware\Language\AbstractLanguageResolver: diff --git a/eZ/Publish/Core/settings/search_engines/common.yml b/eZ/Publish/Core/settings/search_engines/common.yml index d612e4d4bab..65ef21879ce 100644 --- a/eZ/Publish/Core/settings/search_engines/common.yml +++ b/eZ/Publish/Core/settings/search_engines/common.yml @@ -51,3 +51,13 @@ services: # are registered to this one using compilation pass ezpublish.search.common.field_value_mapper.aggregate: class: "%ezpublish.search.common.field_value_mapper.aggregate.class%" + + eZ\Publish\Core\Search\Common\EventSubscriber\: + resource: '../../Search/Common/EventSubscriber/*' + exclude: '../../Search/Common/EventSubscriber/{AbstractSearchEventSubscriber.php}' + autoconfigure: true + autowire: true + public: false + arguments: + $searchHandler: '@ezpublish.spi.search' + $persistenceHandler: '@ezpublish.api.persistence_handler' diff --git a/eZ/Publish/Core/settings/search_engines/legacy.yml b/eZ/Publish/Core/settings/search_engines/legacy.yml index ff13a804879..addd32e45a0 100644 --- a/eZ/Publish/Core/settings/search_engines/legacy.yml +++ b/eZ/Publish/Core/settings/search_engines/legacy.yml @@ -6,7 +6,6 @@ imports: - {resource: search_engines/legacy/sort_clause_handlers_common.yml} - {resource: search_engines/legacy/sort_clause_handlers_content.yml} - {resource: search_engines/legacy/sort_clause_handlers_location.yml} - - {resource: search_engines/legacy/slots.yml} - {resource: search_engines/common.yml} parameters: diff --git a/eZ/Publish/Core/settings/search_engines/legacy/slots.yml b/eZ/Publish/Core/settings/search_engines/legacy/slots.yml deleted file mode 100644 index 019e49e2ebc..00000000000 --- a/eZ/Publish/Core/settings/search_engines/legacy/slots.yml +++ /dev/null @@ -1,126 +0,0 @@ -parameters: - ezpublish.search.legacy.slot.class: eZ\Publish\Core\Search\Common\Slot - ezpublish.search.legacy.slot.publish_version.class: eZ\Publish\Core\Search\Common\Slot\PublishVersion - ezpublish.search.legacy.slot.copy_content.class: eZ\Publish\Core\Search\Common\Slot\CopyContent - ezpublish.search.legacy.slot.delete_content.class: eZ\Publish\Core\Search\Common\Slot\DeleteContent - ezpublish.search.legacy.slot.delete_version.class: eZ\Publish\Core\Search\Common\Slot\DeleteVersion - ezpublish.search.legacy.slot.copy_subtree.class: eZ\Publish\Core\Search\Common\Slot\CopySubtree - ezpublish.search.legacy.slot.trash.class: eZ\Publish\Core\Search\Common\Slot\Trash - ezpublish.search.legacy.slot.recover.class: eZ\Publish\Core\Search\Common\Slot\Recover - ezpublish.search.legacy.slot.update_content_metadata.class: eZ\Publish\Core\Search\Common\Slot\UpdateContentMetadata - ezpublish.search.legacy.slot.delete_translation.class: eZ\Publish\Core\Search\Common\Slot\DeleteTranslation - ezpublish.search.legacy.slot.assign_section.class: eZ\Publish\Core\Search\Common\Slot\AssignSection - ezpublish.search.legacy.slot.create_user.class: eZ\Publish\Core\Search\Common\Slot\CreateUser - ezpublish.search.legacy.slot.delete_user.class: eZ\Publish\Core\Search\Common\Slot\DeleteUser - ezpublish.search.legacy.slot.update_user.class: eZ\Publish\Core\Search\Common\Slot\UpdateUser - ezpublish.search.legacy.slot.create_user_group.class: eZ\Publish\Core\Search\Common\Slot\CreateUserGroup - ezpublish.search.legacy.slot.delete_user_group.class: eZ\Publish\Core\Search\Common\Slot\DeleteUserGroup - -services: - ezpublish.search.legacy.slot: - class: "%ezpublish.search.legacy.slot.class%" - abstract: true - arguments: - - "@ezpublish.api.inner_repository" - - "@ezpublish.api.persistence_handler" - - "@ezpublish.spi.search" - - ezpublish.search.legacy.slot.publish_version: - parent: ezpublish.search.legacy.slot - class: "%ezpublish.search.legacy.slot.publish_version.class%" - tags: - - {name: ezpublish.search.legacy.slot, signal: ContentService\PublishVersionSignal} - - ezpublish.search.legacy.slot.copy_content: - parent: ezpublish.search.legacy.slot - class: "%ezpublish.search.legacy.slot.copy_content.class%" - tags: - - {name: ezpublish.search.legacy.slot, signal: ContentService\CopyContentSignal} - - ezpublish.search.legacy.slot.delete_content: - parent: ezpublish.search.legacy.slot - class: "%ezpublish.search.legacy.slot.delete_content.class%" - tags: - - {name: ezpublish.search.legacy.slot, signal: ContentService\DeleteContentSignal} - - ezpublish.search.legacy.slot.delete_version: - parent: ezpublish.search.legacy.slot - class: "%ezpublish.search.legacy.slot.delete_version.class%" - tags: - - {name: ezpublish.search.legacy.slot, signal: ContentService\DeleteVersionSignal} - - ezpublish.search.legacy.slot.copy_subtree: - parent: ezpublish.search.legacy.slot - class: "%ezpublish.search.legacy.slot.copy_subtree.class%" - tags: - - {name: ezpublish.search.legacy.slot, signal: LocationService\CopySubtreeSignal} - - ezpublish.search.legacy.slot.trash: - parent: ezpublish.search.legacy.slot - class: "%ezpublish.search.legacy.slot.trash.class%" - tags: - - {name: ezpublish.search.legacy.slot, signal: TrashService\TrashSignal} - - ezpublish.search.legacy.slot.recover: - parent: ezpublish.search.legacy.slot - class: "%ezpublish.search.legacy.slot.recover.class%" - tags: - - {name: ezpublish.search.legacy.slot, signal: TrashService\RecoverSignal} - - ezpublish.search.legacy.slot.update_content_metadata: - parent: ezpublish.search.legacy.slot - class: "%ezpublish.search.legacy.slot.update_content_metadata.class%" - tags: - - {name: ezpublish.search.legacy.slot, signal: ContentService\UpdateContentMetadataSignal} - - ezpublish.search.legacy.slot.delete_translation: - parent: ezpublish.search.legacy.slot - class: "%ezpublish.search.legacy.slot.delete_translation.class%" - tags: - - {name: ezpublish.search.legacy.slot, signal: ContentService\DeleteTranslationSignal} - - ezpublish.search.legacy.slot.assign_section: - parent: ezpublish.search.legacy.slot - class: "%ezpublish.search.legacy.slot.assign_section.class%" - tags: - - {name: ezpublish.search.legacy.slot, signal: SectionService\AssignSectionSignal} - - ezpublish.search.legacy.slot.create_user: - parent: ezpublish.search.legacy.slot - class: "%ezpublish.search.legacy.slot.create_user.class%" - tags: - - {name: ezpublish.search.legacy.slot, signal: UserService\CreateUserSignal} - - ezpublish.search.legacy.slot.delete_user: - parent: ezpublish.search.legacy.slot - class: "%ezpublish.search.legacy.slot.delete_user.class%" - tags: - - {name: ezpublish.search.legacy.slot, signal: UserService\DeleteUserSignal} - - ezpublish.search.legacy.slot.update_user: - parent: ezpublish.search.legacy.slot - class: "%ezpublish.search.legacy.slot.update_user.class%" - tags: - - {name: ezpublish.search.legacy.slot, signal: UserService\UpdateUserSignal} - - ezpublish.search.legacy.slot.create_user_group: - parent: ezpublish.search.legacy.slot - class: "%ezpublish.search.legacy.slot.create_user_group.class%" - tags: - - {name: ezpublish.search.legacy.slot, signal: UserService\CreateUserGroupSignal} - - ezpublish.search.legacy.slot.delete_user_group: - parent: ezpublish.search.legacy.slot - class: "%ezpublish.search.legacy.slot.delete_user_group.class%" - tags: - - {name: ezpublish.search.legacy.slot, signal: UserService\DeleteUserGroupSignal} - - eZ\Publish\Core\Search\Common\Slot\HideContent: - parent: ezpublish.search.legacy.slot - tags: - - {name: ezpublish.search.legacy.slot, signal: ContentService\HideContentSignal} - - eZ\Publish\Core\Search\Common\Slot\RevealContent: - parent: ezpublish.search.legacy.slot - tags: - - {name: ezpublish.search.legacy.slot, signal: ContentService\RevealContentSignal} diff --git a/eZ/Publish/Core/settings/tests/common.yml b/eZ/Publish/Core/settings/tests/common.yml index 3bae63d638c..2ce5b17f002 100644 --- a/eZ/Publish/Core/settings/tests/common.yml +++ b/eZ/Publish/Core/settings/tests/common.yml @@ -2,6 +2,9 @@ services: logger: class: Psr\Log\NullLogger + Symfony\Component\EventDispatcher\EventDispatcher: ~ + Symfony\Contracts\EventDispatcher\EventDispatcherInterface: '@Symfony\Component\EventDispatcher\EventDispatcher' + # By default use in-memory cache for tests to avoid disk IO but still make sure we tests cache clearing works ezpublish.cache_pool.driver: class: Symfony\Component\Cache\Adapter\ArrayAdapter diff --git a/eZ/Publish/Core/settings/tests/integration_legacy.yml b/eZ/Publish/Core/settings/tests/integration_legacy.yml index 8d1c81143d6..406653d17da 100644 --- a/eZ/Publish/Core/settings/tests/integration_legacy.yml +++ b/eZ/Publish/Core/settings/tests/integration_legacy.yml @@ -26,6 +26,15 @@ services: EzSystems\DoctrineSchema\Database\DbPlatform\DbPlatform: tags: ['doctrine.dbplatform'] + Symfony\Component\EventDispatcher\EventDispatcher: + calls: + - ['addSubscriber', ['@eZ\Publish\Core\Search\Common\EventSubscriber\ContentEventSubscriber']] + - ['addSubscriber', ['@eZ\Publish\Core\Search\Common\EventSubscriber\LocationEventSubscriber']] + - ['addSubscriber', ['@eZ\Publish\Core\Search\Common\EventSubscriber\ObjectStateEventSubscriber']] + - ['addSubscriber', ['@eZ\Publish\Core\Search\Common\EventSubscriber\SectionEventSubscriber']] + - ['addSubscriber', ['@eZ\Publish\Core\Search\Common\EventSubscriber\TrashEventSubscriber']] + - ['addSubscriber', ['@eZ\Publish\Core\Search\Common\EventSubscriber\UserEventSubscriber']] + Doctrine\Common\EventManager: ~ EzSystems\DoctrineSchema\Database\DbPlatform\SqliteDbPlatform: diff --git a/eZ/Publish/Core/settings/tests/integration_legacy_core.yml b/eZ/Publish/Core/settings/tests/integration_legacy_core.yml index 89113266cae..a48b7d52e53 100644 --- a/eZ/Publish/Core/settings/tests/integration_legacy_core.yml +++ b/eZ/Publish/Core/settings/tests/integration_legacy_core.yml @@ -2,10 +2,3 @@ parameters: ignored_storage_files: - var/ezdemo_site/storage/images/design/plain-site/172-2-eng-US/eZ-Publish-Demo-Design-without-demo-content1.png - -services: - ezpublish.signalslot.signal_dispatcher.factory: - class: "%ezpublish.signalslot.signal_dispatcher.factory.class%" - arguments: - - "%ezpublish.signalslot.signal_dispatcher.class%" - - "legacy" diff --git a/eZ/Publish/Core/settings/user_preference.yml b/eZ/Publish/Core/settings/user_preference.yml index 2344726b15c..6774c7ef32c 100644 --- a/eZ/Publish/Core/settings/user_preference.yml +++ b/eZ/Publish/Core/settings/user_preference.yml @@ -1,3 +1,3 @@ services: eZ\Publish\API\Repository\UserPreferenceService: - alias: eZ\Publish\Core\SignalSlot\UserPreferenceService + alias: eZ\Publish\Core\Event\UserPreferenceService diff --git a/eZ/Publish/SPI/FieldType/EventListener.php b/eZ/Publish/SPI/FieldType/EventListener.php deleted file mode 100644 index 09177209482..00000000000 --- a/eZ/Publish/SPI/FieldType/EventListener.php +++ /dev/null @@ -1,33 +0,0 @@ -load('io.yml'); $loader->load('repository.yml'); $loader->load('repository/inner.yml'); - $loader->load('repository/signalslot.yml'); + $loader->load('repository/event.yml'); $loader->load('repository/siteaccessaware.yml'); $loader->load('fieldtype_external_storages.yml'); $loader->load('storage_engines/common.yml'); diff --git a/eZ/Publish/SPI/Tests/FieldType/FileBaseIntegrationTest.php b/eZ/Publish/SPI/Tests/FieldType/FileBaseIntegrationTest.php index e19a148a107..622ea724a2c 100644 --- a/eZ/Publish/SPI/Tests/FieldType/FileBaseIntegrationTest.php +++ b/eZ/Publish/SPI/Tests/FieldType/FileBaseIntegrationTest.php @@ -137,7 +137,7 @@ protected function getContainer() $loader->load('io.yml'); $loader->load('repository.yml'); $loader->load('repository/inner.yml'); - $loader->load('repository/signalslot.yml'); + $loader->load('repository/event.yml'); $loader->load('repository/siteaccessaware.yml'); $loader->load('fieldtype_external_storages.yml'); $loader->load('storage_engines/common.yml'); diff --git a/phpunit.xml b/phpunit.xml index d0463d682f0..01d6eff96de 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -53,8 +53,8 @@ eZ/Publish/SPI - - eZ/Publish/Core/SignalSlot + + eZ/Publish/Core/Event eZ/Publish/Core/Repository/SiteAccessAware From a443529b065bee98a2bd73069d13aa2a947521d9 Mon Sep 17 00:00:00 2001 From: Slawomir Dolzycki-Uchto Date: Tue, 30 Jul 2019 09:08:27 +0200 Subject: [PATCH 2/3] !fixup Delete SignalSlots --- .../Core/SignalSlot/ContentTypeService.php | 616 ------------------ eZ/Publish/Core/SignalSlot/SectionService.php | 267 -------- .../Tests/ContentTypeServiceTest.php | 331 ---------- 3 files changed, 1214 deletions(-) delete mode 100644 eZ/Publish/Core/SignalSlot/ContentTypeService.php delete mode 100644 eZ/Publish/Core/SignalSlot/SectionService.php delete mode 100644 eZ/Publish/Core/SignalSlot/Tests/ContentTypeServiceTest.php diff --git a/eZ/Publish/Core/SignalSlot/ContentTypeService.php b/eZ/Publish/Core/SignalSlot/ContentTypeService.php deleted file mode 100644 index da2d03d5e8d..00000000000 --- a/eZ/Publish/Core/SignalSlot/ContentTypeService.php +++ /dev/null @@ -1,616 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * Create a Content Type Group object. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to create a content type group - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If a group with the same identifier already exists - * - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupCreateStruct $contentTypeGroupCreateStruct - * - * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup - */ - public function createContentTypeGroup(ContentTypeGroupCreateStruct $contentTypeGroupCreateStruct) - { - $returnValue = $this->service->createContentTypeGroup($contentTypeGroupCreateStruct); - $this->signalDispatcher->emit( - new CreateContentTypeGroupSignal( - [ - 'groupId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * {@inheritdoc} - */ - public function loadContentTypeGroup($contentTypeGroupId, array $prioritizedLanguages = []) - { - return $this->service->loadContentTypeGroup($contentTypeGroupId, $prioritizedLanguages); - } - - /** - * {@inheritdoc} - */ - public function loadContentTypeGroupByIdentifier($contentTypeGroupIdentifier, array $prioritizedLanguages = []) - { - return $this->service->loadContentTypeGroupByIdentifier($contentTypeGroupIdentifier, $prioritizedLanguages); - } - - /** - * {@inheritdoc} - */ - public function loadContentTypeGroups(array $prioritizedLanguages = []) - { - return $this->service->loadContentTypeGroups($prioritizedLanguages); - } - - /** - * Update a Content Type Group object. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to create a content type group - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the given identifier (if set) already exists - * - * @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(ContentTypeGroup $contentTypeGroup, ContentTypeGroupUpdateStruct $contentTypeGroupUpdateStruct) - { - $returnValue = $this->service->updateContentTypeGroup($contentTypeGroup, $contentTypeGroupUpdateStruct); - $this->signalDispatcher->emit( - new UpdateContentTypeGroupSignal( - [ - 'contentTypeGroupId' => $contentTypeGroup->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Delete a Content Type Group. - * - * This method only deletes an content type group which has content types without any content instances - * - * @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(ContentTypeGroup $contentTypeGroup) - { - $returnValue = $this->service->deleteContentTypeGroup($contentTypeGroup); - $this->signalDispatcher->emit( - new DeleteContentTypeGroupSignal( - [ - 'contentTypeGroupId' => $contentTypeGroup->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Create a Content Type object. - * - * The content type is created in the state STATUS_DRAFT. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to create a content type - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException In case when - * - array of content type groups does not contain at least one content type group - * - identifier or remoteId in the content type create struct already exists - * - there is a duplicate field identifier in the content type create struct - * @throws \eZ\Publish\API\Repository\Exceptions\ContentTypeFieldDefinitionValidationException - * if a field definition in the $contentTypeCreateStruct is not valid - * - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct $contentTypeCreateStruct - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup[] $contentTypeGroups Required array of - * {@link ContentTypeGroup} to link type with (must contain one) - * - * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft - */ - public function createContentType(ContentTypeCreateStruct $contentTypeCreateStruct, array $contentTypeGroups) - { - $returnValue = $this->service->createContentType($contentTypeCreateStruct, $contentTypeGroups); - $this->signalDispatcher->emit( - new CreateContentTypeSignal( - [ - 'contentTypeId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * {@inheritdoc} - */ - public function loadContentType($contentTypeId, array $prioritizedLanguages = []) - { - return $this->service->loadContentType($contentTypeId, $prioritizedLanguages); - } - - /** - * {@inheritdoc} - */ - public function loadContentTypeByIdentifier($identifier, array $prioritizedLanguages = []) - { - return $this->service->loadContentTypeByIdentifier($identifier, $prioritizedLanguages); - } - - /** - * {@inheritdoc} - */ - public function loadContentTypeByRemoteId($remoteId, array $prioritizedLanguages = []) - { - return $this->service->loadContentTypeByRemoteId($remoteId, $prioritizedLanguages); - } - - /** - * Get a Content Type object draft by id. - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If the content type draft owned by the current user can not be found - * - * @param int $contentTypeId - * @param bool $ignoreOwnership if true, method will return draft even if the owner is different than currently logged in user - * - * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft - */ - public function loadContentTypeDraft($contentTypeId, bool $ignoreOwnership = false) - { - return $this->service->loadContentTypeDraft($contentTypeId, $ignoreOwnership); - } - - /** - * {@inheritdoc} - */ - public function loadContentTypeList(array $contentTypeIds, array $prioritizedLanguages = []): iterable - { - return $this->service->loadContentTypeList($contentTypeIds, $prioritizedLanguages); - } - - /** - * {@inheritdoc} - */ - public function loadContentTypes(ContentTypeGroup $contentTypeGroup, array $prioritizedLanguages = []) - { - return $this->service->loadContentTypes($contentTypeGroup, $prioritizedLanguages); - } - - /** - * Creates a draft from an existing content type. - * - * This is a complete copy of the content - * type which has the state STATUS_DRAFT. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to edit a content type - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException If there is already a draft assigned to another user - * - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType - * - * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft - */ - public function createContentTypeDraft(ContentType $contentType) - { - $returnValue = $this->service->createContentTypeDraft($contentType); - $this->signalDispatcher->emit( - new CreateContentTypeDraftSignal( - [ - 'contentTypeId' => $contentType->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Update a Content Type object. - * - * Does not update fields (fieldDefinitions), use {@link updateFieldDefinition()} to update them. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to update a content type - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the given identifier or remoteId already exists. - * - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeUpdateStruct $contentTypeUpdateStruct - */ - public function updateContentTypeDraft(ContentTypeDraft $contentTypeDraft, ContentTypeUpdateStruct $contentTypeUpdateStruct) - { - $returnValue = $this->service->updateContentTypeDraft($contentTypeDraft, $contentTypeUpdateStruct); - $this->signalDispatcher->emit( - new UpdateContentTypeDraftSignal( - [ - 'contentTypeDraftId' => $contentTypeDraft->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Delete a Content Type object. - * - * Deletes a content type if it has no instances - * - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException If there exist content objects of this type - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to delete a content type - * - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType - */ - public function deleteContentType(ContentType $contentType) - { - $returnValue = $this->service->deleteContentType($contentType); - $this->signalDispatcher->emit( - new DeleteContentTypeSignal( - [ - 'contentTypeId' => $contentType->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Copy Type incl fields and groupIds to a new Type object. - * - * New Type will have $userId as creator / modifier, created / modified should be updated with current time, - * updated remoteId and identifier should be appended with '_' + unique string. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to copy a content type - * - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType - * @param \eZ\Publish\API\Repository\Values\User\User $user if null the current user is used - * - * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType - */ - public function copyContentType(ContentType $contentType, User $user = null) - { - $returnValue = $this->service->copyContentType($contentType, $user); - $this->signalDispatcher->emit( - new CopyContentTypeSignal( - [ - 'contentTypeId' => $contentType->id, - 'userId' => ($user !== null ? $user->id : null), - ] - ) - ); - - return $returnValue; - } - - /** - * Assigns a content type to a content type group. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to unlink a content type - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the content type is already assigned the given group - * - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup - */ - public function assignContentTypeGroup(ContentType $contentType, ContentTypeGroup $contentTypeGroup) - { - $returnValue = $this->service->assignContentTypeGroup($contentType, $contentTypeGroup); - $this->signalDispatcher->emit( - new AssignContentTypeGroupSignal( - [ - 'contentTypeId' => $contentType->id, - 'contentTypeGroupId' => $contentTypeGroup->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Unassign a content type from a group. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to link a content type - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the content type is not assigned this the given group. - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException If $contentTypeGroup is the last group assigned to the content type - * - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup - */ - public function unassignContentTypeGroup(ContentType $contentType, ContentTypeGroup $contentTypeGroup) - { - $returnValue = $this->service->unassignContentTypeGroup($contentType, $contentTypeGroup); - $this->signalDispatcher->emit( - new UnassignContentTypeGroupSignal( - [ - 'contentTypeId' => $contentType->id, - 'contentTypeGroupId' => $contentTypeGroup->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Adds a new field definition to an existing content type. - * - * The content type must be in state DRAFT. - * - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the identifier in already exists in the content type - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to edit a content type - * @throws \eZ\Publish\API\Repository\Exceptions\ContentTypeFieldDefinitionValidationException - * if a field definition in the $contentTypeCreateStruct is not valid - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException If field definition of the same non-repeatable type is being - * added to the ContentType that already contains one - * or field definition that can't be added to a ContentType that - * has Content instances is being added to such ContentType - * - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft - * @param \eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct $fieldDefinitionCreateStruct - */ - public function addFieldDefinition(ContentTypeDraft $contentTypeDraft, FieldDefinitionCreateStruct $fieldDefinitionCreateStruct) - { - $returnValue = $this->service->addFieldDefinition($contentTypeDraft, $fieldDefinitionCreateStruct); - $this->signalDispatcher->emit( - new AddFieldDefinitionSignal( - [ - 'contentTypeDraftId' => $contentTypeDraft->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Remove a field definition from an existing Type. - * - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the given field definition does not belong to the given type - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to edit a content type - * - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft - * @param \eZ\Publish\API\Repository\Values\ContentType\FieldDefinition $fieldDefinition - */ - public function removeFieldDefinition(ContentTypeDraft $contentTypeDraft, FieldDefinition $fieldDefinition) - { - $returnValue = $this->service->removeFieldDefinition($contentTypeDraft, $fieldDefinition); - $this->signalDispatcher->emit( - new RemoveFieldDefinitionSignal( - [ - 'contentTypeDraftId' => $contentTypeDraft->id, - 'fieldDefinitionId' => $fieldDefinition->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Update a field definition. - * - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the field id in the update struct is not found or does not belong to the content type of - * If the given identifier is used in an existing field of the given content type - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to edit a content type - * - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft the content type draft - * @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(ContentTypeDraft $contentTypeDraft, FieldDefinition $fieldDefinition, FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct) - { - $returnValue = $this->service->updateFieldDefinition($contentTypeDraft, $fieldDefinition, $fieldDefinitionUpdateStruct); - $this->signalDispatcher->emit( - new UpdateFieldDefinitionSignal( - [ - 'contentTypeDraftId' => $contentTypeDraft->id, - 'fieldDefinitionId' => $fieldDefinition->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Publish the content type and update content objects. - * - * This method updates content objects, depending on the changed field definitions. - * - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException If the content type has no draft - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the content type has no field definitions - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to publish a content type - * - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft - */ - public function publishContentTypeDraft(ContentTypeDraft $contentTypeDraft) - { - $returnValue = $this->service->publishContentTypeDraft($contentTypeDraft); - $this->signalDispatcher->emit( - new PublishContentTypeDraftSignal( - [ - 'contentTypeDraftId' => $contentTypeDraft->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Instantiates a new content type group create class. - * - * @param string $identifier - * - * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupCreateStruct - */ - public function newContentTypeGroupCreateStruct($identifier) - { - return $this->service->newContentTypeGroupCreateStruct($identifier); - } - - /** - * Instantiates a new content type create class. - * - * @param string $identifier - * - * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct - */ - public function newContentTypeCreateStruct($identifier) - { - return $this->service->newContentTypeCreateStruct($identifier); - } - - /** - * Instantiates a new content type update struct. - * - * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeUpdateStruct - */ - public function newContentTypeUpdateStruct() - { - return $this->service->newContentTypeUpdateStruct(); - } - - /** - * Instantiates a new content type update struct. - * - * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupUpdateStruct - */ - public function newContentTypeGroupUpdateStruct() - { - return $this->service->newContentTypeGroupUpdateStruct(); - } - - /** - * Instantiates a field definition create struct. - * - * @param string $fieldTypeIdentifier the required field type identifier - * @param string $identifier the required identifier for the field definition - * - * @return \eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct - */ - public function newFieldDefinitionCreateStruct($identifier, $fieldTypeIdentifier) - { - return $this->service->newFieldDefinitionCreateStruct($identifier, $fieldTypeIdentifier); - } - - /** - * Instantiates a field definition update class. - * - * @return \eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionUpdateStruct - */ - public function newFieldDefinitionUpdateStruct() - { - return $this->service->newFieldDefinitionUpdateStruct(); - } - - /** - * Returns true if the given content type $contentType has content instances. - * - * @since 6.0.1 - * - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType - * - * @return bool - */ - public function isContentTypeUsed(ContentType $contentType) - { - return $this->service->isContentTypeUsed($contentType); - } - - /** - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft - * @param string $languageCode - * - * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft - */ - public function removeContentTypeTranslation(ContentTypeDraft $contentTypeDraft, string $languageCode): ContentTypeDraft - { - $contentTypeDraft = $this->service->removeContentTypeTranslation($contentTypeDraft, $languageCode); - $this->signalDispatcher->emit( - new RemoveContentTypeDraftTranslationSignal( - [ - 'contentTypeDraftId' => $contentTypeDraft->id, - 'languageCode' => $languageCode, - ] - ) - ); - - return $contentTypeDraft; - } -} diff --git a/eZ/Publish/Core/SignalSlot/SectionService.php b/eZ/Publish/Core/SignalSlot/SectionService.php deleted file mode 100644 index 5e57600d574..00000000000 --- a/eZ/Publish/Core/SignalSlot/SectionService.php +++ /dev/null @@ -1,267 +0,0 @@ -service = $service; - $this->signalDispatcher = $signalDispatcher; - } - - /** - * Creates the a new Section in the content repository. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to create a section - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the new identifier in $sectionCreateStruct already exists - * - * @param \eZ\Publish\API\Repository\Values\Content\SectionCreateStruct $sectionCreateStruct - * - * @return \eZ\Publish\API\Repository\Values\Content\Section The newly create section - */ - public function createSection(SectionCreateStruct $sectionCreateStruct) - { - $returnValue = $this->service->createSection($sectionCreateStruct); - $this->signalDispatcher->emit( - new CreateSectionSignal( - [ - 'sectionId' => $returnValue->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Updates the given in the content repository. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to create a section - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the new identifier already exists (if set in the update struct) - * - * @param \eZ\Publish\API\Repository\Values\Content\Section $section - * @param \eZ\Publish\API\Repository\Values\Content\SectionUpdateStruct $sectionUpdateStruct - * - * @return \eZ\Publish\API\Repository\Values\Content\Section - */ - public function updateSection(Section $section, SectionUpdateStruct $sectionUpdateStruct) - { - $returnValue = $this->service->updateSection($section, $sectionUpdateStruct); - $this->signalDispatcher->emit( - new UpdateSectionSignal( - [ - 'sectionId' => $section->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Loads a Section from its id ($sectionId). - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if section could not be found - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to read a section - * - * @param mixed $sectionId - * - * @return \eZ\Publish\API\Repository\Values\Content\Section - */ - public function loadSection($sectionId) - { - return $this->service->loadSection($sectionId); - } - - /** - * Loads all sections, excluding the ones the current user is not allowed to read. - * - * @return array of {@link \eZ\Publish\API\Repository\Values\Content\Section} - */ - public function loadSections() - { - return $this->service->loadSections(); - } - - /** - * Loads a Section from its identifier ($sectionIdentifier). - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if section could not be found - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to read a section - * - * @param string $sectionIdentifier - * - * @return \eZ\Publish\API\Repository\Values\Content\Section - */ - public function loadSectionByIdentifier($sectionIdentifier) - { - return $this->service->loadSectionByIdentifier($sectionIdentifier); - } - - /** - * Counts the contents which $section is assigned to. - * - * @param \eZ\Publish\API\Repository\Values\Content\Section $section - * - * @return int - * - * @deprecated since 6.0 - */ - public function countAssignedContents(Section $section) - { - return $this->service->countAssignedContents($section); - } - - /** - * Returns true if the given section is assigned to contents, or used in role policies, or in role assignments. - * - * This does not check user permissions. - * - * @since 6.0 - * - * @param \eZ\Publish\API\Repository\Values\Content\Section $section - * - * @return bool - */ - public function isSectionUsed(Section $section) - { - return $this->service->isSectionUsed($section); - } - - /** - * Assigns the content to the given section - * this method overrides the current assigned section. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If user does not have access to view provided object - * - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo - * @param \eZ\Publish\API\Repository\Values\Content\Section $section - */ - public function assignSection(ContentInfo $contentInfo, Section $section) - { - $returnValue = $this->service->assignSection($contentInfo, $section); - $this->signalDispatcher->emit( - new AssignSectionSignal( - [ - 'contentId' => $contentInfo->id, - 'sectionId' => $section->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Assigns the subtree to the given section. - * - * This method overrides the current assigned section. - * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException - * - * @param \eZ\Publish\API\Repository\Values\Content\Location $location - * @param \eZ\Publish\API\Repository\Values\Content\Section $section - */ - public function assignSectionToSubtree(Location $location, Section $section): void - { - $this->service->assignSectionToSubtree($location, $section); - - $this->signalDispatcher->emit( - new AssignSectionToSubtreeSignal( - [ - 'locationId' => $location->id, - 'sectionId' => $section->id, - ] - ) - ); - } - - /** - * Deletes $section from content repository. - * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If the specified section is not found - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to delete a section - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if section can not be deleted - * because it is still assigned to some contents. - * - * @param \eZ\Publish\API\Repository\Values\Content\Section $section - */ - public function deleteSection(Section $section) - { - $returnValue = $this->service->deleteSection($section); - $this->signalDispatcher->emit( - new DeleteSectionSignal( - [ - 'sectionId' => $section->id, - ] - ) - ); - - return $returnValue; - } - - /** - * Instantiates a new SectionCreateStruct. - * - * @return \eZ\Publish\API\Repository\Values\Content\SectionCreateStruct - */ - public function newSectionCreateStruct() - { - return $this->service->newSectionCreateStruct(); - } - - /** - * Instantiates a new SectionUpdateStruct. - * - * @return \eZ\Publish\API\Repository\Values\Content\SectionUpdateStruct - */ - public function newSectionUpdateStruct() - { - return $this->service->newSectionUpdateStruct(); - } -} diff --git a/eZ/Publish/Core/SignalSlot/Tests/ContentTypeServiceTest.php b/eZ/Publish/Core/SignalSlot/Tests/ContentTypeServiceTest.php deleted file mode 100644 index 34d50955b86..00000000000 --- a/eZ/Publish/Core/SignalSlot/Tests/ContentTypeServiceTest.php +++ /dev/null @@ -1,331 +0,0 @@ -createMock(APIContentTypeService::class); - } - - protected function getSignalSlotService($coreService, SignalDispatcher $dispatcher) - { - return new ContentTypeService($coreService, $dispatcher); - } - - public function serviceProvider() - { - $userId = 14; - $userVersionNo = 2; - $contentTypeGroupId = 1; - $contentTypeGroupIdentifier = 'Content'; - $contentTypeId = 42; - $contentTypeIdentifier = 'ring'; - $contentTypeRemoteId = md5('The rings'); - $copyContentTypeId = 43; - $copyContentTypeIdentifier = 'ring2'; - $copyContentTypeRemoteId = md5('The rings 2'); - $fieldDefinitionId = 242; - $fieldDefinitionIdentifier = 'power'; - - $contentTypeGroupCreateStruct = new ContentTypeGroupCreateStruct(); - $contentTypeGroupUpdateStruct = new ContentTypeGroupUpdateStruct(); - $contentTypeGroup = new ContentTypeGroup( - [ - 'id' => $contentTypeGroupId, - 'identifier' => $contentTypeGroupIdentifier, - ] - ); - $contentTypeCreateStruct = new ContentTypeCreateStruct(); - $contentTypeUpdateStruct = new ContentTypeUpdateStruct(); - $contentType = new ContentType( - [ - 'id' => $contentTypeId, - 'identifier' => $contentTypeIdentifier, - 'remoteId' => $contentTypeRemoteId, - 'fieldDefinitions' => [], - ] - ); - $contentTypeDraft = new ContentTypeDraft( - [ - 'innerContentType' => $contentType, - ] - ); - $copyContentType = new ContentType( - [ - 'id' => $copyContentTypeId, - 'identifier' => $copyContentTypeIdentifier, - 'remoteId' => $copyContentTypeRemoteId, - 'fieldDefinitions' => [], - ] - ); - $user = $this->getUser($userId, md5('Sauron'), $userVersionNo); - - $fieldDefinitionCreateStruct = new FieldDefinitionCreateStruct(); - $fieldDefinitionUpdateStruct = new FieldDefinitionUpdateStruct(); - $fieldDefinition = new FieldDefinition( - [ - 'id' => $fieldDefinitionId, - 'identifier' => $fieldDefinitionIdentifier, - ] - ); - - return [ - [ - 'createContentTypeGroup', - [$contentTypeGroupCreateStruct], - $contentTypeGroup, - 1, - ContentTypeServiceSignals\CreateContentTypeGroupSignal::class, - ['groupId' => $contentTypeGroupId], - ], - [ - 'loadContentTypeGroup', - [$contentTypeGroupId, ['eng-GB']], - $contentTypeGroup, - 0, - ], - [ - 'loadContentTypeGroupByIdentifier', - [$contentTypeGroupIdentifier, ['eng-GB']], - $contentTypeGroup, - 0, - ], - [ - 'loadContentTypeGroups', - [['eng-GB']], - [$contentTypeGroup], - 0, - ], - [ - 'updateContentTypeGroup', - [$contentTypeGroup, $contentTypeGroupUpdateStruct], - null, - 1, - ContentTypeServiceSignals\UpdateContentTypeGroupSignal::class, - ['contentTypeGroupId' => $contentTypeGroupId], - ], - [ - 'deleteContentTypeGroup', - [$contentTypeGroup], - null, - 1, - ContentTypeServiceSignals\DeleteContentTypeGroupSignal::class, - ['contentTypeGroupId' => $contentTypeGroupId], - ], - [ - 'createContentType', - [$contentTypeCreateStruct, [$contentTypeGroup]], - $contentType, - 1, - ContentTypeServiceSignals\CreateContentTypeSignal::class, - ['contentTypeId' => $contentTypeId], - ], - [ - 'loadContentType', - [$contentTypeId, ['eng-GB']], - [$contentType], - 0, - ], - [ - 'loadContentTypeByIdentifier', - [$contentTypeIdentifier, ['eng-GB']], - [$contentType], - 0, - ], - [ - 'loadContentTypeByRemoteId', - [$contentTypeRemoteId, ['eng-GB']], - [$contentType], - 0, - ], - [ - 'loadContentTypeDraft', - [$contentType, false], - [$contentTypeDraft], - 0, - ], - [ - 'loadContentTypeDraft', - [$contentType, true], - [$contentTypeDraft], - 0, - ], - [ - 'loadContentTypes', - [$contentTypeGroup, ['eng-GB']], - [$contentType], - 0, - ], - [ - 'createContentTypeDraft', - [$contentType], - $contentTypeDraft, - 1, - ContentTypeServiceSignals\CreateContentTypeDraftSignal::class, - ['contentTypeId' => $contentTypeId], - ], - [ - 'updateContentTypeDraft', - [$contentTypeDraft, $contentTypeUpdateStruct], - null, - 1, - ContentTypeServiceSignals\UpdateContentTypeDraftSignal::class, - ['contentTypeDraftId' => $contentTypeId], - ], - [ - 'deleteContentType', - [$contentType], - null, - 1, - ContentTypeServiceSignals\DeleteContentTypeSignal::class, - ['contentTypeId' => $contentTypeId], - ], - [ - 'copyContentType', - [$contentType, $user], - $copyContentType, - 1, - ContentTypeServiceSignals\CopyContentTypeSignal::class, - [ - 'contentTypeId' => $contentTypeId, - 'userId' => $userId, - ], - ], - [ - 'assignContentTypeGroup', - [$contentType, $contentTypeGroup], - null, - 1, - ContentTypeServiceSignals\AssignContentTypeGroupSignal::class, - [ - 'contentTypeId' => $contentTypeId, - 'contentTypeGroupId' => $contentTypeGroupId, - ], - ], - [ - 'unassignContentTypeGroup', - [$contentType, $contentTypeGroup], - null, - 1, - ContentTypeServiceSignals\UnassignContentTypeGroupSignal::class, - [ - 'contentTypeId' => $contentTypeId, - 'contentTypeGroupId' => $contentTypeGroupId, - ], - ], - [ - 'addFieldDefinition', - [$contentTypeDraft, $fieldDefinitionCreateStruct], - null, - 1, - ContentTypeServiceSignals\AddFieldDefinitionSignal::class, - [ - 'contentTypeDraftId' => $contentTypeId, - ], - ], - [ - 'removeFieldDefinition', - [$contentTypeDraft, $fieldDefinition], - null, - 1, - ContentTypeServiceSignals\RemoveFieldDefinitionSignal::class, - [ - 'contentTypeDraftId' => $contentTypeId, - 'fieldDefinitionId' => $fieldDefinitionId, - ], - ], - [ - 'updateFieldDefinition', - [$contentTypeDraft, $fieldDefinition, $fieldDefinitionUpdateStruct], - null, - 1, - ContentTypeServiceSignals\UpdateFieldDefinitionSignal::class, - [ - 'contentTypeDraftId' => $contentTypeId, - 'fieldDefinitionId' => $fieldDefinitionId, - ], - ], - [ - 'publishContentTypeDraft', - [$contentTypeDraft], - null, - 1, - ContentTypeServiceSignals\PublishContentTypeDraftSignal::class, - [ - 'contentTypeDraftId' => $contentTypeId, - ], - ], - [ - 'newContentTypeGroupCreateStruct', - ['Content'], - [$contentTypeGroupCreateStruct], - 0, - ], - [ - 'newContentTypeCreateStruct', - ['lords'], - [$contentTypeCreateStruct], - 0, - ], - [ - 'newContentTypeUpdateStruct', - [], - [$contentTypeUpdateStruct], - 0, - ], - [ - 'newContentTypeGroupUpdateStruct', - [], - [$contentTypeGroupUpdateStruct], - 0, - ], - [ - 'newFieldDefinitionCreateStruct', - ['ezstring', 'name'], - [$fieldDefinitionCreateStruct], - 0, - ], - [ - 'newFieldDefinitionUpdateStruct', - [], - [$fieldDefinitionUpdateStruct], - 0, - ], - [ - 'isContentTypeUsed', - [$contentType], - true, - 0, - ], - [ - 'removeContentTypeTranslation', - [$contentTypeDraft, 'eng-GB'], - $contentTypeDraft, - 1, - ], - ]; - } -} From 64df2d9280d41b96c91cf7915566294b3b7ef4ba Mon Sep 17 00:00:00 2001 From: Nattfarinn Date: Thu, 1 Aug 2019 09:39:49 +0200 Subject: [PATCH 3/3] !fixup Remove interfaces --- eZ/Publish/Core/Event/BookmarkService.php | 12 +- eZ/Publish/Core/Event/ContentService.php | 91 +-- eZ/Publish/Core/Event/ContentTypeService.php | 105 +--- eZ/Publish/Core/Event/LanguageService.php | 35 +- eZ/Publish/Core/Event/LocationService.php | 56 +- eZ/Publish/Core/Event/NotificationService.php | 21 +- eZ/Publish/Core/Event/ObjectStateService.php | 56 +- eZ/Publish/Core/Event/RoleService.php | 126 ++-- eZ/Publish/Core/Event/SectionService.php | 35 +- .../Core/Event/Tests/BookmarkServiceTest.php | 48 +- .../Core/Event/Tests/ContentServiceTest.php | 408 ++++++------- .../Event/Tests/ContentTypeServiceTest.php | 420 +++++++------- .../Core/Event/Tests/LanguageServiceTest.php | 168 +++--- .../Core/Event/Tests/LocationServiceTest.php | 252 ++++---- .../Event/Tests/NotificationServiceTest.php | 84 +-- .../Event/Tests/ObjectStateServiceTest.php | 240 ++++---- .../Core/Event/Tests/RoleServiceTest.php | 540 +++++++++--------- .../Core/Event/Tests/SectionServiceTest.php | 144 ++--- .../Core/Event/Tests/TrashServiceTest.php | 144 ++--- .../Core/Event/Tests/URLAliasServiceTest.php | 120 ++-- .../Core/Event/Tests/URLServiceTest.php | 36 +- .../Event/Tests/URLWildcardServiceTest.php | 96 ++-- .../Event/Tests/UserPreferenceServiceTest.php | 24 +- .../Core/Event/Tests/UserServiceTest.php | 324 +++++------ eZ/Publish/Core/Event/TrashService.php | 28 +- eZ/Publish/Core/Event/URLAliasService.php | 28 +- eZ/Publish/Core/Event/URLService.php | 7 +- eZ/Publish/Core/Event/URLWildcardService.php | 21 +- .../Core/Event/UserPreferenceService.php | 7 +- eZ/Publish/Core/Event/UserService.php | 70 +-- 30 files changed, 1724 insertions(+), 2022 deletions(-) diff --git a/eZ/Publish/Core/Event/BookmarkService.php b/eZ/Publish/Core/Event/BookmarkService.php index 6c009e1b2c6..578c86ffa29 100644 --- a/eZ/Publish/Core/Event/BookmarkService.php +++ b/eZ/Publish/Core/Event/BookmarkService.php @@ -9,10 +9,6 @@ namespace eZ\Publish\Core\Event; use eZ\Publish\API\Repository\BookmarkService as BookmarkServiceInterface; -use eZ\Publish\API\Repository\Events\Bookmark\BeforeCreateBookmarkEvent as BeforeCreateBookmarkEventInterface; -use eZ\Publish\API\Repository\Events\Bookmark\BeforeDeleteBookmarkEvent as BeforeDeleteBookmarkEventInterface; -use eZ\Publish\API\Repository\Events\Bookmark\CreateBookmarkEvent as CreateBookmarkEventInterface; -use eZ\Publish\API\Repository\Events\Bookmark\DeleteBookmarkEvent as DeleteBookmarkEventInterface; use eZ\Publish\API\Repository\Values\Content\Location; use eZ\Publish\API\Repository\Events\Bookmark\BeforeCreateBookmarkEvent; use eZ\Publish\API\Repository\Events\Bookmark\BeforeDeleteBookmarkEvent; @@ -41,14 +37,14 @@ public function createBookmark(Location $location): void $beforeEvent = new BeforeCreateBookmarkEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateBookmarkEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } $this->innerService->createBookmark($location); - $this->eventDispatcher->dispatch(new CreateBookmarkEvent(...$eventData), CreateBookmarkEventInterface::class); + $this->eventDispatcher->dispatch(new CreateBookmarkEvent(...$eventData)); } public function deleteBookmark(Location $location): void @@ -57,13 +53,13 @@ public function deleteBookmark(Location $location): void $beforeEvent = new BeforeDeleteBookmarkEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteBookmarkEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } $this->innerService->deleteBookmark($location); - $this->eventDispatcher->dispatch(new DeleteBookmarkEvent(...$eventData), DeleteBookmarkEventInterface::class); + $this->eventDispatcher->dispatch(new DeleteBookmarkEvent(...$eventData)); } } diff --git a/eZ/Publish/Core/Event/ContentService.php b/eZ/Publish/Core/Event/ContentService.php index 226b109d7f2..c10084f8a33 100644 --- a/eZ/Publish/Core/Event/ContentService.php +++ b/eZ/Publish/Core/Event/ContentService.php @@ -9,32 +9,6 @@ namespace eZ\Publish\Core\Event; use eZ\Publish\API\Repository\ContentService as ContentServiceInterface; -use eZ\Publish\API\Repository\Events\Content\AddRelationEvent as AddRelationEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeAddRelationEvent as BeforeAddRelationEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeCopyContentEvent as BeforeCopyContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeCreateContentDraftEvent as BeforeCreateContentDraftEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeCreateContentEvent as BeforeCreateContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeDeleteContentEvent as BeforeDeleteContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeDeleteRelationEvent as BeforeDeleteRelationEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeDeleteTranslationEvent as BeforeDeleteTranslationEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeDeleteVersionEvent as BeforeDeleteVersionEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeHideContentEvent as BeforeHideContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforePublishVersionEvent as BeforePublishVersionEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeRevealContentEvent as BeforeRevealContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeUpdateContentEvent as BeforeUpdateContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeUpdateContentMetadataEvent as BeforeUpdateContentMetadataEventInterface; -use eZ\Publish\API\Repository\Events\Content\CopyContentEvent as CopyContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\CreateContentDraftEvent as CreateContentDraftEventInterface; -use eZ\Publish\API\Repository\Events\Content\CreateContentEvent as CreateContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\DeleteContentEvent as DeleteContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\DeleteRelationEvent as DeleteRelationEventInterface; -use eZ\Publish\API\Repository\Events\Content\DeleteTranslationEvent as DeleteTranslationEventInterface; -use eZ\Publish\API\Repository\Events\Content\DeleteVersionEvent as DeleteVersionEventInterface; -use eZ\Publish\API\Repository\Events\Content\HideContentEvent as HideContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\PublishVersionEvent as PublishVersionEventInterface; -use eZ\Publish\API\Repository\Events\Content\RevealContentEvent as RevealContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\UpdateContentEvent as UpdateContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\UpdateContentMetadataEvent as UpdateContentMetadataEventInterface; use eZ\Publish\API\Repository\Values\Content\Content; use eZ\Publish\API\Repository\Values\Content\ContentCreateStruct; use eZ\Publish\API\Repository\Values\Content\ContentInfo; @@ -99,7 +73,7 @@ public function createContent( $beforeEvent = new BeforeCreateContentEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateContentEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getContent(); } @@ -109,8 +83,7 @@ public function createContent( : $this->innerService->createContent($contentCreateStruct, $locationCreateStructs); $this->eventDispatcher->dispatch( - new CreateContentEvent($content, ...$eventData), - CreateContentEventInterface::class + new CreateContentEvent($content, ...$eventData) ); return $content; @@ -127,7 +100,7 @@ public function updateContentMetadata( $beforeEvent = new BeforeUpdateContentMetadataEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateContentMetadataEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getContent(); } @@ -137,8 +110,7 @@ public function updateContentMetadata( : $this->innerService->updateContentMetadata($contentInfo, $contentMetadataUpdateStruct); $this->eventDispatcher->dispatch( - new UpdateContentMetadataEvent($content, ...$eventData), - UpdateContentMetadataEventInterface::class + new UpdateContentMetadataEvent($content, ...$eventData) ); return $content; @@ -150,7 +122,7 @@ public function deleteContent(ContentInfo $contentInfo): array $beforeEvent = new BeforeDeleteContentEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteContentEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getLocations(); } @@ -160,8 +132,7 @@ public function deleteContent(ContentInfo $contentInfo): array : $this->innerService->deleteContent($contentInfo); $this->eventDispatcher->dispatch( - new DeleteContentEvent($locations, ...$eventData), - DeleteContentEventInterface::class + new DeleteContentEvent($locations, ...$eventData) ); return $locations; @@ -180,7 +151,7 @@ public function createContentDraft( $beforeEvent = new BeforeCreateContentDraftEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateContentDraftEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getContentDraft(); } @@ -190,8 +161,7 @@ public function createContentDraft( : $this->innerService->createContentDraft($contentInfo, $versionInfo, $creator); $this->eventDispatcher->dispatch( - new CreateContentDraftEvent($contentDraft, ...$eventData), - CreateContentDraftEventInterface::class + new CreateContentDraftEvent($contentDraft, ...$eventData) ); return $contentDraft; @@ -208,7 +178,7 @@ public function updateContent( $beforeEvent = new BeforeUpdateContentEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateContentEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getContent(); } @@ -218,8 +188,7 @@ public function updateContent( : $this->innerService->updateContent($versionInfo, $contentUpdateStruct); $this->eventDispatcher->dispatch( - new UpdateContentEvent($content, ...$eventData), - UpdateContentEventInterface::class + new UpdateContentEvent($content, ...$eventData) ); return $content; @@ -234,7 +203,7 @@ public function publishVersion(VersionInfo $versionInfo, array $translations = L $beforeEvent = new BeforePublishVersionEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforePublishVersionEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getContent(); } @@ -244,8 +213,7 @@ public function publishVersion(VersionInfo $versionInfo, array $translations = L : $this->innerService->publishVersion($versionInfo, $translations); $this->eventDispatcher->dispatch( - new PublishVersionEvent($content, ...$eventData), - PublishVersionEventInterface::class + new PublishVersionEvent($content, ...$eventData) ); return $content; @@ -257,7 +225,7 @@ public function deleteVersion(VersionInfo $versionInfo): void $beforeEvent = new BeforeDeleteVersionEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteVersionEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -265,8 +233,7 @@ public function deleteVersion(VersionInfo $versionInfo): void $this->innerService->deleteVersion($versionInfo); $this->eventDispatcher->dispatch( - new DeleteVersionEvent(...$eventData), - DeleteVersionEventInterface::class + new DeleteVersionEvent(...$eventData) ); } @@ -283,7 +250,7 @@ public function copyContent( $beforeEvent = new BeforeCopyContentEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCopyContentEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getContent(); } @@ -293,8 +260,7 @@ public function copyContent( : $this->innerService->copyContent($contentInfo, $destinationLocationCreateStruct, $versionInfo); $this->eventDispatcher->dispatch( - new CopyContentEvent($content, ...$eventData), - CopyContentEventInterface::class + new CopyContentEvent($content, ...$eventData) ); return $content; @@ -311,7 +277,7 @@ public function addRelation( $beforeEvent = new BeforeAddRelationEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeAddRelationEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getRelation(); } @@ -321,8 +287,7 @@ public function addRelation( : $this->innerService->addRelation($sourceVersion, $destinationContent); $this->eventDispatcher->dispatch( - new AddRelationEvent($relation, ...$eventData), - AddRelationEventInterface::class + new AddRelationEvent($relation, ...$eventData) ); return $relation; @@ -339,7 +304,7 @@ public function deleteRelation( $beforeEvent = new BeforeDeleteRelationEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteRelationEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -347,8 +312,7 @@ public function deleteRelation( $this->innerService->deleteRelation($sourceVersion, $destinationContent); $this->eventDispatcher->dispatch( - new DeleteRelationEvent(...$eventData), - DeleteRelationEventInterface::class + new DeleteRelationEvent(...$eventData) ); } @@ -363,7 +327,7 @@ public function deleteTranslation( $beforeEvent = new BeforeDeleteTranslationEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteTranslationEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -371,8 +335,7 @@ public function deleteTranslation( $this->innerService->deleteTranslation($contentInfo, $languageCode); $this->eventDispatcher->dispatch( - new DeleteTranslationEvent(...$eventData), - DeleteTranslationEventInterface::class + new DeleteTranslationEvent(...$eventData) ); } @@ -382,7 +345,7 @@ public function hideContent(ContentInfo $contentInfo): void $beforeEvent = new BeforeHideContentEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeHideContentEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -390,8 +353,7 @@ public function hideContent(ContentInfo $contentInfo): void $this->innerService->hideContent($contentInfo); $this->eventDispatcher->dispatch( - new HideContentEvent(...$eventData), - HideContentEventInterface::class + new HideContentEvent(...$eventData) ); } @@ -401,7 +363,7 @@ public function revealContent(ContentInfo $contentInfo): void $beforeEvent = new BeforeRevealContentEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeRevealContentEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -409,8 +371,7 @@ public function revealContent(ContentInfo $contentInfo): void $this->innerService->revealContent($contentInfo); $this->eventDispatcher->dispatch( - new RevealContentEvent(...$eventData), - RevealContentEventInterface::class + new RevealContentEvent(...$eventData) ); } } diff --git a/eZ/Publish/Core/Event/ContentTypeService.php b/eZ/Publish/Core/Event/ContentTypeService.php index 94c8bf18d8a..48f9d030f0a 100644 --- a/eZ/Publish/Core/Event/ContentTypeService.php +++ b/eZ/Publish/Core/Event/ContentTypeService.php @@ -9,36 +9,6 @@ namespace eZ\Publish\Core\Event; use eZ\Publish\API\Repository\ContentTypeService as ContentTypeServiceInterface; -use eZ\Publish\API\Repository\Events\ContentType\AddFieldDefinitionEvent as AddFieldDefinitionEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\AssignContentTypeGroupEvent as AssignContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeAddFieldDefinitionEvent as BeforeAddFieldDefinitionEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeAssignContentTypeGroupEvent as BeforeAssignContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeCopyContentTypeEvent as BeforeCopyContentTypeEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeCreateContentTypeDraftEvent as BeforeCreateContentTypeDraftEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeCreateContentTypeEvent as BeforeCreateContentTypeEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeCreateContentTypeGroupEvent as BeforeCreateContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeDeleteContentTypeEvent as BeforeDeleteContentTypeEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeDeleteContentTypeGroupEvent as BeforeDeleteContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforePublishContentTypeDraftEvent as BeforePublishContentTypeDraftEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeRemoveContentTypeTranslationEvent as BeforeRemoveContentTypeTranslationEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeRemoveFieldDefinitionEvent as BeforeRemoveFieldDefinitionEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeUnassignContentTypeGroupEvent as BeforeUnassignContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeUpdateContentTypeDraftEvent as BeforeUpdateContentTypeDraftEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeUpdateContentTypeGroupEvent as BeforeUpdateContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeUpdateFieldDefinitionEvent as BeforeUpdateFieldDefinitionEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\CopyContentTypeEvent as CopyContentTypeEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\CreateContentTypeDraftEvent as CreateContentTypeDraftEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\CreateContentTypeEvent as CreateContentTypeEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\CreateContentTypeGroupEvent as CreateContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\DeleteContentTypeEvent as DeleteContentTypeEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\DeleteContentTypeGroupEvent as DeleteContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\PublishContentTypeDraftEvent as PublishContentTypeDraftEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\RemoveContentTypeTranslationEvent as RemoveContentTypeTranslationEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\RemoveFieldDefinitionEvent as RemoveFieldDefinitionEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\UnassignContentTypeGroupEvent as UnassignContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\UpdateContentTypeDraftEvent as UpdateContentTypeDraftEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\UpdateContentTypeGroupEvent as UpdateContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\UpdateFieldDefinitionEvent as UpdateFieldDefinitionEventInterface; use eZ\Publish\API\Repository\Values\ContentType\ContentType; use eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct; use eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft; @@ -103,7 +73,7 @@ public function createContentTypeGroup(ContentTypeGroupCreateStruct $contentType $beforeEvent = new BeforeCreateContentTypeGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateContentTypeGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getContentTypeGroup(); } @@ -113,8 +83,7 @@ public function createContentTypeGroup(ContentTypeGroupCreateStruct $contentType : $this->innerService->createContentTypeGroup($contentTypeGroupCreateStruct); $this->eventDispatcher->dispatch( - new CreateContentTypeGroupEvent($contentTypeGroup, ...$eventData), - CreateContentTypeGroupEventInterface::class + new CreateContentTypeGroupEvent($contentTypeGroup, ...$eventData) ); return $contentTypeGroup; @@ -131,7 +100,7 @@ public function updateContentTypeGroup( $beforeEvent = new BeforeUpdateContentTypeGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateContentTypeGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -139,8 +108,7 @@ public function updateContentTypeGroup( $this->innerService->updateContentTypeGroup($contentTypeGroup, $contentTypeGroupUpdateStruct); $this->eventDispatcher->dispatch( - new UpdateContentTypeGroupEvent(...$eventData), - UpdateContentTypeGroupEventInterface::class + new UpdateContentTypeGroupEvent(...$eventData) ); } @@ -150,7 +118,7 @@ public function deleteContentTypeGroup(ContentTypeGroup $contentTypeGroup): void $beforeEvent = new BeforeDeleteContentTypeGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteContentTypeGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -158,8 +126,7 @@ public function deleteContentTypeGroup(ContentTypeGroup $contentTypeGroup): void $this->innerService->deleteContentTypeGroup($contentTypeGroup); $this->eventDispatcher->dispatch( - new DeleteContentTypeGroupEvent(...$eventData), - DeleteContentTypeGroupEventInterface::class + new DeleteContentTypeGroupEvent(...$eventData) ); } @@ -174,7 +141,7 @@ public function createContentType( $beforeEvent = new BeforeCreateContentTypeEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateContentTypeEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getContentTypeDraft(); } @@ -184,8 +151,7 @@ public function createContentType( : $this->innerService->createContentType($contentTypeCreateStruct, $contentTypeGroups); $this->eventDispatcher->dispatch( - new CreateContentTypeEvent($contentTypeDraft, ...$eventData), - CreateContentTypeEventInterface::class + new CreateContentTypeEvent($contentTypeDraft, ...$eventData) ); return $contentTypeDraft; @@ -197,7 +163,7 @@ public function createContentTypeDraft(ContentType $contentType) $beforeEvent = new BeforeCreateContentTypeDraftEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateContentTypeDraftEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getContentTypeDraft(); } @@ -207,8 +173,7 @@ public function createContentTypeDraft(ContentType $contentType) : $this->innerService->createContentTypeDraft($contentType); $this->eventDispatcher->dispatch( - new CreateContentTypeDraftEvent($contentTypeDraft, ...$eventData), - CreateContentTypeDraftEventInterface::class + new CreateContentTypeDraftEvent($contentTypeDraft, ...$eventData) ); return $contentTypeDraft; @@ -225,7 +190,7 @@ public function updateContentTypeDraft( $beforeEvent = new BeforeUpdateContentTypeDraftEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateContentTypeDraftEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -233,8 +198,7 @@ public function updateContentTypeDraft( $this->innerService->updateContentTypeDraft($contentTypeDraft, $contentTypeUpdateStruct); $this->eventDispatcher->dispatch( - new UpdateContentTypeDraftEvent(...$eventData), - UpdateContentTypeDraftEventInterface::class + new UpdateContentTypeDraftEvent(...$eventData) ); } @@ -244,7 +208,7 @@ public function deleteContentType(ContentType $contentType): void $beforeEvent = new BeforeDeleteContentTypeEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteContentTypeEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -252,8 +216,7 @@ public function deleteContentType(ContentType $contentType): void $this->innerService->deleteContentType($contentType); $this->eventDispatcher->dispatch( - new DeleteContentTypeEvent(...$eventData), - DeleteContentTypeEventInterface::class + new DeleteContentTypeEvent(...$eventData) ); } @@ -268,7 +231,7 @@ public function copyContentType( $beforeEvent = new BeforeCopyContentTypeEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCopyContentTypeEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getContentTypeCopy(); } @@ -278,8 +241,7 @@ public function copyContentType( : $this->innerService->copyContentType($contentType, $creator); $this->eventDispatcher->dispatch( - new CopyContentTypeEvent($contentTypeCopy, ...$eventData), - CopyContentTypeEventInterface::class + new CopyContentTypeEvent($contentTypeCopy, ...$eventData) ); return $contentTypeCopy; @@ -296,7 +258,7 @@ public function assignContentTypeGroup( $beforeEvent = new BeforeAssignContentTypeGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeAssignContentTypeGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -304,8 +266,7 @@ public function assignContentTypeGroup( $this->innerService->assignContentTypeGroup($contentType, $contentTypeGroup); $this->eventDispatcher->dispatch( - new AssignContentTypeGroupEvent(...$eventData), - AssignContentTypeGroupEventInterface::class + new AssignContentTypeGroupEvent(...$eventData) ); } @@ -320,7 +281,7 @@ public function unassignContentTypeGroup( $beforeEvent = new BeforeUnassignContentTypeGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUnassignContentTypeGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -328,8 +289,7 @@ public function unassignContentTypeGroup( $this->innerService->unassignContentTypeGroup($contentType, $contentTypeGroup); $this->eventDispatcher->dispatch( - new UnassignContentTypeGroupEvent(...$eventData), - UnassignContentTypeGroupEventInterface::class + new UnassignContentTypeGroupEvent(...$eventData) ); } @@ -344,7 +304,7 @@ public function addFieldDefinition( $beforeEvent = new BeforeAddFieldDefinitionEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeAddFieldDefinitionEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -352,8 +312,7 @@ public function addFieldDefinition( $this->innerService->addFieldDefinition($contentTypeDraft, $fieldDefinitionCreateStruct); $this->eventDispatcher->dispatch( - new AddFieldDefinitionEvent(...$eventData), - AddFieldDefinitionEventInterface::class + new AddFieldDefinitionEvent(...$eventData) ); } @@ -368,7 +327,7 @@ public function removeFieldDefinition( $beforeEvent = new BeforeRemoveFieldDefinitionEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeRemoveFieldDefinitionEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -376,8 +335,7 @@ public function removeFieldDefinition( $this->innerService->removeFieldDefinition($contentTypeDraft, $fieldDefinition); $this->eventDispatcher->dispatch( - new RemoveFieldDefinitionEvent(...$eventData), - RemoveFieldDefinitionEventInterface::class + new RemoveFieldDefinitionEvent(...$eventData) ); } @@ -394,7 +352,7 @@ public function updateFieldDefinition( $beforeEvent = new BeforeUpdateFieldDefinitionEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateFieldDefinitionEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -402,8 +360,7 @@ public function updateFieldDefinition( $this->innerService->updateFieldDefinition($contentTypeDraft, $fieldDefinition, $fieldDefinitionUpdateStruct); $this->eventDispatcher->dispatch( - new UpdateFieldDefinitionEvent(...$eventData), - UpdateFieldDefinitionEventInterface::class + new UpdateFieldDefinitionEvent(...$eventData) ); } @@ -413,7 +370,7 @@ public function publishContentTypeDraft(ContentTypeDraft $contentTypeDraft): voi $beforeEvent = new BeforePublishContentTypeDraftEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforePublishContentTypeDraftEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -421,8 +378,7 @@ public function publishContentTypeDraft(ContentTypeDraft $contentTypeDraft): voi $this->innerService->publishContentTypeDraft($contentTypeDraft); $this->eventDispatcher->dispatch( - new PublishContentTypeDraftEvent(...$eventData), - PublishContentTypeDraftEventInterface::class + new PublishContentTypeDraftEvent(...$eventData) ); } @@ -437,7 +393,7 @@ public function removeContentTypeTranslation( $beforeEvent = new BeforeRemoveContentTypeTranslationEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeRemoveContentTypeTranslationEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getNewContentTypeDraft(); } @@ -447,8 +403,7 @@ public function removeContentTypeTranslation( : $this->innerService->removeContentTypeTranslation($contentTypeDraft, $languageCode); $this->eventDispatcher->dispatch( - new RemoveContentTypeTranslationEvent($newContentTypeDraft, ...$eventData), - RemoveContentTypeTranslationEventInterface::class + new RemoveContentTypeTranslationEvent($newContentTypeDraft, ...$eventData) ); return $newContentTypeDraft; diff --git a/eZ/Publish/Core/Event/LanguageService.php b/eZ/Publish/Core/Event/LanguageService.php index 69350e0bf80..55a1bfba8e2 100644 --- a/eZ/Publish/Core/Event/LanguageService.php +++ b/eZ/Publish/Core/Event/LanguageService.php @@ -8,16 +8,6 @@ namespace eZ\Publish\Core\Event; -use eZ\Publish\API\Repository\Events\Language\BeforeCreateLanguageEvent as BeforeCreateLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\BeforeDeleteLanguageEvent as BeforeDeleteLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\BeforeDisableLanguageEvent as BeforeDisableLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\BeforeEnableLanguageEvent as BeforeEnableLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\BeforeUpdateLanguageNameEvent as BeforeUpdateLanguageNameEventInterface; -use eZ\Publish\API\Repository\Events\Language\CreateLanguageEvent as CreateLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\DeleteLanguageEvent as DeleteLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\DisableLanguageEvent as DisableLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\EnableLanguageEvent as EnableLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\UpdateLanguageNameEvent as UpdateLanguageNameEventInterface; use eZ\Publish\API\Repository\LanguageService as LanguageServiceInterface; use eZ\Publish\API\Repository\Values\Content\Language; use eZ\Publish\API\Repository\Values\Content\LanguageCreateStruct; @@ -54,7 +44,7 @@ public function createLanguage(LanguageCreateStruct $languageCreateStruct): Lang $beforeEvent = new BeforeCreateLanguageEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateLanguageEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getLanguage(); } @@ -64,8 +54,7 @@ public function createLanguage(LanguageCreateStruct $languageCreateStruct): Lang : $this->innerService->createLanguage($languageCreateStruct); $this->eventDispatcher->dispatch( - new CreateLanguageEvent($language, ...$eventData), - CreateLanguageEventInterface::class + new CreateLanguageEvent($language, ...$eventData) ); return $language; @@ -82,7 +71,7 @@ public function updateLanguageName( $beforeEvent = new BeforeUpdateLanguageNameEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateLanguageNameEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedLanguage(); } @@ -92,8 +81,7 @@ public function updateLanguageName( : $this->innerService->updateLanguageName($language, $newName); $this->eventDispatcher->dispatch( - new UpdateLanguageNameEvent($updatedLanguage, ...$eventData), - UpdateLanguageNameEventInterface::class + new UpdateLanguageNameEvent($updatedLanguage, ...$eventData) ); return $updatedLanguage; @@ -105,7 +93,7 @@ public function enableLanguage(Language $language): Language $beforeEvent = new BeforeEnableLanguageEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeEnableLanguageEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getEnabledLanguage(); } @@ -115,8 +103,7 @@ public function enableLanguage(Language $language): Language : $this->innerService->enableLanguage($language); $this->eventDispatcher->dispatch( - new EnableLanguageEvent($enabledLanguage, ...$eventData), - EnableLanguageEventInterface::class + new EnableLanguageEvent($enabledLanguage, ...$eventData) ); return $enabledLanguage; @@ -128,7 +115,7 @@ public function disableLanguage(Language $language): Language $beforeEvent = new BeforeDisableLanguageEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDisableLanguageEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getDisabledLanguage(); } @@ -138,8 +125,7 @@ public function disableLanguage(Language $language): Language : $this->innerService->disableLanguage($language); $this->eventDispatcher->dispatch( - new DisableLanguageEvent($disabledLanguage, ...$eventData), - DisableLanguageEventInterface::class + new DisableLanguageEvent($disabledLanguage, ...$eventData) ); return $disabledLanguage; @@ -151,7 +137,7 @@ public function deleteLanguage(Language $language): void $beforeEvent = new BeforeDeleteLanguageEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteLanguageEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -159,8 +145,7 @@ public function deleteLanguage(Language $language): void $this->innerService->deleteLanguage($language); $this->eventDispatcher->dispatch( - new DeleteLanguageEvent(...$eventData), - DeleteLanguageEventInterface::class + new DeleteLanguageEvent(...$eventData) ); } } diff --git a/eZ/Publish/Core/Event/LocationService.php b/eZ/Publish/Core/Event/LocationService.php index aa982209441..534b1c04734 100644 --- a/eZ/Publish/Core/Event/LocationService.php +++ b/eZ/Publish/Core/Event/LocationService.php @@ -8,22 +8,6 @@ namespace eZ\Publish\Core\Event; -use eZ\Publish\API\Repository\Events\Location\BeforeCopySubtreeEvent as BeforeCopySubtreeEventInterface; -use eZ\Publish\API\Repository\Events\Location\BeforeCreateLocationEvent as BeforeCreateLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\BeforeDeleteLocationEvent as BeforeDeleteLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\BeforeHideLocationEvent as BeforeHideLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\BeforeMoveSubtreeEvent as BeforeMoveSubtreeEventInterface; -use eZ\Publish\API\Repository\Events\Location\BeforeSwapLocationEvent as BeforeSwapLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\BeforeUnhideLocationEvent as BeforeUnhideLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\BeforeUpdateLocationEvent as BeforeUpdateLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\CopySubtreeEvent as CopySubtreeEventInterface; -use eZ\Publish\API\Repository\Events\Location\CreateLocationEvent as CreateLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\DeleteLocationEvent as DeleteLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\HideLocationEvent as HideLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\MoveSubtreeEvent as MoveSubtreeEventInterface; -use eZ\Publish\API\Repository\Events\Location\SwapLocationEvent as SwapLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\UnhideLocationEvent as UnhideLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\UpdateLocationEvent as UpdateLocationEventInterface; use eZ\Publish\API\Repository\LocationService as LocationServiceInterface; use eZ\Publish\API\Repository\Values\Content\ContentInfo; use eZ\Publish\API\Repository\Values\Content\Location; @@ -73,7 +57,7 @@ public function copySubtree( $beforeEvent = new BeforeCopySubtreeEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCopySubtreeEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getLocation(); } @@ -83,8 +67,7 @@ public function copySubtree( : $this->innerService->copySubtree($subtree, $targetParentLocation); $this->eventDispatcher->dispatch( - new CopySubtreeEvent($location, ...$eventData), - CopySubtreeEventInterface::class + new CopySubtreeEvent($location, ...$eventData) ); return $location; @@ -101,7 +84,7 @@ public function createLocation( $beforeEvent = new BeforeCreateLocationEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateLocationEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getLocation(); } @@ -111,8 +94,7 @@ public function createLocation( : $this->innerService->createLocation($contentInfo, $locationCreateStruct); $this->eventDispatcher->dispatch( - new CreateLocationEvent($location, ...$eventData), - CreateLocationEventInterface::class + new CreateLocationEvent($location, ...$eventData) ); return $location; @@ -129,7 +111,7 @@ public function updateLocation( $beforeEvent = new BeforeUpdateLocationEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateLocationEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedLocation(); } @@ -139,8 +121,7 @@ public function updateLocation( : $this->innerService->updateLocation($location, $locationUpdateStruct); $this->eventDispatcher->dispatch( - new UpdateLocationEvent($updatedLocation, ...$eventData), - UpdateLocationEventInterface::class + new UpdateLocationEvent($updatedLocation, ...$eventData) ); return $updatedLocation; @@ -157,7 +138,7 @@ public function swapLocation( $beforeEvent = new BeforeSwapLocationEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeSwapLocationEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -165,8 +146,7 @@ public function swapLocation( $this->innerService->swapLocation($location1, $location2); $this->eventDispatcher->dispatch( - new SwapLocationEvent(...$eventData), - SwapLocationEventInterface::class + new SwapLocationEvent(...$eventData) ); } @@ -176,7 +156,7 @@ public function hideLocation(Location $location): Location $beforeEvent = new BeforeHideLocationEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeHideLocationEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getHiddenLocation(); } @@ -186,8 +166,7 @@ public function hideLocation(Location $location): Location : $this->innerService->hideLocation($location); $this->eventDispatcher->dispatch( - new HideLocationEvent($hiddenLocation, ...$eventData), - HideLocationEventInterface::class + new HideLocationEvent($hiddenLocation, ...$eventData) ); return $hiddenLocation; @@ -199,7 +178,7 @@ public function unhideLocation(Location $location): Location $beforeEvent = new BeforeUnhideLocationEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUnhideLocationEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getRevealedLocation(); } @@ -209,8 +188,7 @@ public function unhideLocation(Location $location): Location : $this->innerService->unhideLocation($location); $this->eventDispatcher->dispatch( - new UnhideLocationEvent($revealedLocation, ...$eventData), - UnhideLocationEventInterface::class + new UnhideLocationEvent($revealedLocation, ...$eventData) ); return $revealedLocation; @@ -227,7 +205,7 @@ public function moveSubtree( $beforeEvent = new BeforeMoveSubtreeEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeMoveSubtreeEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -235,8 +213,7 @@ public function moveSubtree( $this->innerService->moveSubtree($location, $newParentLocation); $this->eventDispatcher->dispatch( - new MoveSubtreeEvent(...$eventData), - MoveSubtreeEventInterface::class + new MoveSubtreeEvent(...$eventData) ); } @@ -246,7 +223,7 @@ public function deleteLocation(Location $location): void $beforeEvent = new BeforeDeleteLocationEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteLocationEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -254,8 +231,7 @@ public function deleteLocation(Location $location): void $this->innerService->deleteLocation($location); $this->eventDispatcher->dispatch( - new DeleteLocationEvent(...$eventData), - DeleteLocationEventInterface::class + new DeleteLocationEvent(...$eventData) ); } } diff --git a/eZ/Publish/Core/Event/NotificationService.php b/eZ/Publish/Core/Event/NotificationService.php index bdd303e1c36..3a1bad1bf10 100644 --- a/eZ/Publish/Core/Event/NotificationService.php +++ b/eZ/Publish/Core/Event/NotificationService.php @@ -8,12 +8,6 @@ namespace eZ\Publish\Core\Event; -use eZ\Publish\API\Repository\Events\Notification\BeforeCreateNotificationEvent as BeforeCreateNotificationEventInterface; -use eZ\Publish\API\Repository\Events\Notification\BeforeDeleteNotificationEvent as BeforeDeleteNotificationEventInterface; -use eZ\Publish\API\Repository\Events\Notification\BeforeMarkNotificationAsReadEvent as BeforeMarkNotificationAsReadEventInterface; -use eZ\Publish\API\Repository\Events\Notification\CreateNotificationEvent as CreateNotificationEventInterface; -use eZ\Publish\API\Repository\Events\Notification\DeleteNotificationEvent as DeleteNotificationEventInterface; -use eZ\Publish\API\Repository\Events\Notification\MarkNotificationAsReadEvent as MarkNotificationAsReadEventInterface; use eZ\Publish\API\Repository\NotificationService as NotificationServiceInterface; use eZ\Publish\API\Repository\Values\Notification\CreateStruct; use eZ\Publish\API\Repository\Values\Notification\Notification; @@ -46,7 +40,7 @@ public function markNotificationAsRead(Notification $notification): void $beforeEvent = new BeforeMarkNotificationAsReadEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeMarkNotificationAsReadEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -54,8 +48,7 @@ public function markNotificationAsRead(Notification $notification): void $this->innerService->markNotificationAsRead($notification); $this->eventDispatcher->dispatch( - new MarkNotificationAsReadEvent(...$eventData), - MarkNotificationAsReadEventInterface::class + new MarkNotificationAsReadEvent(...$eventData) ); } @@ -65,7 +58,7 @@ public function createNotification(CreateStruct $createStruct): Notification $beforeEvent = new BeforeCreateNotificationEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateNotificationEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getNotification(); } @@ -75,8 +68,7 @@ public function createNotification(CreateStruct $createStruct): Notification : $this->innerService->createNotification($createStruct); $this->eventDispatcher->dispatch( - new CreateNotificationEvent($notification, ...$eventData), - CreateNotificationEventInterface::class + new CreateNotificationEvent($notification, ...$eventData) ); return $notification; @@ -88,7 +80,7 @@ public function deleteNotification(Notification $notification): void $beforeEvent = new BeforeDeleteNotificationEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteNotificationEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -96,8 +88,7 @@ public function deleteNotification(Notification $notification): void $this->innerService->deleteNotification($notification); $this->eventDispatcher->dispatch( - new DeleteNotificationEvent(...$eventData), - DeleteNotificationEventInterface::class + new DeleteNotificationEvent(...$eventData) ); } } diff --git a/eZ/Publish/Core/Event/ObjectStateService.php b/eZ/Publish/Core/Event/ObjectStateService.php index dc70885f19b..3416d3090c8 100644 --- a/eZ/Publish/Core/Event/ObjectStateService.php +++ b/eZ/Publish/Core/Event/ObjectStateService.php @@ -8,22 +8,6 @@ namespace eZ\Publish\Core\Event; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeCreateObjectStateEvent as BeforeCreateObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeCreateObjectStateGroupEvent as BeforeCreateObjectStateGroupEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeDeleteObjectStateEvent as BeforeDeleteObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeDeleteObjectStateGroupEvent as BeforeDeleteObjectStateGroupEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeSetContentStateEvent as BeforeSetContentStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeSetPriorityOfObjectStateEvent as BeforeSetPriorityOfObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeUpdateObjectStateEvent as BeforeUpdateObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeUpdateObjectStateGroupEvent as BeforeUpdateObjectStateGroupEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\CreateObjectStateEvent as CreateObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\CreateObjectStateGroupEvent as CreateObjectStateGroupEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\DeleteObjectStateEvent as DeleteObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\DeleteObjectStateGroupEvent as DeleteObjectStateGroupEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\SetContentStateEvent as SetContentStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\SetPriorityOfObjectStateEvent as SetPriorityOfObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\UpdateObjectStateEvent as UpdateObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\UpdateObjectStateGroupEvent as UpdateObjectStateGroupEventInterface; use eZ\Publish\API\Repository\ObjectStateService as ObjectStateServiceInterface; use eZ\Publish\API\Repository\Values\Content\ContentInfo; use eZ\Publish\API\Repository\Values\ObjectState\ObjectState; @@ -71,7 +55,7 @@ public function createObjectStateGroup(ObjectStateGroupCreateStruct $objectState $beforeEvent = new BeforeCreateObjectStateGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateObjectStateGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getObjectStateGroup(); } @@ -81,8 +65,7 @@ public function createObjectStateGroup(ObjectStateGroupCreateStruct $objectState : $this->innerService->createObjectStateGroup($objectStateGroupCreateStruct); $this->eventDispatcher->dispatch( - new CreateObjectStateGroupEvent($objectStateGroup, ...$eventData), - CreateObjectStateGroupEventInterface::class + new CreateObjectStateGroupEvent($objectStateGroup, ...$eventData) ); return $objectStateGroup; @@ -99,7 +82,7 @@ public function updateObjectStateGroup( $beforeEvent = new BeforeUpdateObjectStateGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateObjectStateGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedObjectStateGroup(); } @@ -109,8 +92,7 @@ public function updateObjectStateGroup( : $this->innerService->updateObjectStateGroup($objectStateGroup, $objectStateGroupUpdateStruct); $this->eventDispatcher->dispatch( - new UpdateObjectStateGroupEvent($updatedObjectStateGroup, ...$eventData), - UpdateObjectStateGroupEventInterface::class + new UpdateObjectStateGroupEvent($updatedObjectStateGroup, ...$eventData) ); return $updatedObjectStateGroup; @@ -122,7 +104,7 @@ public function deleteObjectStateGroup(ObjectStateGroup $objectStateGroup): void $beforeEvent = new BeforeDeleteObjectStateGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteObjectStateGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -130,8 +112,7 @@ public function deleteObjectStateGroup(ObjectStateGroup $objectStateGroup): void $this->innerService->deleteObjectStateGroup($objectStateGroup); $this->eventDispatcher->dispatch( - new DeleteObjectStateGroupEvent(...$eventData), - DeleteObjectStateGroupEventInterface::class + new DeleteObjectStateGroupEvent(...$eventData) ); } @@ -146,7 +127,7 @@ public function createObjectState( $beforeEvent = new BeforeCreateObjectStateEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateObjectStateEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getObjectState(); } @@ -156,8 +137,7 @@ public function createObjectState( : $this->innerService->createObjectState($objectStateGroup, $objectStateCreateStruct); $this->eventDispatcher->dispatch( - new CreateObjectStateEvent($objectState, ...$eventData), - CreateObjectStateEventInterface::class + new CreateObjectStateEvent($objectState, ...$eventData) ); return $objectState; @@ -174,7 +154,7 @@ public function updateObjectState( $beforeEvent = new BeforeUpdateObjectStateEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateObjectStateEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedObjectState(); } @@ -184,8 +164,7 @@ public function updateObjectState( : $this->innerService->updateObjectState($objectState, $objectStateUpdateStruct); $this->eventDispatcher->dispatch( - new UpdateObjectStateEvent($updatedObjectState, ...$eventData), - UpdateObjectStateEventInterface::class + new UpdateObjectStateEvent($updatedObjectState, ...$eventData) ); return $updatedObjectState; @@ -202,7 +181,7 @@ public function setPriorityOfObjectState( $beforeEvent = new BeforeSetPriorityOfObjectStateEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeSetPriorityOfObjectStateEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -210,8 +189,7 @@ public function setPriorityOfObjectState( $this->innerService->setPriorityOfObjectState($objectState, $priority); $this->eventDispatcher->dispatch( - new SetPriorityOfObjectStateEvent(...$eventData), - SetPriorityOfObjectStateEventInterface::class + new SetPriorityOfObjectStateEvent(...$eventData) ); } @@ -221,7 +199,7 @@ public function deleteObjectState(ObjectState $objectState): void $beforeEvent = new BeforeDeleteObjectStateEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteObjectStateEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -229,8 +207,7 @@ public function deleteObjectState(ObjectState $objectState): void $this->innerService->deleteObjectState($objectState); $this->eventDispatcher->dispatch( - new DeleteObjectStateEvent(...$eventData), - DeleteObjectStateEventInterface::class + new DeleteObjectStateEvent(...$eventData) ); } @@ -247,7 +224,7 @@ public function setContentState( $beforeEvent = new BeforeSetContentStateEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeSetContentStateEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -255,8 +232,7 @@ public function setContentState( $this->innerService->setContentState($contentInfo, $objectStateGroup, $objectState); $this->eventDispatcher->dispatch( - new SetContentStateEvent(...$eventData), - SetContentStateEventInterface::class + new SetContentStateEvent(...$eventData) ); } } diff --git a/eZ/Publish/Core/Event/RoleService.php b/eZ/Publish/Core/Event/RoleService.php index f79f1cfe4d7..fae2033025d 100644 --- a/eZ/Publish/Core/Event/RoleService.php +++ b/eZ/Publish/Core/Event/RoleService.php @@ -8,42 +8,6 @@ namespace eZ\Publish\Core\Event; -use eZ\Publish\API\Repository\Events\Role\AddPolicyByRoleDraftEvent as AddPolicyByRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\AddPolicyEvent as AddPolicyEventInterface; -use eZ\Publish\API\Repository\Events\Role\AssignRoleToUserEvent as AssignRoleToUserEventInterface; -use eZ\Publish\API\Repository\Events\Role\AssignRoleToUserGroupEvent as AssignRoleToUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeAddPolicyByRoleDraftEvent as BeforeAddPolicyByRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeAddPolicyEvent as BeforeAddPolicyEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeAssignRoleToUserEvent as BeforeAssignRoleToUserEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeAssignRoleToUserGroupEvent as BeforeAssignRoleToUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeCreateRoleDraftEvent as BeforeCreateRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeCreateRoleEvent as BeforeCreateRoleEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeDeletePolicyEvent as BeforeDeletePolicyEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeDeleteRoleDraftEvent as BeforeDeleteRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeDeleteRoleEvent as BeforeDeleteRoleEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforePublishRoleDraftEvent as BeforePublishRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeRemovePolicyByRoleDraftEvent as BeforeRemovePolicyByRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeRemoveRoleAssignmentEvent as BeforeRemoveRoleAssignmentEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeUnassignRoleFromUserEvent as BeforeUnassignRoleFromUserEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeUnassignRoleFromUserGroupEvent as BeforeUnassignRoleFromUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeUpdatePolicyByRoleDraftEvent as BeforeUpdatePolicyByRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeUpdatePolicyEvent as BeforeUpdatePolicyEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeUpdateRoleDraftEvent as BeforeUpdateRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeUpdateRoleEvent as BeforeUpdateRoleEventInterface; -use eZ\Publish\API\Repository\Events\Role\CreateRoleDraftEvent as CreateRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\CreateRoleEvent as CreateRoleEventInterface; -use eZ\Publish\API\Repository\Events\Role\DeletePolicyEvent as DeletePolicyEventInterface; -use eZ\Publish\API\Repository\Events\Role\DeleteRoleDraftEvent as DeleteRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\DeleteRoleEvent as DeleteRoleEventInterface; -use eZ\Publish\API\Repository\Events\Role\PublishRoleDraftEvent as PublishRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\RemovePolicyByRoleDraftEvent as RemovePolicyByRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\RemoveRoleAssignmentEvent as RemoveRoleAssignmentEventInterface; -use eZ\Publish\API\Repository\Events\Role\UnassignRoleFromUserEvent as UnassignRoleFromUserEventInterface; -use eZ\Publish\API\Repository\Events\Role\UnassignRoleFromUserGroupEvent as UnassignRoleFromUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\Role\UpdatePolicyByRoleDraftEvent as UpdatePolicyByRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\UpdatePolicyEvent as UpdatePolicyEventInterface; -use eZ\Publish\API\Repository\Events\Role\UpdateRoleDraftEvent as UpdateRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\UpdateRoleEvent as UpdateRoleEventInterface; use eZ\Publish\API\Repository\RoleService as RoleServiceInterface; use eZ\Publish\API\Repository\Values\User\Limitation\RoleLimitation; use eZ\Publish\API\Repository\Values\User\Policy; @@ -116,7 +80,7 @@ public function createRole(RoleCreateStruct $roleCreateStruct): RoleDraft $beforeEvent = new BeforeCreateRoleEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateRoleEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getRoleDraft(); } @@ -126,8 +90,7 @@ public function createRole(RoleCreateStruct $roleCreateStruct): RoleDraft : $this->innerService->createRole($roleCreateStruct); $this->eventDispatcher->dispatch( - new CreateRoleEvent($roleDraft, ...$eventData), - CreateRoleEventInterface::class + new CreateRoleEvent($roleDraft, ...$eventData) ); return $roleDraft; @@ -139,7 +102,7 @@ public function createRoleDraft(Role $role) $beforeEvent = new BeforeCreateRoleDraftEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateRoleDraftEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getRoleDraft(); } @@ -149,8 +112,7 @@ public function createRoleDraft(Role $role) : $this->innerService->createRoleDraft($role); $this->eventDispatcher->dispatch( - new CreateRoleDraftEvent($roleDraft, ...$eventData), - CreateRoleDraftEventInterface::class + new CreateRoleDraftEvent($roleDraft, ...$eventData) ); return $roleDraft; @@ -167,7 +129,7 @@ public function updateRoleDraft( $beforeEvent = new BeforeUpdateRoleDraftEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateRoleDraftEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedRoleDraft(); } @@ -177,8 +139,7 @@ public function updateRoleDraft( : $this->innerService->updateRoleDraft($roleDraft, $roleUpdateStruct); $this->eventDispatcher->dispatch( - new UpdateRoleDraftEvent($updatedRoleDraft, ...$eventData), - UpdateRoleDraftEventInterface::class + new UpdateRoleDraftEvent($updatedRoleDraft, ...$eventData) ); return $updatedRoleDraft; @@ -195,7 +156,7 @@ public function addPolicyByRoleDraft( $beforeEvent = new BeforeAddPolicyByRoleDraftEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeAddPolicyByRoleDraftEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedRoleDraft(); } @@ -205,8 +166,7 @@ public function addPolicyByRoleDraft( : $this->innerService->addPolicyByRoleDraft($roleDraft, $policyCreateStruct); $this->eventDispatcher->dispatch( - new AddPolicyByRoleDraftEvent($updatedRoleDraft, ...$eventData), - AddPolicyByRoleDraftEventInterface::class + new AddPolicyByRoleDraftEvent($updatedRoleDraft, ...$eventData) ); return $updatedRoleDraft; @@ -223,7 +183,7 @@ public function removePolicyByRoleDraft( $beforeEvent = new BeforeRemovePolicyByRoleDraftEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeRemovePolicyByRoleDraftEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedRoleDraft(); } @@ -233,8 +193,7 @@ public function removePolicyByRoleDraft( : $this->innerService->removePolicyByRoleDraft($roleDraft, $policyDraft); $this->eventDispatcher->dispatch( - new RemovePolicyByRoleDraftEvent($updatedRoleDraft, ...$eventData), - RemovePolicyByRoleDraftEventInterface::class + new RemovePolicyByRoleDraftEvent($updatedRoleDraft, ...$eventData) ); return $updatedRoleDraft; @@ -253,7 +212,7 @@ public function updatePolicyByRoleDraft( $beforeEvent = new BeforeUpdatePolicyByRoleDraftEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdatePolicyByRoleDraftEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedPolicyDraft(); } @@ -263,8 +222,7 @@ public function updatePolicyByRoleDraft( : $this->innerService->updatePolicyByRoleDraft($roleDraft, $policy, $policyUpdateStruct); $this->eventDispatcher->dispatch( - new UpdatePolicyByRoleDraftEvent($updatedPolicyDraft, ...$eventData), - UpdatePolicyByRoleDraftEventInterface::class + new UpdatePolicyByRoleDraftEvent($updatedPolicyDraft, ...$eventData) ); return $updatedPolicyDraft; @@ -276,7 +234,7 @@ public function deleteRoleDraft(RoleDraft $roleDraft): void $beforeEvent = new BeforeDeleteRoleDraftEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteRoleDraftEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -284,8 +242,7 @@ public function deleteRoleDraft(RoleDraft $roleDraft): void $this->innerService->deleteRoleDraft($roleDraft); $this->eventDispatcher->dispatch( - new DeleteRoleDraftEvent(...$eventData), - DeleteRoleDraftEventInterface::class + new DeleteRoleDraftEvent(...$eventData) ); } @@ -295,7 +252,7 @@ public function publishRoleDraft(RoleDraft $roleDraft): void $beforeEvent = new BeforePublishRoleDraftEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforePublishRoleDraftEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -303,8 +260,7 @@ public function publishRoleDraft(RoleDraft $roleDraft): void $this->innerService->publishRoleDraft($roleDraft); $this->eventDispatcher->dispatch( - new PublishRoleDraftEvent(...$eventData), - PublishRoleDraftEventInterface::class + new PublishRoleDraftEvent(...$eventData) ); } @@ -319,7 +275,7 @@ public function updateRole( $beforeEvent = new BeforeUpdateRoleEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateRoleEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedRole(); } @@ -329,8 +285,7 @@ public function updateRole( : $this->innerService->updateRole($role, $roleUpdateStruct); $this->eventDispatcher->dispatch( - new UpdateRoleEvent($updatedRole, ...$eventData), - UpdateRoleEventInterface::class + new UpdateRoleEvent($updatedRole, ...$eventData) ); return $updatedRole; @@ -347,7 +302,7 @@ public function addPolicy( $beforeEvent = new BeforeAddPolicyEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeAddPolicyEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedRole(); } @@ -357,8 +312,7 @@ public function addPolicy( : $this->innerService->addPolicy($role, $policyCreateStruct); $this->eventDispatcher->dispatch( - new AddPolicyEvent($updatedRole, ...$eventData), - AddPolicyEventInterface::class + new AddPolicyEvent($updatedRole, ...$eventData) ); return $updatedRole; @@ -370,7 +324,7 @@ public function deletePolicy(Policy $policy): void $beforeEvent = new BeforeDeletePolicyEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeletePolicyEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -378,8 +332,7 @@ public function deletePolicy(Policy $policy): void $this->innerService->deletePolicy($policy); $this->eventDispatcher->dispatch( - new DeletePolicyEvent(...$eventData), - DeletePolicyEventInterface::class + new DeletePolicyEvent(...$eventData) ); } @@ -394,7 +347,7 @@ public function updatePolicy( $beforeEvent = new BeforeUpdatePolicyEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdatePolicyEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedPolicy(); } @@ -404,8 +357,7 @@ public function updatePolicy( : $this->innerService->updatePolicy($policy, $policyUpdateStruct); $this->eventDispatcher->dispatch( - new UpdatePolicyEvent($updatedPolicy, ...$eventData), - UpdatePolicyEventInterface::class + new UpdatePolicyEvent($updatedPolicy, ...$eventData) ); return $updatedPolicy; @@ -417,7 +369,7 @@ public function deleteRole(Role $role): void $beforeEvent = new BeforeDeleteRoleEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteRoleEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -425,8 +377,7 @@ public function deleteRole(Role $role): void $this->innerService->deleteRole($role); $this->eventDispatcher->dispatch( - new DeleteRoleEvent(...$eventData), - DeleteRoleEventInterface::class + new DeleteRoleEvent(...$eventData) ); } @@ -443,7 +394,7 @@ public function assignRoleToUserGroup( $beforeEvent = new BeforeAssignRoleToUserGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeAssignRoleToUserGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -451,8 +402,7 @@ public function assignRoleToUserGroup( $this->innerService->assignRoleToUserGroup($role, $userGroup, $roleLimitation); $this->eventDispatcher->dispatch( - new AssignRoleToUserGroupEvent(...$eventData), - AssignRoleToUserGroupEventInterface::class + new AssignRoleToUserGroupEvent(...$eventData) ); } @@ -467,7 +417,7 @@ public function unassignRoleFromUserGroup( $beforeEvent = new BeforeUnassignRoleFromUserGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUnassignRoleFromUserGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -475,8 +425,7 @@ public function unassignRoleFromUserGroup( $this->innerService->unassignRoleFromUserGroup($role, $userGroup); $this->eventDispatcher->dispatch( - new UnassignRoleFromUserGroupEvent(...$eventData), - UnassignRoleFromUserGroupEventInterface::class + new UnassignRoleFromUserGroupEvent(...$eventData) ); } @@ -493,7 +442,7 @@ public function assignRoleToUser( $beforeEvent = new BeforeAssignRoleToUserEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeAssignRoleToUserEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -501,8 +450,7 @@ public function assignRoleToUser( $this->innerService->assignRoleToUser($role, $user, $roleLimitation); $this->eventDispatcher->dispatch( - new AssignRoleToUserEvent(...$eventData), - AssignRoleToUserEventInterface::class + new AssignRoleToUserEvent(...$eventData) ); } @@ -517,7 +465,7 @@ public function unassignRoleFromUser( $beforeEvent = new BeforeUnassignRoleFromUserEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUnassignRoleFromUserEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -525,8 +473,7 @@ public function unassignRoleFromUser( $this->innerService->unassignRoleFromUser($role, $user); $this->eventDispatcher->dispatch( - new UnassignRoleFromUserEvent(...$eventData), - UnassignRoleFromUserEventInterface::class + new UnassignRoleFromUserEvent(...$eventData) ); } @@ -536,7 +483,7 @@ public function removeRoleAssignment(RoleAssignment $roleAssignment): void $beforeEvent = new BeforeRemoveRoleAssignmentEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeRemoveRoleAssignmentEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -544,8 +491,7 @@ public function removeRoleAssignment(RoleAssignment $roleAssignment): void $this->innerService->removeRoleAssignment($roleAssignment); $this->eventDispatcher->dispatch( - new RemoveRoleAssignmentEvent(...$eventData), - RemoveRoleAssignmentEventInterface::class + new RemoveRoleAssignmentEvent(...$eventData) ); } } diff --git a/eZ/Publish/Core/Event/SectionService.php b/eZ/Publish/Core/Event/SectionService.php index 82e6c7d3394..ff6d3a18c5c 100644 --- a/eZ/Publish/Core/Event/SectionService.php +++ b/eZ/Publish/Core/Event/SectionService.php @@ -8,16 +8,6 @@ namespace eZ\Publish\Core\Event; -use eZ\Publish\API\Repository\Events\Section\AssignSectionEvent as AssignSectionEventInterface; -use eZ\Publish\API\Repository\Events\Section\AssignSectionToSubtreeEvent as AssignSectionToSubtreeEventInterface; -use eZ\Publish\API\Repository\Events\Section\BeforeAssignSectionEvent as BeforeAssignSectionEventInterface; -use eZ\Publish\API\Repository\Events\Section\BeforeAssignSectionToSubtreeEvent as BeforeAssignSectionToSubtreeEventInterface; -use eZ\Publish\API\Repository\Events\Section\BeforeCreateSectionEvent as BeforeCreateSectionEventInterface; -use eZ\Publish\API\Repository\Events\Section\BeforeDeleteSectionEvent as BeforeDeleteSectionEventInterface; -use eZ\Publish\API\Repository\Events\Section\BeforeUpdateSectionEvent as BeforeUpdateSectionEventInterface; -use eZ\Publish\API\Repository\Events\Section\CreateSectionEvent as CreateSectionEventInterface; -use eZ\Publish\API\Repository\Events\Section\DeleteSectionEvent as DeleteSectionEventInterface; -use eZ\Publish\API\Repository\Events\Section\UpdateSectionEvent as UpdateSectionEventInterface; use eZ\Publish\API\Repository\SectionService as SectionServiceInterface; use eZ\Publish\API\Repository\Values\Content\ContentInfo; use eZ\Publish\API\Repository\Values\Content\Location; @@ -57,7 +47,7 @@ public function createSection(SectionCreateStruct $sectionCreateStruct) $beforeEvent = new BeforeCreateSectionEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateSectionEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getSection(); } @@ -67,8 +57,7 @@ public function createSection(SectionCreateStruct $sectionCreateStruct) : $this->innerService->createSection($sectionCreateStruct); $this->eventDispatcher->dispatch( - new CreateSectionEvent($section, ...$eventData), - CreateSectionEventInterface::class + new CreateSectionEvent($section, ...$eventData) ); return $section; @@ -85,7 +74,7 @@ public function updateSection( $beforeEvent = new BeforeUpdateSectionEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateSectionEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedSection(); } @@ -95,8 +84,7 @@ public function updateSection( : $this->innerService->updateSection($section, $sectionUpdateStruct); $this->eventDispatcher->dispatch( - new UpdateSectionEvent($updatedSection, ...$eventData), - UpdateSectionEventInterface::class + new UpdateSectionEvent($updatedSection, ...$eventData) ); return $updatedSection; @@ -113,7 +101,7 @@ public function assignSection( $beforeEvent = new BeforeAssignSectionEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeAssignSectionEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -121,8 +109,7 @@ public function assignSection( $this->innerService->assignSection($contentInfo, $section); $this->eventDispatcher->dispatch( - new AssignSectionEvent(...$eventData), - AssignSectionEventInterface::class + new AssignSectionEvent(...$eventData) ); } @@ -137,7 +124,7 @@ public function assignSectionToSubtree( $beforeEvent = new BeforeAssignSectionToSubtreeEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeAssignSectionToSubtreeEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -145,8 +132,7 @@ public function assignSectionToSubtree( $this->innerService->assignSectionToSubtree($location, $section); $this->eventDispatcher->dispatch( - new AssignSectionToSubtreeEvent(...$eventData), - AssignSectionToSubtreeEventInterface::class + new AssignSectionToSubtreeEvent(...$eventData) ); } @@ -156,7 +142,7 @@ public function deleteSection(Section $section): void $beforeEvent = new BeforeDeleteSectionEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteSectionEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -164,8 +150,7 @@ public function deleteSection(Section $section): void $this->innerService->deleteSection($section); $this->eventDispatcher->dispatch( - new DeleteSectionEvent(...$eventData), - DeleteSectionEventInterface::class + new DeleteSectionEvent(...$eventData) ); } } diff --git a/eZ/Publish/Core/Event/Tests/BookmarkServiceTest.php b/eZ/Publish/Core/Event/Tests/BookmarkServiceTest.php index 113535dbf71..a16933fa994 100644 --- a/eZ/Publish/Core/Event/Tests/BookmarkServiceTest.php +++ b/eZ/Publish/Core/Event/Tests/BookmarkServiceTest.php @@ -7,10 +7,10 @@ namespace eZ\Publish\Core\Event\Tests; use eZ\Publish\API\Repository\BookmarkService as BookmarkServiceInterface; -use eZ\Publish\API\Repository\Events\Bookmark\BeforeCreateBookmarkEvent as BeforeCreateBookmarkEventInterface; -use eZ\Publish\API\Repository\Events\Bookmark\BeforeDeleteBookmarkEvent as BeforeDeleteBookmarkEventInterface; -use eZ\Publish\API\Repository\Events\Bookmark\CreateBookmarkEvent as CreateBookmarkEventInterface; -use eZ\Publish\API\Repository\Events\Bookmark\DeleteBookmarkEvent as DeleteBookmarkEventInterface; +use eZ\Publish\API\Repository\Events\Bookmark\BeforeCreateBookmarkEvent; +use eZ\Publish\API\Repository\Events\Bookmark\BeforeDeleteBookmarkEvent; +use eZ\Publish\API\Repository\Events\Bookmark\CreateBookmarkEvent; +use eZ\Publish\API\Repository\Events\Bookmark\DeleteBookmarkEvent; use eZ\Publish\API\Repository\Values\Content\Location; use eZ\Publish\Core\Event\BookmarkService; @@ -19,8 +19,8 @@ class BookmarkServiceTest extends AbstractServiceTest public function testCreateBookmarkEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateBookmarkEventInterface::class, - CreateBookmarkEventInterface::class + BeforeCreateBookmarkEvent::class, + CreateBookmarkEvent::class ); $parameters = [ @@ -35,8 +35,8 @@ public function testCreateBookmarkEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeCreateBookmarkEventInterface::class, 0], - [CreateBookmarkEventInterface::class, 0], + [BeforeCreateBookmarkEvent::class, 0], + [CreateBookmarkEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -44,8 +44,8 @@ public function testCreateBookmarkEvents() public function testCreateBookmarkStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateBookmarkEventInterface::class, - CreateBookmarkEventInterface::class + BeforeCreateBookmarkEvent::class, + CreateBookmarkEvent::class ); $parameters = [ @@ -54,7 +54,7 @@ public function testCreateBookmarkStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(BookmarkServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeCreateBookmarkEventInterface::class, function (BeforeCreateBookmarkEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeCreateBookmarkEvent::class, function (BeforeCreateBookmarkEvent $event) { $event->stopPropagation(); }, 10); @@ -65,19 +65,19 @@ public function testCreateBookmarkStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeCreateBookmarkEventInterface::class, 10], + [BeforeCreateBookmarkEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateBookmarkEventInterface::class, 0], - [CreateBookmarkEventInterface::class, 0], + [BeforeCreateBookmarkEvent::class, 0], + [CreateBookmarkEvent::class, 0], ]); } public function testDeleteBookmarkEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteBookmarkEventInterface::class, - DeleteBookmarkEventInterface::class + BeforeDeleteBookmarkEvent::class, + DeleteBookmarkEvent::class ); $parameters = [ @@ -92,8 +92,8 @@ public function testDeleteBookmarkEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteBookmarkEventInterface::class, 0], - [DeleteBookmarkEventInterface::class, 0], + [BeforeDeleteBookmarkEvent::class, 0], + [DeleteBookmarkEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -101,8 +101,8 @@ public function testDeleteBookmarkEvents() public function testDeleteBookmarkStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteBookmarkEventInterface::class, - DeleteBookmarkEventInterface::class + BeforeDeleteBookmarkEvent::class, + DeleteBookmarkEvent::class ); $parameters = [ @@ -111,7 +111,7 @@ public function testDeleteBookmarkStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(BookmarkServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteBookmarkEventInterface::class, function (BeforeDeleteBookmarkEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeDeleteBookmarkEvent::class, function (BeforeDeleteBookmarkEvent $event) { $event->stopPropagation(); }, 10); @@ -122,11 +122,11 @@ public function testDeleteBookmarkStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteBookmarkEventInterface::class, 10], + [BeforeDeleteBookmarkEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteBookmarkEventInterface::class, 0], - [DeleteBookmarkEventInterface::class, 0], + [BeforeDeleteBookmarkEvent::class, 0], + [DeleteBookmarkEvent::class, 0], ]); } } diff --git a/eZ/Publish/Core/Event/Tests/ContentServiceTest.php b/eZ/Publish/Core/Event/Tests/ContentServiceTest.php index a838c22b5fe..a60079919af 100644 --- a/eZ/Publish/Core/Event/Tests/ContentServiceTest.php +++ b/eZ/Publish/Core/Event/Tests/ContentServiceTest.php @@ -7,32 +7,32 @@ namespace eZ\Publish\Core\Event\Tests; use eZ\Publish\API\Repository\ContentService as ContentServiceInterface; -use eZ\Publish\API\Repository\Events\Content\AddRelationEvent as AddRelationEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeAddRelationEvent as BeforeAddRelationEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeCopyContentEvent as BeforeCopyContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeCreateContentDraftEvent as BeforeCreateContentDraftEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeCreateContentEvent as BeforeCreateContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeDeleteContentEvent as BeforeDeleteContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeDeleteRelationEvent as BeforeDeleteRelationEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeDeleteTranslationEvent as BeforeDeleteTranslationEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeDeleteVersionEvent as BeforeDeleteVersionEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeHideContentEvent as BeforeHideContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforePublishVersionEvent as BeforePublishVersionEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeRevealContentEvent as BeforeRevealContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeUpdateContentEvent as BeforeUpdateContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\BeforeUpdateContentMetadataEvent as BeforeUpdateContentMetadataEventInterface; -use eZ\Publish\API\Repository\Events\Content\CopyContentEvent as CopyContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\CreateContentDraftEvent as CreateContentDraftEventInterface; -use eZ\Publish\API\Repository\Events\Content\CreateContentEvent as CreateContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\DeleteContentEvent as DeleteContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\DeleteRelationEvent as DeleteRelationEventInterface; -use eZ\Publish\API\Repository\Events\Content\DeleteTranslationEvent as DeleteTranslationEventInterface; -use eZ\Publish\API\Repository\Events\Content\DeleteVersionEvent as DeleteVersionEventInterface; -use eZ\Publish\API\Repository\Events\Content\HideContentEvent as HideContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\PublishVersionEvent as PublishVersionEventInterface; -use eZ\Publish\API\Repository\Events\Content\RevealContentEvent as RevealContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\UpdateContentEvent as UpdateContentEventInterface; -use eZ\Publish\API\Repository\Events\Content\UpdateContentMetadataEvent as UpdateContentMetadataEventInterface; +use eZ\Publish\API\Repository\Events\Content\AddRelationEvent; +use eZ\Publish\API\Repository\Events\Content\BeforeAddRelationEvent; +use eZ\Publish\API\Repository\Events\Content\BeforeCopyContentEvent; +use eZ\Publish\API\Repository\Events\Content\BeforeCreateContentDraftEvent; +use eZ\Publish\API\Repository\Events\Content\BeforeCreateContentEvent; +use eZ\Publish\API\Repository\Events\Content\BeforeDeleteContentEvent; +use eZ\Publish\API\Repository\Events\Content\BeforeDeleteRelationEvent; +use eZ\Publish\API\Repository\Events\Content\BeforeDeleteTranslationEvent; +use eZ\Publish\API\Repository\Events\Content\BeforeDeleteVersionEvent; +use eZ\Publish\API\Repository\Events\Content\BeforeHideContentEvent; +use eZ\Publish\API\Repository\Events\Content\BeforePublishVersionEvent; +use eZ\Publish\API\Repository\Events\Content\BeforeRevealContentEvent; +use eZ\Publish\API\Repository\Events\Content\BeforeUpdateContentEvent; +use eZ\Publish\API\Repository\Events\Content\BeforeUpdateContentMetadataEvent; +use eZ\Publish\API\Repository\Events\Content\CopyContentEvent; +use eZ\Publish\API\Repository\Events\Content\CreateContentDraftEvent; +use eZ\Publish\API\Repository\Events\Content\CreateContentEvent; +use eZ\Publish\API\Repository\Events\Content\DeleteContentEvent; +use eZ\Publish\API\Repository\Events\Content\DeleteRelationEvent; +use eZ\Publish\API\Repository\Events\Content\DeleteTranslationEvent; +use eZ\Publish\API\Repository\Events\Content\DeleteVersionEvent; +use eZ\Publish\API\Repository\Events\Content\HideContentEvent; +use eZ\Publish\API\Repository\Events\Content\PublishVersionEvent; +use eZ\Publish\API\Repository\Events\Content\RevealContentEvent; +use eZ\Publish\API\Repository\Events\Content\UpdateContentEvent; +use eZ\Publish\API\Repository\Events\Content\UpdateContentMetadataEvent; use eZ\Publish\API\Repository\Values\Content\Content; use eZ\Publish\API\Repository\Values\Content\ContentCreateStruct; use eZ\Publish\API\Repository\Values\Content\ContentInfo; @@ -49,8 +49,8 @@ class ContentServiceTest extends AbstractServiceTest public function testDeleteContentEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteContentEventInterface::class, - DeleteContentEventInterface::class + BeforeDeleteContentEvent::class, + DeleteContentEvent::class ); $parameters = [ @@ -68,8 +68,8 @@ public function testDeleteContentEvents() $this->assertSame($locations, $result); $this->assertSame($calledListeners, [ - [BeforeDeleteContentEventInterface::class, 0], - [DeleteContentEventInterface::class, 0], + [BeforeDeleteContentEvent::class, 0], + [DeleteContentEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -77,8 +77,8 @@ public function testDeleteContentEvents() public function testReturnDeleteContentResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteContentEventInterface::class, - DeleteContentEventInterface::class + BeforeDeleteContentEvent::class, + DeleteContentEvent::class ); $parameters = [ @@ -90,7 +90,7 @@ public function testReturnDeleteContentResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('deleteContent')->willReturn($locations); - $traceableEventDispatcher->addListener(BeforeDeleteContentEventInterface::class, function (BeforeDeleteContentEventInterface $event) use ($eventLocations) { + $traceableEventDispatcher->addListener(BeforeDeleteContentEvent::class, function (BeforeDeleteContentEvent $event) use ($eventLocations) { $event->setLocations($eventLocations); }, 10); @@ -101,9 +101,9 @@ public function testReturnDeleteContentResultInBeforeEvents() $this->assertSame($eventLocations, $result); $this->assertSame($calledListeners, [ - [BeforeDeleteContentEventInterface::class, 10], - [BeforeDeleteContentEventInterface::class, 0], - [DeleteContentEventInterface::class, 0], + [BeforeDeleteContentEvent::class, 10], + [BeforeDeleteContentEvent::class, 0], + [DeleteContentEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -111,8 +111,8 @@ public function testReturnDeleteContentResultInBeforeEvents() public function testDeleteContentStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteContentEventInterface::class, - DeleteContentEventInterface::class + BeforeDeleteContentEvent::class, + DeleteContentEvent::class ); $parameters = [ @@ -124,7 +124,7 @@ public function testDeleteContentStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('deleteContent')->willReturn($locations); - $traceableEventDispatcher->addListener(BeforeDeleteContentEventInterface::class, function (BeforeDeleteContentEventInterface $event) use ($eventLocations) { + $traceableEventDispatcher->addListener(BeforeDeleteContentEvent::class, function (BeforeDeleteContentEvent $event) use ($eventLocations) { $event->setLocations($eventLocations); $event->stopPropagation(); }, 10); @@ -137,19 +137,19 @@ public function testDeleteContentStopPropagationInBeforeEvents() $this->assertSame($eventLocations, $result); $this->assertSame($calledListeners, [ - [BeforeDeleteContentEventInterface::class, 10], + [BeforeDeleteContentEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteContentEventInterface::class, 0], - [DeleteContentEventInterface::class, 0], + [BeforeDeleteContentEvent::class, 0], + [DeleteContentEvent::class, 0], ]); } public function testCopyContentEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCopyContentEventInterface::class, - CopyContentEventInterface::class + BeforeCopyContentEvent::class, + CopyContentEvent::class ); $parameters = [ @@ -169,8 +169,8 @@ public function testCopyContentEvents() $this->assertSame($content, $result); $this->assertSame($calledListeners, [ - [BeforeCopyContentEventInterface::class, 0], - [CopyContentEventInterface::class, 0], + [BeforeCopyContentEvent::class, 0], + [CopyContentEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -178,8 +178,8 @@ public function testCopyContentEvents() public function testReturnCopyContentResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCopyContentEventInterface::class, - CopyContentEventInterface::class + BeforeCopyContentEvent::class, + CopyContentEvent::class ); $parameters = [ @@ -193,7 +193,7 @@ public function testReturnCopyContentResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('copyContent')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeCopyContentEventInterface::class, function (BeforeCopyContentEventInterface $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeCopyContentEvent::class, function (BeforeCopyContentEvent $event) use ($eventContent) { $event->setContent($eventContent); }, 10); @@ -204,9 +204,9 @@ public function testReturnCopyContentResultInBeforeEvents() $this->assertSame($eventContent, $result); $this->assertSame($calledListeners, [ - [BeforeCopyContentEventInterface::class, 10], - [BeforeCopyContentEventInterface::class, 0], - [CopyContentEventInterface::class, 0], + [BeforeCopyContentEvent::class, 10], + [BeforeCopyContentEvent::class, 0], + [CopyContentEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -214,8 +214,8 @@ public function testReturnCopyContentResultInBeforeEvents() public function testCopyContentStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCopyContentEventInterface::class, - CopyContentEventInterface::class + BeforeCopyContentEvent::class, + CopyContentEvent::class ); $parameters = [ @@ -229,7 +229,7 @@ public function testCopyContentStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('copyContent')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeCopyContentEventInterface::class, function (BeforeCopyContentEventInterface $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeCopyContentEvent::class, function (BeforeCopyContentEvent $event) use ($eventContent) { $event->setContent($eventContent); $event->stopPropagation(); }, 10); @@ -242,19 +242,19 @@ public function testCopyContentStopPropagationInBeforeEvents() $this->assertSame($eventContent, $result); $this->assertSame($calledListeners, [ - [BeforeCopyContentEventInterface::class, 10], + [BeforeCopyContentEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCopyContentEventInterface::class, 0], - [CopyContentEventInterface::class, 0], + [BeforeCopyContentEvent::class, 0], + [CopyContentEvent::class, 0], ]); } public function testUpdateContentEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateContentEventInterface::class, - UpdateContentEventInterface::class + BeforeUpdateContentEvent::class, + UpdateContentEvent::class ); $parameters = [ @@ -273,8 +273,8 @@ public function testUpdateContentEvents() $this->assertSame($content, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateContentEventInterface::class, 0], - [UpdateContentEventInterface::class, 0], + [BeforeUpdateContentEvent::class, 0], + [UpdateContentEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -282,8 +282,8 @@ public function testUpdateContentEvents() public function testReturnUpdateContentResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateContentEventInterface::class, - UpdateContentEventInterface::class + BeforeUpdateContentEvent::class, + UpdateContentEvent::class ); $parameters = [ @@ -296,7 +296,7 @@ public function testReturnUpdateContentResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('updateContent')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeUpdateContentEventInterface::class, function (BeforeUpdateContentEventInterface $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeUpdateContentEvent::class, function (BeforeUpdateContentEvent $event) use ($eventContent) { $event->setContent($eventContent); }, 10); @@ -307,9 +307,9 @@ public function testReturnUpdateContentResultInBeforeEvents() $this->assertSame($eventContent, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateContentEventInterface::class, 10], - [BeforeUpdateContentEventInterface::class, 0], - [UpdateContentEventInterface::class, 0], + [BeforeUpdateContentEvent::class, 10], + [BeforeUpdateContentEvent::class, 0], + [UpdateContentEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -317,8 +317,8 @@ public function testReturnUpdateContentResultInBeforeEvents() public function testUpdateContentStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateContentEventInterface::class, - UpdateContentEventInterface::class + BeforeUpdateContentEvent::class, + UpdateContentEvent::class ); $parameters = [ @@ -331,7 +331,7 @@ public function testUpdateContentStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('updateContent')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeUpdateContentEventInterface::class, function (BeforeUpdateContentEventInterface $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeUpdateContentEvent::class, function (BeforeUpdateContentEvent $event) use ($eventContent) { $event->setContent($eventContent); $event->stopPropagation(); }, 10); @@ -344,19 +344,19 @@ public function testUpdateContentStopPropagationInBeforeEvents() $this->assertSame($eventContent, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateContentEventInterface::class, 10], + [BeforeUpdateContentEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateContentEventInterface::class, 0], - [UpdateContentEventInterface::class, 0], + [BeforeUpdateContentEvent::class, 0], + [UpdateContentEvent::class, 0], ]); } public function testDeleteRelationEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteRelationEventInterface::class, - DeleteRelationEventInterface::class + BeforeDeleteRelationEvent::class, + DeleteRelationEvent::class ); $parameters = [ @@ -372,8 +372,8 @@ public function testDeleteRelationEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteRelationEventInterface::class, 0], - [DeleteRelationEventInterface::class, 0], + [BeforeDeleteRelationEvent::class, 0], + [DeleteRelationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -381,8 +381,8 @@ public function testDeleteRelationEvents() public function testDeleteRelationStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteRelationEventInterface::class, - DeleteRelationEventInterface::class + BeforeDeleteRelationEvent::class, + DeleteRelationEvent::class ); $parameters = [ @@ -392,7 +392,7 @@ public function testDeleteRelationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteRelationEventInterface::class, function (BeforeDeleteRelationEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeDeleteRelationEvent::class, function (BeforeDeleteRelationEvent $event) { $event->stopPropagation(); }, 10); @@ -403,19 +403,19 @@ public function testDeleteRelationStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteRelationEventInterface::class, 10], + [BeforeDeleteRelationEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteRelationEventInterface::class, 0], - [DeleteRelationEventInterface::class, 0], + [BeforeDeleteRelationEvent::class, 0], + [DeleteRelationEvent::class, 0], ]); } public function testCreateContentEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateContentEventInterface::class, - CreateContentEventInterface::class + BeforeCreateContentEvent::class, + CreateContentEvent::class ); $parameters = [ @@ -434,8 +434,8 @@ public function testCreateContentEvents() $this->assertSame($content, $result); $this->assertSame($calledListeners, [ - [BeforeCreateContentEventInterface::class, 0], - [CreateContentEventInterface::class, 0], + [BeforeCreateContentEvent::class, 0], + [CreateContentEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -443,8 +443,8 @@ public function testCreateContentEvents() public function testReturnCreateContentResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateContentEventInterface::class, - CreateContentEventInterface::class + BeforeCreateContentEvent::class, + CreateContentEvent::class ); $parameters = [ @@ -457,7 +457,7 @@ public function testReturnCreateContentResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('createContent')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeCreateContentEventInterface::class, function (BeforeCreateContentEventInterface $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeCreateContentEvent::class, function (BeforeCreateContentEvent $event) use ($eventContent) { $event->setContent($eventContent); }, 10); @@ -468,9 +468,9 @@ public function testReturnCreateContentResultInBeforeEvents() $this->assertSame($eventContent, $result); $this->assertSame($calledListeners, [ - [BeforeCreateContentEventInterface::class, 10], - [BeforeCreateContentEventInterface::class, 0], - [CreateContentEventInterface::class, 0], + [BeforeCreateContentEvent::class, 10], + [BeforeCreateContentEvent::class, 0], + [CreateContentEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -478,8 +478,8 @@ public function testReturnCreateContentResultInBeforeEvents() public function testCreateContentStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateContentEventInterface::class, - CreateContentEventInterface::class + BeforeCreateContentEvent::class, + CreateContentEvent::class ); $parameters = [ @@ -492,7 +492,7 @@ public function testCreateContentStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('createContent')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeCreateContentEventInterface::class, function (BeforeCreateContentEventInterface $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeCreateContentEvent::class, function (BeforeCreateContentEvent $event) use ($eventContent) { $event->setContent($eventContent); $event->stopPropagation(); }, 10); @@ -505,19 +505,19 @@ public function testCreateContentStopPropagationInBeforeEvents() $this->assertSame($eventContent, $result); $this->assertSame($calledListeners, [ - [BeforeCreateContentEventInterface::class, 10], + [BeforeCreateContentEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateContentEventInterface::class, 0], - [CreateContentEventInterface::class, 0], + [BeforeCreateContentEvent::class, 0], + [CreateContentEvent::class, 0], ]); } public function testHideContentEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeHideContentEventInterface::class, - HideContentEventInterface::class + BeforeHideContentEvent::class, + HideContentEvent::class ); $parameters = [ @@ -532,8 +532,8 @@ public function testHideContentEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeHideContentEventInterface::class, 0], - [HideContentEventInterface::class, 0], + [BeforeHideContentEvent::class, 0], + [HideContentEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -541,8 +541,8 @@ public function testHideContentEvents() public function testHideContentStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeHideContentEventInterface::class, - HideContentEventInterface::class + BeforeHideContentEvent::class, + HideContentEvent::class ); $parameters = [ @@ -551,7 +551,7 @@ public function testHideContentStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeHideContentEventInterface::class, function (BeforeHideContentEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeHideContentEvent::class, function (BeforeHideContentEvent $event) { $event->stopPropagation(); }, 10); @@ -562,19 +562,19 @@ public function testHideContentStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeHideContentEventInterface::class, 10], + [BeforeHideContentEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeHideContentEventInterface::class, 0], - [HideContentEventInterface::class, 0], + [BeforeHideContentEvent::class, 0], + [HideContentEvent::class, 0], ]); } public function testDeleteVersionEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteVersionEventInterface::class, - DeleteVersionEventInterface::class + BeforeDeleteVersionEvent::class, + DeleteVersionEvent::class ); $parameters = [ @@ -589,8 +589,8 @@ public function testDeleteVersionEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteVersionEventInterface::class, 0], - [DeleteVersionEventInterface::class, 0], + [BeforeDeleteVersionEvent::class, 0], + [DeleteVersionEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -598,8 +598,8 @@ public function testDeleteVersionEvents() public function testDeleteVersionStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteVersionEventInterface::class, - DeleteVersionEventInterface::class + BeforeDeleteVersionEvent::class, + DeleteVersionEvent::class ); $parameters = [ @@ -608,7 +608,7 @@ public function testDeleteVersionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteVersionEventInterface::class, function (BeforeDeleteVersionEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeDeleteVersionEvent::class, function (BeforeDeleteVersionEvent $event) { $event->stopPropagation(); }, 10); @@ -619,19 +619,19 @@ public function testDeleteVersionStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteVersionEventInterface::class, 10], + [BeforeDeleteVersionEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteVersionEventInterface::class, 0], - [DeleteVersionEventInterface::class, 0], + [BeforeDeleteVersionEvent::class, 0], + [DeleteVersionEvent::class, 0], ]); } public function testAddRelationEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAddRelationEventInterface::class, - AddRelationEventInterface::class + BeforeAddRelationEvent::class, + AddRelationEvent::class ); $parameters = [ @@ -650,8 +650,8 @@ public function testAddRelationEvents() $this->assertSame($relation, $result); $this->assertSame($calledListeners, [ - [BeforeAddRelationEventInterface::class, 0], - [AddRelationEventInterface::class, 0], + [BeforeAddRelationEvent::class, 0], + [AddRelationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -659,8 +659,8 @@ public function testAddRelationEvents() public function testReturnAddRelationResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAddRelationEventInterface::class, - AddRelationEventInterface::class + BeforeAddRelationEvent::class, + AddRelationEvent::class ); $parameters = [ @@ -673,7 +673,7 @@ public function testReturnAddRelationResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('addRelation')->willReturn($relation); - $traceableEventDispatcher->addListener(BeforeAddRelationEventInterface::class, function (BeforeAddRelationEventInterface $event) use ($eventRelation) { + $traceableEventDispatcher->addListener(BeforeAddRelationEvent::class, function (BeforeAddRelationEvent $event) use ($eventRelation) { $event->setRelation($eventRelation); }, 10); @@ -684,9 +684,9 @@ public function testReturnAddRelationResultInBeforeEvents() $this->assertSame($eventRelation, $result); $this->assertSame($calledListeners, [ - [BeforeAddRelationEventInterface::class, 10], - [BeforeAddRelationEventInterface::class, 0], - [AddRelationEventInterface::class, 0], + [BeforeAddRelationEvent::class, 10], + [BeforeAddRelationEvent::class, 0], + [AddRelationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -694,8 +694,8 @@ public function testReturnAddRelationResultInBeforeEvents() public function testAddRelationStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAddRelationEventInterface::class, - AddRelationEventInterface::class + BeforeAddRelationEvent::class, + AddRelationEvent::class ); $parameters = [ @@ -708,7 +708,7 @@ public function testAddRelationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('addRelation')->willReturn($relation); - $traceableEventDispatcher->addListener(BeforeAddRelationEventInterface::class, function (BeforeAddRelationEventInterface $event) use ($eventRelation) { + $traceableEventDispatcher->addListener(BeforeAddRelationEvent::class, function (BeforeAddRelationEvent $event) use ($eventRelation) { $event->setRelation($eventRelation); $event->stopPropagation(); }, 10); @@ -721,19 +721,19 @@ public function testAddRelationStopPropagationInBeforeEvents() $this->assertSame($eventRelation, $result); $this->assertSame($calledListeners, [ - [BeforeAddRelationEventInterface::class, 10], + [BeforeAddRelationEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [AddRelationEventInterface::class, 0], - [BeforeAddRelationEventInterface::class, 0], + [AddRelationEvent::class, 0], + [BeforeAddRelationEvent::class, 0], ]); } public function testUpdateContentMetadataEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateContentMetadataEventInterface::class, - UpdateContentMetadataEventInterface::class + BeforeUpdateContentMetadataEvent::class, + UpdateContentMetadataEvent::class ); $parameters = [ @@ -752,8 +752,8 @@ public function testUpdateContentMetadataEvents() $this->assertSame($content, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateContentMetadataEventInterface::class, 0], - [UpdateContentMetadataEventInterface::class, 0], + [BeforeUpdateContentMetadataEvent::class, 0], + [UpdateContentMetadataEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -761,8 +761,8 @@ public function testUpdateContentMetadataEvents() public function testReturnUpdateContentMetadataResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateContentMetadataEventInterface::class, - UpdateContentMetadataEventInterface::class + BeforeUpdateContentMetadataEvent::class, + UpdateContentMetadataEvent::class ); $parameters = [ @@ -775,7 +775,7 @@ public function testReturnUpdateContentMetadataResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('updateContentMetadata')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeUpdateContentMetadataEventInterface::class, function (BeforeUpdateContentMetadataEventInterface $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeUpdateContentMetadataEvent::class, function (BeforeUpdateContentMetadataEvent $event) use ($eventContent) { $event->setContent($eventContent); }, 10); @@ -786,9 +786,9 @@ public function testReturnUpdateContentMetadataResultInBeforeEvents() $this->assertSame($eventContent, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateContentMetadataEventInterface::class, 10], - [BeforeUpdateContentMetadataEventInterface::class, 0], - [UpdateContentMetadataEventInterface::class, 0], + [BeforeUpdateContentMetadataEvent::class, 10], + [BeforeUpdateContentMetadataEvent::class, 0], + [UpdateContentMetadataEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -796,8 +796,8 @@ public function testReturnUpdateContentMetadataResultInBeforeEvents() public function testUpdateContentMetadataStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateContentMetadataEventInterface::class, - UpdateContentMetadataEventInterface::class + BeforeUpdateContentMetadataEvent::class, + UpdateContentMetadataEvent::class ); $parameters = [ @@ -810,7 +810,7 @@ public function testUpdateContentMetadataStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('updateContentMetadata')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeUpdateContentMetadataEventInterface::class, function (BeforeUpdateContentMetadataEventInterface $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeUpdateContentMetadataEvent::class, function (BeforeUpdateContentMetadataEvent $event) use ($eventContent) { $event->setContent($eventContent); $event->stopPropagation(); }, 10); @@ -823,19 +823,19 @@ public function testUpdateContentMetadataStopPropagationInBeforeEvents() $this->assertSame($eventContent, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateContentMetadataEventInterface::class, 10], + [BeforeUpdateContentMetadataEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateContentMetadataEventInterface::class, 0], - [UpdateContentMetadataEventInterface::class, 0], + [BeforeUpdateContentMetadataEvent::class, 0], + [UpdateContentMetadataEvent::class, 0], ]); } public function testDeleteTranslationEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteTranslationEventInterface::class, - DeleteTranslationEventInterface::class + BeforeDeleteTranslationEvent::class, + DeleteTranslationEvent::class ); $parameters = [ @@ -851,8 +851,8 @@ public function testDeleteTranslationEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteTranslationEventInterface::class, 0], - [DeleteTranslationEventInterface::class, 0], + [BeforeDeleteTranslationEvent::class, 0], + [DeleteTranslationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -860,8 +860,8 @@ public function testDeleteTranslationEvents() public function testDeleteTranslationStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteTranslationEventInterface::class, - DeleteTranslationEventInterface::class + BeforeDeleteTranslationEvent::class, + DeleteTranslationEvent::class ); $parameters = [ @@ -871,7 +871,7 @@ public function testDeleteTranslationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteTranslationEventInterface::class, function (BeforeDeleteTranslationEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeDeleteTranslationEvent::class, function (BeforeDeleteTranslationEvent $event) { $event->stopPropagation(); }, 10); @@ -882,19 +882,19 @@ public function testDeleteTranslationStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteTranslationEventInterface::class, 10], + [BeforeDeleteTranslationEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteTranslationEventInterface::class, 0], - [DeleteTranslationEventInterface::class, 0], + [BeforeDeleteTranslationEvent::class, 0], + [DeleteTranslationEvent::class, 0], ]); } public function testPublishVersionEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforePublishVersionEventInterface::class, - PublishVersionEventInterface::class + BeforePublishVersionEvent::class, + PublishVersionEvent::class ); $parameters = [ @@ -913,8 +913,8 @@ public function testPublishVersionEvents() $this->assertSame($content, $result); $this->assertSame($calledListeners, [ - [BeforePublishVersionEventInterface::class, 0], - [PublishVersionEventInterface::class, 0], + [BeforePublishVersionEvent::class, 0], + [PublishVersionEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -922,8 +922,8 @@ public function testPublishVersionEvents() public function testReturnPublishVersionResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforePublishVersionEventInterface::class, - PublishVersionEventInterface::class + BeforePublishVersionEvent::class, + PublishVersionEvent::class ); $parameters = [ @@ -936,7 +936,7 @@ public function testReturnPublishVersionResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('publishVersion')->willReturn($content); - $traceableEventDispatcher->addListener(BeforePublishVersionEventInterface::class, function (BeforePublishVersionEventInterface $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforePublishVersionEvent::class, function (BeforePublishVersionEvent $event) use ($eventContent) { $event->setContent($eventContent); }, 10); @@ -947,9 +947,9 @@ public function testReturnPublishVersionResultInBeforeEvents() $this->assertSame($eventContent, $result); $this->assertSame($calledListeners, [ - [BeforePublishVersionEventInterface::class, 10], - [BeforePublishVersionEventInterface::class, 0], - [PublishVersionEventInterface::class, 0], + [BeforePublishVersionEvent::class, 10], + [BeforePublishVersionEvent::class, 0], + [PublishVersionEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -957,8 +957,8 @@ public function testReturnPublishVersionResultInBeforeEvents() public function testPublishVersionStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforePublishVersionEventInterface::class, - PublishVersionEventInterface::class + BeforePublishVersionEvent::class, + PublishVersionEvent::class ); $parameters = [ @@ -971,7 +971,7 @@ public function testPublishVersionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('publishVersion')->willReturn($content); - $traceableEventDispatcher->addListener(BeforePublishVersionEventInterface::class, function (BeforePublishVersionEventInterface $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforePublishVersionEvent::class, function (BeforePublishVersionEvent $event) use ($eventContent) { $event->setContent($eventContent); $event->stopPropagation(); }, 10); @@ -984,19 +984,19 @@ public function testPublishVersionStopPropagationInBeforeEvents() $this->assertSame($eventContent, $result); $this->assertSame($calledListeners, [ - [BeforePublishVersionEventInterface::class, 10], + [BeforePublishVersionEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforePublishVersionEventInterface::class, 0], - [PublishVersionEventInterface::class, 0], + [BeforePublishVersionEvent::class, 0], + [PublishVersionEvent::class, 0], ]); } public function testCreateContentDraftEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateContentDraftEventInterface::class, - CreateContentDraftEventInterface::class + BeforeCreateContentDraftEvent::class, + CreateContentDraftEvent::class ); $parameters = [ @@ -1016,8 +1016,8 @@ public function testCreateContentDraftEvents() $this->assertSame($contentDraft, $result); $this->assertSame($calledListeners, [ - [BeforeCreateContentDraftEventInterface::class, 0], - [CreateContentDraftEventInterface::class, 0], + [BeforeCreateContentDraftEvent::class, 0], + [CreateContentDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -1025,8 +1025,8 @@ public function testCreateContentDraftEvents() public function testReturnCreateContentDraftResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateContentDraftEventInterface::class, - CreateContentDraftEventInterface::class + BeforeCreateContentDraftEvent::class, + CreateContentDraftEvent::class ); $parameters = [ @@ -1040,7 +1040,7 @@ public function testReturnCreateContentDraftResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('createContentDraft')->willReturn($contentDraft); - $traceableEventDispatcher->addListener(BeforeCreateContentDraftEventInterface::class, function (BeforeCreateContentDraftEventInterface $event) use ($eventContentDraft) { + $traceableEventDispatcher->addListener(BeforeCreateContentDraftEvent::class, function (BeforeCreateContentDraftEvent $event) use ($eventContentDraft) { $event->setContentDraft($eventContentDraft); }, 10); @@ -1051,9 +1051,9 @@ public function testReturnCreateContentDraftResultInBeforeEvents() $this->assertSame($eventContentDraft, $result); $this->assertSame($calledListeners, [ - [BeforeCreateContentDraftEventInterface::class, 10], - [BeforeCreateContentDraftEventInterface::class, 0], - [CreateContentDraftEventInterface::class, 0], + [BeforeCreateContentDraftEvent::class, 10], + [BeforeCreateContentDraftEvent::class, 0], + [CreateContentDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -1061,8 +1061,8 @@ public function testReturnCreateContentDraftResultInBeforeEvents() public function testCreateContentDraftStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateContentDraftEventInterface::class, - CreateContentDraftEventInterface::class + BeforeCreateContentDraftEvent::class, + CreateContentDraftEvent::class ); $parameters = [ @@ -1076,7 +1076,7 @@ public function testCreateContentDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('createContentDraft')->willReturn($contentDraft); - $traceableEventDispatcher->addListener(BeforeCreateContentDraftEventInterface::class, function (BeforeCreateContentDraftEventInterface $event) use ($eventContentDraft) { + $traceableEventDispatcher->addListener(BeforeCreateContentDraftEvent::class, function (BeforeCreateContentDraftEvent $event) use ($eventContentDraft) { $event->setContentDraft($eventContentDraft); $event->stopPropagation(); }, 10); @@ -1089,19 +1089,19 @@ public function testCreateContentDraftStopPropagationInBeforeEvents() $this->assertSame($eventContentDraft, $result); $this->assertSame($calledListeners, [ - [BeforeCreateContentDraftEventInterface::class, 10], + [BeforeCreateContentDraftEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateContentDraftEventInterface::class, 0], - [CreateContentDraftEventInterface::class, 0], + [BeforeCreateContentDraftEvent::class, 0], + [CreateContentDraftEvent::class, 0], ]); } public function testRevealContentEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRevealContentEventInterface::class, - RevealContentEventInterface::class + BeforeRevealContentEvent::class, + RevealContentEvent::class ); $parameters = [ @@ -1116,8 +1116,8 @@ public function testRevealContentEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeRevealContentEventInterface::class, 0], - [RevealContentEventInterface::class, 0], + [BeforeRevealContentEvent::class, 0], + [RevealContentEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -1125,8 +1125,8 @@ public function testRevealContentEvents() public function testRevealContentStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRevealContentEventInterface::class, - RevealContentEventInterface::class + BeforeRevealContentEvent::class, + RevealContentEvent::class ); $parameters = [ @@ -1135,7 +1135,7 @@ public function testRevealContentStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeRevealContentEventInterface::class, function (BeforeRevealContentEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeRevealContentEvent::class, function (BeforeRevealContentEvent $event) { $event->stopPropagation(); }, 10); @@ -1146,11 +1146,11 @@ public function testRevealContentStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeRevealContentEventInterface::class, 10], + [BeforeRevealContentEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeRevealContentEventInterface::class, 0], - [RevealContentEventInterface::class, 0], + [BeforeRevealContentEvent::class, 0], + [RevealContentEvent::class, 0], ]); } } diff --git a/eZ/Publish/Core/Event/Tests/ContentTypeServiceTest.php b/eZ/Publish/Core/Event/Tests/ContentTypeServiceTest.php index 20fcd559865..23dd63244a3 100644 --- a/eZ/Publish/Core/Event/Tests/ContentTypeServiceTest.php +++ b/eZ/Publish/Core/Event/Tests/ContentTypeServiceTest.php @@ -7,36 +7,36 @@ namespace eZ\Publish\Core\Event\Tests; use eZ\Publish\API\Repository\ContentTypeService as ContentTypeServiceInterface; -use eZ\Publish\API\Repository\Events\ContentType\AddFieldDefinitionEvent as AddFieldDefinitionEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\AssignContentTypeGroupEvent as AssignContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeAddFieldDefinitionEvent as BeforeAddFieldDefinitionEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeAssignContentTypeGroupEvent as BeforeAssignContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeCopyContentTypeEvent as BeforeCopyContentTypeEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeCreateContentTypeDraftEvent as BeforeCreateContentTypeDraftEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeCreateContentTypeEvent as BeforeCreateContentTypeEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeCreateContentTypeGroupEvent as BeforeCreateContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeDeleteContentTypeEvent as BeforeDeleteContentTypeEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeDeleteContentTypeGroupEvent as BeforeDeleteContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforePublishContentTypeDraftEvent as BeforePublishContentTypeDraftEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeRemoveContentTypeTranslationEvent as BeforeRemoveContentTypeTranslationEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeRemoveFieldDefinitionEvent as BeforeRemoveFieldDefinitionEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeUnassignContentTypeGroupEvent as BeforeUnassignContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeUpdateContentTypeDraftEvent as BeforeUpdateContentTypeDraftEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeUpdateContentTypeGroupEvent as BeforeUpdateContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\BeforeUpdateFieldDefinitionEvent as BeforeUpdateFieldDefinitionEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\CopyContentTypeEvent as CopyContentTypeEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\CreateContentTypeDraftEvent as CreateContentTypeDraftEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\CreateContentTypeEvent as CreateContentTypeEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\CreateContentTypeGroupEvent as CreateContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\DeleteContentTypeEvent as DeleteContentTypeEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\DeleteContentTypeGroupEvent as DeleteContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\PublishContentTypeDraftEvent as PublishContentTypeDraftEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\RemoveContentTypeTranslationEvent as RemoveContentTypeTranslationEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\RemoveFieldDefinitionEvent as RemoveFieldDefinitionEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\UnassignContentTypeGroupEvent as UnassignContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\UpdateContentTypeDraftEvent as UpdateContentTypeDraftEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\UpdateContentTypeGroupEvent as UpdateContentTypeGroupEventInterface; -use eZ\Publish\API\Repository\Events\ContentType\UpdateFieldDefinitionEvent as UpdateFieldDefinitionEventInterface; +use eZ\Publish\API\Repository\Events\ContentType\AddFieldDefinitionEvent; +use eZ\Publish\API\Repository\Events\ContentType\AssignContentTypeGroupEvent; +use eZ\Publish\API\Repository\Events\ContentType\BeforeAddFieldDefinitionEvent; +use eZ\Publish\API\Repository\Events\ContentType\BeforeAssignContentTypeGroupEvent; +use eZ\Publish\API\Repository\Events\ContentType\BeforeCopyContentTypeEvent; +use eZ\Publish\API\Repository\Events\ContentType\BeforeCreateContentTypeDraftEvent; +use eZ\Publish\API\Repository\Events\ContentType\BeforeCreateContentTypeEvent; +use eZ\Publish\API\Repository\Events\ContentType\BeforeCreateContentTypeGroupEvent; +use eZ\Publish\API\Repository\Events\ContentType\BeforeDeleteContentTypeEvent; +use eZ\Publish\API\Repository\Events\ContentType\BeforeDeleteContentTypeGroupEvent; +use eZ\Publish\API\Repository\Events\ContentType\BeforePublishContentTypeDraftEvent; +use eZ\Publish\API\Repository\Events\ContentType\BeforeRemoveContentTypeTranslationEvent; +use eZ\Publish\API\Repository\Events\ContentType\BeforeRemoveFieldDefinitionEvent; +use eZ\Publish\API\Repository\Events\ContentType\BeforeUnassignContentTypeGroupEvent; +use eZ\Publish\API\Repository\Events\ContentType\BeforeUpdateContentTypeDraftEvent; +use eZ\Publish\API\Repository\Events\ContentType\BeforeUpdateContentTypeGroupEvent; +use eZ\Publish\API\Repository\Events\ContentType\BeforeUpdateFieldDefinitionEvent; +use eZ\Publish\API\Repository\Events\ContentType\CopyContentTypeEvent; +use eZ\Publish\API\Repository\Events\ContentType\CreateContentTypeDraftEvent; +use eZ\Publish\API\Repository\Events\ContentType\CreateContentTypeEvent; +use eZ\Publish\API\Repository\Events\ContentType\CreateContentTypeGroupEvent; +use eZ\Publish\API\Repository\Events\ContentType\DeleteContentTypeEvent; +use eZ\Publish\API\Repository\Events\ContentType\DeleteContentTypeGroupEvent; +use eZ\Publish\API\Repository\Events\ContentType\PublishContentTypeDraftEvent; +use eZ\Publish\API\Repository\Events\ContentType\RemoveContentTypeTranslationEvent; +use eZ\Publish\API\Repository\Events\ContentType\RemoveFieldDefinitionEvent; +use eZ\Publish\API\Repository\Events\ContentType\UnassignContentTypeGroupEvent; +use eZ\Publish\API\Repository\Events\ContentType\UpdateContentTypeDraftEvent; +use eZ\Publish\API\Repository\Events\ContentType\UpdateContentTypeGroupEvent; +use eZ\Publish\API\Repository\Events\ContentType\UpdateFieldDefinitionEvent; use eZ\Publish\API\Repository\Values\ContentType\ContentType; use eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct; use eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft; @@ -55,8 +55,8 @@ class ContentTypeServiceTest extends AbstractServiceTest public function testAddFieldDefinitionEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAddFieldDefinitionEventInterface::class, - AddFieldDefinitionEventInterface::class + BeforeAddFieldDefinitionEvent::class, + AddFieldDefinitionEvent::class ); $parameters = [ @@ -72,8 +72,8 @@ public function testAddFieldDefinitionEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeAddFieldDefinitionEventInterface::class, 0], - [AddFieldDefinitionEventInterface::class, 0], + [BeforeAddFieldDefinitionEvent::class, 0], + [AddFieldDefinitionEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -81,8 +81,8 @@ public function testAddFieldDefinitionEvents() public function testAddFieldDefinitionStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAddFieldDefinitionEventInterface::class, - AddFieldDefinitionEventInterface::class + BeforeAddFieldDefinitionEvent::class, + AddFieldDefinitionEvent::class ); $parameters = [ @@ -92,7 +92,7 @@ public function testAddFieldDefinitionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeAddFieldDefinitionEventInterface::class, function (BeforeAddFieldDefinitionEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeAddFieldDefinitionEvent::class, function (BeforeAddFieldDefinitionEvent $event) { $event->stopPropagation(); }, 10); @@ -103,19 +103,19 @@ public function testAddFieldDefinitionStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeAddFieldDefinitionEventInterface::class, 10], + [BeforeAddFieldDefinitionEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [AddFieldDefinitionEventInterface::class, 0], - [BeforeAddFieldDefinitionEventInterface::class, 0], + [AddFieldDefinitionEvent::class, 0], + [BeforeAddFieldDefinitionEvent::class, 0], ]); } public function testDeleteContentTypeGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteContentTypeGroupEventInterface::class, - DeleteContentTypeGroupEventInterface::class + BeforeDeleteContentTypeGroupEvent::class, + DeleteContentTypeGroupEvent::class ); $parameters = [ @@ -130,8 +130,8 @@ public function testDeleteContentTypeGroupEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteContentTypeGroupEventInterface::class, 0], - [DeleteContentTypeGroupEventInterface::class, 0], + [BeforeDeleteContentTypeGroupEvent::class, 0], + [DeleteContentTypeGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -139,8 +139,8 @@ public function testDeleteContentTypeGroupEvents() public function testDeleteContentTypeGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteContentTypeGroupEventInterface::class, - DeleteContentTypeGroupEventInterface::class + BeforeDeleteContentTypeGroupEvent::class, + DeleteContentTypeGroupEvent::class ); $parameters = [ @@ -149,7 +149,7 @@ public function testDeleteContentTypeGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteContentTypeGroupEventInterface::class, function (BeforeDeleteContentTypeGroupEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeDeleteContentTypeGroupEvent::class, function (BeforeDeleteContentTypeGroupEvent $event) { $event->stopPropagation(); }, 10); @@ -160,19 +160,19 @@ public function testDeleteContentTypeGroupStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteContentTypeGroupEventInterface::class, 10], + [BeforeDeleteContentTypeGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteContentTypeGroupEventInterface::class, 0], - [DeleteContentTypeGroupEventInterface::class, 0], + [BeforeDeleteContentTypeGroupEvent::class, 0], + [DeleteContentTypeGroupEvent::class, 0], ]); } public function testCreateContentTypeDraftEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateContentTypeDraftEventInterface::class, - CreateContentTypeDraftEventInterface::class + BeforeCreateContentTypeDraftEvent::class, + CreateContentTypeDraftEvent::class ); $parameters = [ @@ -190,8 +190,8 @@ public function testCreateContentTypeDraftEvents() $this->assertSame($contentTypeDraft, $result); $this->assertSame($calledListeners, [ - [BeforeCreateContentTypeDraftEventInterface::class, 0], - [CreateContentTypeDraftEventInterface::class, 0], + [BeforeCreateContentTypeDraftEvent::class, 0], + [CreateContentTypeDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -199,8 +199,8 @@ public function testCreateContentTypeDraftEvents() public function testReturnCreateContentTypeDraftResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateContentTypeDraftEventInterface::class, - CreateContentTypeDraftEventInterface::class + BeforeCreateContentTypeDraftEvent::class, + CreateContentTypeDraftEvent::class ); $parameters = [ @@ -212,7 +212,7 @@ public function testReturnCreateContentTypeDraftResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('createContentTypeDraft')->willReturn($contentTypeDraft); - $traceableEventDispatcher->addListener(BeforeCreateContentTypeDraftEventInterface::class, function (BeforeCreateContentTypeDraftEventInterface $event) use ($eventContentTypeDraft) { + $traceableEventDispatcher->addListener(BeforeCreateContentTypeDraftEvent::class, function (BeforeCreateContentTypeDraftEvent $event) use ($eventContentTypeDraft) { $event->setContentTypeDraft($eventContentTypeDraft); }, 10); @@ -223,9 +223,9 @@ public function testReturnCreateContentTypeDraftResultInBeforeEvents() $this->assertSame($eventContentTypeDraft, $result); $this->assertSame($calledListeners, [ - [BeforeCreateContentTypeDraftEventInterface::class, 10], - [BeforeCreateContentTypeDraftEventInterface::class, 0], - [CreateContentTypeDraftEventInterface::class, 0], + [BeforeCreateContentTypeDraftEvent::class, 10], + [BeforeCreateContentTypeDraftEvent::class, 0], + [CreateContentTypeDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -233,8 +233,8 @@ public function testReturnCreateContentTypeDraftResultInBeforeEvents() public function testCreateContentTypeDraftStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateContentTypeDraftEventInterface::class, - CreateContentTypeDraftEventInterface::class + BeforeCreateContentTypeDraftEvent::class, + CreateContentTypeDraftEvent::class ); $parameters = [ @@ -246,7 +246,7 @@ public function testCreateContentTypeDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('createContentTypeDraft')->willReturn($contentTypeDraft); - $traceableEventDispatcher->addListener(BeforeCreateContentTypeDraftEventInterface::class, function (BeforeCreateContentTypeDraftEventInterface $event) use ($eventContentTypeDraft) { + $traceableEventDispatcher->addListener(BeforeCreateContentTypeDraftEvent::class, function (BeforeCreateContentTypeDraftEvent $event) use ($eventContentTypeDraft) { $event->setContentTypeDraft($eventContentTypeDraft); $event->stopPropagation(); }, 10); @@ -259,19 +259,19 @@ public function testCreateContentTypeDraftStopPropagationInBeforeEvents() $this->assertSame($eventContentTypeDraft, $result); $this->assertSame($calledListeners, [ - [BeforeCreateContentTypeDraftEventInterface::class, 10], + [BeforeCreateContentTypeDraftEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateContentTypeDraftEventInterface::class, 0], - [CreateContentTypeDraftEventInterface::class, 0], + [BeforeCreateContentTypeDraftEvent::class, 0], + [CreateContentTypeDraftEvent::class, 0], ]); } public function testCreateContentTypeGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateContentTypeGroupEventInterface::class, - CreateContentTypeGroupEventInterface::class + BeforeCreateContentTypeGroupEvent::class, + CreateContentTypeGroupEvent::class ); $parameters = [ @@ -289,8 +289,8 @@ public function testCreateContentTypeGroupEvents() $this->assertSame($contentTypeGroup, $result); $this->assertSame($calledListeners, [ - [BeforeCreateContentTypeGroupEventInterface::class, 0], - [CreateContentTypeGroupEventInterface::class, 0], + [BeforeCreateContentTypeGroupEvent::class, 0], + [CreateContentTypeGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -298,8 +298,8 @@ public function testCreateContentTypeGroupEvents() public function testReturnCreateContentTypeGroupResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateContentTypeGroupEventInterface::class, - CreateContentTypeGroupEventInterface::class + BeforeCreateContentTypeGroupEvent::class, + CreateContentTypeGroupEvent::class ); $parameters = [ @@ -311,7 +311,7 @@ public function testReturnCreateContentTypeGroupResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('createContentTypeGroup')->willReturn($contentTypeGroup); - $traceableEventDispatcher->addListener(BeforeCreateContentTypeGroupEventInterface::class, function (BeforeCreateContentTypeGroupEventInterface $event) use ($eventContentTypeGroup) { + $traceableEventDispatcher->addListener(BeforeCreateContentTypeGroupEvent::class, function (BeforeCreateContentTypeGroupEvent $event) use ($eventContentTypeGroup) { $event->setContentTypeGroup($eventContentTypeGroup); }, 10); @@ -322,9 +322,9 @@ public function testReturnCreateContentTypeGroupResultInBeforeEvents() $this->assertSame($eventContentTypeGroup, $result); $this->assertSame($calledListeners, [ - [BeforeCreateContentTypeGroupEventInterface::class, 10], - [BeforeCreateContentTypeGroupEventInterface::class, 0], - [CreateContentTypeGroupEventInterface::class, 0], + [BeforeCreateContentTypeGroupEvent::class, 10], + [BeforeCreateContentTypeGroupEvent::class, 0], + [CreateContentTypeGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -332,8 +332,8 @@ public function testReturnCreateContentTypeGroupResultInBeforeEvents() public function testCreateContentTypeGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateContentTypeGroupEventInterface::class, - CreateContentTypeGroupEventInterface::class + BeforeCreateContentTypeGroupEvent::class, + CreateContentTypeGroupEvent::class ); $parameters = [ @@ -345,7 +345,7 @@ public function testCreateContentTypeGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('createContentTypeGroup')->willReturn($contentTypeGroup); - $traceableEventDispatcher->addListener(BeforeCreateContentTypeGroupEventInterface::class, function (BeforeCreateContentTypeGroupEventInterface $event) use ($eventContentTypeGroup) { + $traceableEventDispatcher->addListener(BeforeCreateContentTypeGroupEvent::class, function (BeforeCreateContentTypeGroupEvent $event) use ($eventContentTypeGroup) { $event->setContentTypeGroup($eventContentTypeGroup); $event->stopPropagation(); }, 10); @@ -358,19 +358,19 @@ public function testCreateContentTypeGroupStopPropagationInBeforeEvents() $this->assertSame($eventContentTypeGroup, $result); $this->assertSame($calledListeners, [ - [BeforeCreateContentTypeGroupEventInterface::class, 10], + [BeforeCreateContentTypeGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateContentTypeGroupEventInterface::class, 0], - [CreateContentTypeGroupEventInterface::class, 0], + [BeforeCreateContentTypeGroupEvent::class, 0], + [CreateContentTypeGroupEvent::class, 0], ]); } public function testUpdateContentTypeGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateContentTypeGroupEventInterface::class, - UpdateContentTypeGroupEventInterface::class + BeforeUpdateContentTypeGroupEvent::class, + UpdateContentTypeGroupEvent::class ); $parameters = [ @@ -386,8 +386,8 @@ public function testUpdateContentTypeGroupEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeUpdateContentTypeGroupEventInterface::class, 0], - [UpdateContentTypeGroupEventInterface::class, 0], + [BeforeUpdateContentTypeGroupEvent::class, 0], + [UpdateContentTypeGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -395,8 +395,8 @@ public function testUpdateContentTypeGroupEvents() public function testUpdateContentTypeGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateContentTypeGroupEventInterface::class, - UpdateContentTypeGroupEventInterface::class + BeforeUpdateContentTypeGroupEvent::class, + UpdateContentTypeGroupEvent::class ); $parameters = [ @@ -406,7 +406,7 @@ public function testUpdateContentTypeGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeUpdateContentTypeGroupEventInterface::class, function (BeforeUpdateContentTypeGroupEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeUpdateContentTypeGroupEvent::class, function (BeforeUpdateContentTypeGroupEvent $event) { $event->stopPropagation(); }, 10); @@ -417,19 +417,19 @@ public function testUpdateContentTypeGroupStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeUpdateContentTypeGroupEventInterface::class, 10], + [BeforeUpdateContentTypeGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateContentTypeGroupEventInterface::class, 0], - [UpdateContentTypeGroupEventInterface::class, 0], + [BeforeUpdateContentTypeGroupEvent::class, 0], + [UpdateContentTypeGroupEvent::class, 0], ]); } public function testCreateContentTypeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateContentTypeEventInterface::class, - CreateContentTypeEventInterface::class + BeforeCreateContentTypeEvent::class, + CreateContentTypeEvent::class ); $parameters = [ @@ -448,8 +448,8 @@ public function testCreateContentTypeEvents() $this->assertSame($contentTypeDraft, $result); $this->assertSame($calledListeners, [ - [BeforeCreateContentTypeEventInterface::class, 0], - [CreateContentTypeEventInterface::class, 0], + [BeforeCreateContentTypeEvent::class, 0], + [CreateContentTypeEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -457,8 +457,8 @@ public function testCreateContentTypeEvents() public function testReturnCreateContentTypeResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateContentTypeEventInterface::class, - CreateContentTypeEventInterface::class + BeforeCreateContentTypeEvent::class, + CreateContentTypeEvent::class ); $parameters = [ @@ -471,7 +471,7 @@ public function testReturnCreateContentTypeResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('createContentType')->willReturn($contentTypeDraft); - $traceableEventDispatcher->addListener(BeforeCreateContentTypeEventInterface::class, function (BeforeCreateContentTypeEventInterface $event) use ($eventContentTypeDraft) { + $traceableEventDispatcher->addListener(BeforeCreateContentTypeEvent::class, function (BeforeCreateContentTypeEvent $event) use ($eventContentTypeDraft) { $event->setContentTypeDraft($eventContentTypeDraft); }, 10); @@ -482,9 +482,9 @@ public function testReturnCreateContentTypeResultInBeforeEvents() $this->assertSame($eventContentTypeDraft, $result); $this->assertSame($calledListeners, [ - [BeforeCreateContentTypeEventInterface::class, 10], - [BeforeCreateContentTypeEventInterface::class, 0], - [CreateContentTypeEventInterface::class, 0], + [BeforeCreateContentTypeEvent::class, 10], + [BeforeCreateContentTypeEvent::class, 0], + [CreateContentTypeEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -492,8 +492,8 @@ public function testReturnCreateContentTypeResultInBeforeEvents() public function testCreateContentTypeStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateContentTypeEventInterface::class, - CreateContentTypeEventInterface::class + BeforeCreateContentTypeEvent::class, + CreateContentTypeEvent::class ); $parameters = [ @@ -506,7 +506,7 @@ public function testCreateContentTypeStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('createContentType')->willReturn($contentTypeDraft); - $traceableEventDispatcher->addListener(BeforeCreateContentTypeEventInterface::class, function (BeforeCreateContentTypeEventInterface $event) use ($eventContentTypeDraft) { + $traceableEventDispatcher->addListener(BeforeCreateContentTypeEvent::class, function (BeforeCreateContentTypeEvent $event) use ($eventContentTypeDraft) { $event->setContentTypeDraft($eventContentTypeDraft); $event->stopPropagation(); }, 10); @@ -519,19 +519,19 @@ public function testCreateContentTypeStopPropagationInBeforeEvents() $this->assertSame($eventContentTypeDraft, $result); $this->assertSame($calledListeners, [ - [BeforeCreateContentTypeEventInterface::class, 10], + [BeforeCreateContentTypeEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateContentTypeEventInterface::class, 0], - [CreateContentTypeEventInterface::class, 0], + [BeforeCreateContentTypeEvent::class, 0], + [CreateContentTypeEvent::class, 0], ]); } public function testRemoveContentTypeTranslationEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRemoveContentTypeTranslationEventInterface::class, - RemoveContentTypeTranslationEventInterface::class + BeforeRemoveContentTypeTranslationEvent::class, + RemoveContentTypeTranslationEvent::class ); $parameters = [ @@ -550,8 +550,8 @@ public function testRemoveContentTypeTranslationEvents() $this->assertSame($newContentTypeDraft, $result); $this->assertSame($calledListeners, [ - [BeforeRemoveContentTypeTranslationEventInterface::class, 0], - [RemoveContentTypeTranslationEventInterface::class, 0], + [BeforeRemoveContentTypeTranslationEvent::class, 0], + [RemoveContentTypeTranslationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -559,8 +559,8 @@ public function testRemoveContentTypeTranslationEvents() public function testReturnRemoveContentTypeTranslationResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRemoveContentTypeTranslationEventInterface::class, - RemoveContentTypeTranslationEventInterface::class + BeforeRemoveContentTypeTranslationEvent::class, + RemoveContentTypeTranslationEvent::class ); $parameters = [ @@ -573,7 +573,7 @@ public function testReturnRemoveContentTypeTranslationResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('removeContentTypeTranslation')->willReturn($newContentTypeDraft); - $traceableEventDispatcher->addListener(BeforeRemoveContentTypeTranslationEventInterface::class, function (BeforeRemoveContentTypeTranslationEventInterface $event) use ($eventNewContentTypeDraft) { + $traceableEventDispatcher->addListener(BeforeRemoveContentTypeTranslationEvent::class, function (BeforeRemoveContentTypeTranslationEvent $event) use ($eventNewContentTypeDraft) { $event->setNewContentTypeDraft($eventNewContentTypeDraft); }, 10); @@ -584,9 +584,9 @@ public function testReturnRemoveContentTypeTranslationResultInBeforeEvents() $this->assertSame($eventNewContentTypeDraft, $result); $this->assertSame($calledListeners, [ - [BeforeRemoveContentTypeTranslationEventInterface::class, 10], - [BeforeRemoveContentTypeTranslationEventInterface::class, 0], - [RemoveContentTypeTranslationEventInterface::class, 0], + [BeforeRemoveContentTypeTranslationEvent::class, 10], + [BeforeRemoveContentTypeTranslationEvent::class, 0], + [RemoveContentTypeTranslationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -594,8 +594,8 @@ public function testReturnRemoveContentTypeTranslationResultInBeforeEvents() public function testRemoveContentTypeTranslationStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRemoveContentTypeTranslationEventInterface::class, - RemoveContentTypeTranslationEventInterface::class + BeforeRemoveContentTypeTranslationEvent::class, + RemoveContentTypeTranslationEvent::class ); $parameters = [ @@ -608,7 +608,7 @@ public function testRemoveContentTypeTranslationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('removeContentTypeTranslation')->willReturn($newContentTypeDraft); - $traceableEventDispatcher->addListener(BeforeRemoveContentTypeTranslationEventInterface::class, function (BeforeRemoveContentTypeTranslationEventInterface $event) use ($eventNewContentTypeDraft) { + $traceableEventDispatcher->addListener(BeforeRemoveContentTypeTranslationEvent::class, function (BeforeRemoveContentTypeTranslationEvent $event) use ($eventNewContentTypeDraft) { $event->setNewContentTypeDraft($eventNewContentTypeDraft); $event->stopPropagation(); }, 10); @@ -621,19 +621,19 @@ public function testRemoveContentTypeTranslationStopPropagationInBeforeEvents() $this->assertSame($eventNewContentTypeDraft, $result); $this->assertSame($calledListeners, [ - [BeforeRemoveContentTypeTranslationEventInterface::class, 10], + [BeforeRemoveContentTypeTranslationEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeRemoveContentTypeTranslationEventInterface::class, 0], - [RemoveContentTypeTranslationEventInterface::class, 0], + [BeforeRemoveContentTypeTranslationEvent::class, 0], + [RemoveContentTypeTranslationEvent::class, 0], ]); } public function testUnassignContentTypeGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUnassignContentTypeGroupEventInterface::class, - UnassignContentTypeGroupEventInterface::class + BeforeUnassignContentTypeGroupEvent::class, + UnassignContentTypeGroupEvent::class ); $parameters = [ @@ -649,8 +649,8 @@ public function testUnassignContentTypeGroupEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeUnassignContentTypeGroupEventInterface::class, 0], - [UnassignContentTypeGroupEventInterface::class, 0], + [BeforeUnassignContentTypeGroupEvent::class, 0], + [UnassignContentTypeGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -658,8 +658,8 @@ public function testUnassignContentTypeGroupEvents() public function testUnassignContentTypeGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUnassignContentTypeGroupEventInterface::class, - UnassignContentTypeGroupEventInterface::class + BeforeUnassignContentTypeGroupEvent::class, + UnassignContentTypeGroupEvent::class ); $parameters = [ @@ -669,7 +669,7 @@ public function testUnassignContentTypeGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeUnassignContentTypeGroupEventInterface::class, function (BeforeUnassignContentTypeGroupEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeUnassignContentTypeGroupEvent::class, function (BeforeUnassignContentTypeGroupEvent $event) { $event->stopPropagation(); }, 10); @@ -680,19 +680,19 @@ public function testUnassignContentTypeGroupStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeUnassignContentTypeGroupEventInterface::class, 10], + [BeforeUnassignContentTypeGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUnassignContentTypeGroupEventInterface::class, 0], - [UnassignContentTypeGroupEventInterface::class, 0], + [BeforeUnassignContentTypeGroupEvent::class, 0], + [UnassignContentTypeGroupEvent::class, 0], ]); } public function testPublishContentTypeDraftEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforePublishContentTypeDraftEventInterface::class, - PublishContentTypeDraftEventInterface::class + BeforePublishContentTypeDraftEvent::class, + PublishContentTypeDraftEvent::class ); $parameters = [ @@ -707,8 +707,8 @@ public function testPublishContentTypeDraftEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforePublishContentTypeDraftEventInterface::class, 0], - [PublishContentTypeDraftEventInterface::class, 0], + [BeforePublishContentTypeDraftEvent::class, 0], + [PublishContentTypeDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -716,8 +716,8 @@ public function testPublishContentTypeDraftEvents() public function testPublishContentTypeDraftStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforePublishContentTypeDraftEventInterface::class, - PublishContentTypeDraftEventInterface::class + BeforePublishContentTypeDraftEvent::class, + PublishContentTypeDraftEvent::class ); $parameters = [ @@ -726,7 +726,7 @@ public function testPublishContentTypeDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforePublishContentTypeDraftEventInterface::class, function (BeforePublishContentTypeDraftEventInterface $event) { + $traceableEventDispatcher->addListener(BeforePublishContentTypeDraftEvent::class, function (BeforePublishContentTypeDraftEvent $event) { $event->stopPropagation(); }, 10); @@ -737,19 +737,19 @@ public function testPublishContentTypeDraftStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforePublishContentTypeDraftEventInterface::class, 10], + [BeforePublishContentTypeDraftEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforePublishContentTypeDraftEventInterface::class, 0], - [PublishContentTypeDraftEventInterface::class, 0], + [BeforePublishContentTypeDraftEvent::class, 0], + [PublishContentTypeDraftEvent::class, 0], ]); } public function testUpdateFieldDefinitionEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateFieldDefinitionEventInterface::class, - UpdateFieldDefinitionEventInterface::class + BeforeUpdateFieldDefinitionEvent::class, + UpdateFieldDefinitionEvent::class ); $parameters = [ @@ -766,8 +766,8 @@ public function testUpdateFieldDefinitionEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeUpdateFieldDefinitionEventInterface::class, 0], - [UpdateFieldDefinitionEventInterface::class, 0], + [BeforeUpdateFieldDefinitionEvent::class, 0], + [UpdateFieldDefinitionEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -775,8 +775,8 @@ public function testUpdateFieldDefinitionEvents() public function testUpdateFieldDefinitionStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateFieldDefinitionEventInterface::class, - UpdateFieldDefinitionEventInterface::class + BeforeUpdateFieldDefinitionEvent::class, + UpdateFieldDefinitionEvent::class ); $parameters = [ @@ -787,7 +787,7 @@ public function testUpdateFieldDefinitionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeUpdateFieldDefinitionEventInterface::class, function (BeforeUpdateFieldDefinitionEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeUpdateFieldDefinitionEvent::class, function (BeforeUpdateFieldDefinitionEvent $event) { $event->stopPropagation(); }, 10); @@ -798,19 +798,19 @@ public function testUpdateFieldDefinitionStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeUpdateFieldDefinitionEventInterface::class, 10], + [BeforeUpdateFieldDefinitionEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateFieldDefinitionEventInterface::class, 0], - [UpdateFieldDefinitionEventInterface::class, 0], + [BeforeUpdateFieldDefinitionEvent::class, 0], + [UpdateFieldDefinitionEvent::class, 0], ]); } public function testRemoveFieldDefinitionEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRemoveFieldDefinitionEventInterface::class, - RemoveFieldDefinitionEventInterface::class + BeforeRemoveFieldDefinitionEvent::class, + RemoveFieldDefinitionEvent::class ); $parameters = [ @@ -826,8 +826,8 @@ public function testRemoveFieldDefinitionEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeRemoveFieldDefinitionEventInterface::class, 0], - [RemoveFieldDefinitionEventInterface::class, 0], + [BeforeRemoveFieldDefinitionEvent::class, 0], + [RemoveFieldDefinitionEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -835,8 +835,8 @@ public function testRemoveFieldDefinitionEvents() public function testRemoveFieldDefinitionStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRemoveFieldDefinitionEventInterface::class, - RemoveFieldDefinitionEventInterface::class + BeforeRemoveFieldDefinitionEvent::class, + RemoveFieldDefinitionEvent::class ); $parameters = [ @@ -846,7 +846,7 @@ public function testRemoveFieldDefinitionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeRemoveFieldDefinitionEventInterface::class, function (BeforeRemoveFieldDefinitionEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeRemoveFieldDefinitionEvent::class, function (BeforeRemoveFieldDefinitionEvent $event) { $event->stopPropagation(); }, 10); @@ -857,19 +857,19 @@ public function testRemoveFieldDefinitionStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeRemoveFieldDefinitionEventInterface::class, 10], + [BeforeRemoveFieldDefinitionEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeRemoveFieldDefinitionEventInterface::class, 0], - [RemoveFieldDefinitionEventInterface::class, 0], + [BeforeRemoveFieldDefinitionEvent::class, 0], + [RemoveFieldDefinitionEvent::class, 0], ]); } public function testAssignContentTypeGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAssignContentTypeGroupEventInterface::class, - AssignContentTypeGroupEventInterface::class + BeforeAssignContentTypeGroupEvent::class, + AssignContentTypeGroupEvent::class ); $parameters = [ @@ -885,8 +885,8 @@ public function testAssignContentTypeGroupEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeAssignContentTypeGroupEventInterface::class, 0], - [AssignContentTypeGroupEventInterface::class, 0], + [BeforeAssignContentTypeGroupEvent::class, 0], + [AssignContentTypeGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -894,8 +894,8 @@ public function testAssignContentTypeGroupEvents() public function testAssignContentTypeGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAssignContentTypeGroupEventInterface::class, - AssignContentTypeGroupEventInterface::class + BeforeAssignContentTypeGroupEvent::class, + AssignContentTypeGroupEvent::class ); $parameters = [ @@ -905,7 +905,7 @@ public function testAssignContentTypeGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeAssignContentTypeGroupEventInterface::class, function (BeforeAssignContentTypeGroupEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeAssignContentTypeGroupEvent::class, function (BeforeAssignContentTypeGroupEvent $event) { $event->stopPropagation(); }, 10); @@ -916,19 +916,19 @@ public function testAssignContentTypeGroupStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeAssignContentTypeGroupEventInterface::class, 10], + [BeforeAssignContentTypeGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [AssignContentTypeGroupEventInterface::class, 0], - [BeforeAssignContentTypeGroupEventInterface::class, 0], + [AssignContentTypeGroupEvent::class, 0], + [BeforeAssignContentTypeGroupEvent::class, 0], ]); } public function testUpdateContentTypeDraftEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateContentTypeDraftEventInterface::class, - UpdateContentTypeDraftEventInterface::class + BeforeUpdateContentTypeDraftEvent::class, + UpdateContentTypeDraftEvent::class ); $parameters = [ @@ -944,8 +944,8 @@ public function testUpdateContentTypeDraftEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeUpdateContentTypeDraftEventInterface::class, 0], - [UpdateContentTypeDraftEventInterface::class, 0], + [BeforeUpdateContentTypeDraftEvent::class, 0], + [UpdateContentTypeDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -953,8 +953,8 @@ public function testUpdateContentTypeDraftEvents() public function testUpdateContentTypeDraftStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateContentTypeDraftEventInterface::class, - UpdateContentTypeDraftEventInterface::class + BeforeUpdateContentTypeDraftEvent::class, + UpdateContentTypeDraftEvent::class ); $parameters = [ @@ -964,7 +964,7 @@ public function testUpdateContentTypeDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeUpdateContentTypeDraftEventInterface::class, function (BeforeUpdateContentTypeDraftEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeUpdateContentTypeDraftEvent::class, function (BeforeUpdateContentTypeDraftEvent $event) { $event->stopPropagation(); }, 10); @@ -975,19 +975,19 @@ public function testUpdateContentTypeDraftStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeUpdateContentTypeDraftEventInterface::class, 10], + [BeforeUpdateContentTypeDraftEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateContentTypeDraftEventInterface::class, 0], - [UpdateContentTypeDraftEventInterface::class, 0], + [BeforeUpdateContentTypeDraftEvent::class, 0], + [UpdateContentTypeDraftEvent::class, 0], ]); } public function testDeleteContentTypeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteContentTypeEventInterface::class, - DeleteContentTypeEventInterface::class + BeforeDeleteContentTypeEvent::class, + DeleteContentTypeEvent::class ); $parameters = [ @@ -1002,8 +1002,8 @@ public function testDeleteContentTypeEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteContentTypeEventInterface::class, 0], - [DeleteContentTypeEventInterface::class, 0], + [BeforeDeleteContentTypeEvent::class, 0], + [DeleteContentTypeEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -1011,8 +1011,8 @@ public function testDeleteContentTypeEvents() public function testDeleteContentTypeStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteContentTypeEventInterface::class, - DeleteContentTypeEventInterface::class + BeforeDeleteContentTypeEvent::class, + DeleteContentTypeEvent::class ); $parameters = [ @@ -1021,7 +1021,7 @@ public function testDeleteContentTypeStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteContentTypeEventInterface::class, function (BeforeDeleteContentTypeEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeDeleteContentTypeEvent::class, function (BeforeDeleteContentTypeEvent $event) { $event->stopPropagation(); }, 10); @@ -1032,19 +1032,19 @@ public function testDeleteContentTypeStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteContentTypeEventInterface::class, 10], + [BeforeDeleteContentTypeEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteContentTypeEventInterface::class, 0], - [DeleteContentTypeEventInterface::class, 0], + [BeforeDeleteContentTypeEvent::class, 0], + [DeleteContentTypeEvent::class, 0], ]); } public function testCopyContentTypeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCopyContentTypeEventInterface::class, - CopyContentTypeEventInterface::class + BeforeCopyContentTypeEvent::class, + CopyContentTypeEvent::class ); $parameters = [ @@ -1063,8 +1063,8 @@ public function testCopyContentTypeEvents() $this->assertSame($contentTypeCopy, $result); $this->assertSame($calledListeners, [ - [BeforeCopyContentTypeEventInterface::class, 0], - [CopyContentTypeEventInterface::class, 0], + [BeforeCopyContentTypeEvent::class, 0], + [CopyContentTypeEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -1072,8 +1072,8 @@ public function testCopyContentTypeEvents() public function testReturnCopyContentTypeResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCopyContentTypeEventInterface::class, - CopyContentTypeEventInterface::class + BeforeCopyContentTypeEvent::class, + CopyContentTypeEvent::class ); $parameters = [ @@ -1086,7 +1086,7 @@ public function testReturnCopyContentTypeResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('copyContentType')->willReturn($contentTypeCopy); - $traceableEventDispatcher->addListener(BeforeCopyContentTypeEventInterface::class, function (BeforeCopyContentTypeEventInterface $event) use ($eventContentTypeCopy) { + $traceableEventDispatcher->addListener(BeforeCopyContentTypeEvent::class, function (BeforeCopyContentTypeEvent $event) use ($eventContentTypeCopy) { $event->setContentTypeCopy($eventContentTypeCopy); }, 10); @@ -1097,9 +1097,9 @@ public function testReturnCopyContentTypeResultInBeforeEvents() $this->assertSame($eventContentTypeCopy, $result); $this->assertSame($calledListeners, [ - [BeforeCopyContentTypeEventInterface::class, 10], - [BeforeCopyContentTypeEventInterface::class, 0], - [CopyContentTypeEventInterface::class, 0], + [BeforeCopyContentTypeEvent::class, 10], + [BeforeCopyContentTypeEvent::class, 0], + [CopyContentTypeEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -1107,8 +1107,8 @@ public function testReturnCopyContentTypeResultInBeforeEvents() public function testCopyContentTypeStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCopyContentTypeEventInterface::class, - CopyContentTypeEventInterface::class + BeforeCopyContentTypeEvent::class, + CopyContentTypeEvent::class ); $parameters = [ @@ -1121,7 +1121,7 @@ public function testCopyContentTypeStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('copyContentType')->willReturn($contentTypeCopy); - $traceableEventDispatcher->addListener(BeforeCopyContentTypeEventInterface::class, function (BeforeCopyContentTypeEventInterface $event) use ($eventContentTypeCopy) { + $traceableEventDispatcher->addListener(BeforeCopyContentTypeEvent::class, function (BeforeCopyContentTypeEvent $event) use ($eventContentTypeCopy) { $event->setContentTypeCopy($eventContentTypeCopy); $event->stopPropagation(); }, 10); @@ -1134,11 +1134,11 @@ public function testCopyContentTypeStopPropagationInBeforeEvents() $this->assertSame($eventContentTypeCopy, $result); $this->assertSame($calledListeners, [ - [BeforeCopyContentTypeEventInterface::class, 10], + [BeforeCopyContentTypeEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCopyContentTypeEventInterface::class, 0], - [CopyContentTypeEventInterface::class, 0], + [BeforeCopyContentTypeEvent::class, 0], + [CopyContentTypeEvent::class, 0], ]); } } diff --git a/eZ/Publish/Core/Event/Tests/LanguageServiceTest.php b/eZ/Publish/Core/Event/Tests/LanguageServiceTest.php index 0fc427823df..03cbc7ba3d2 100644 --- a/eZ/Publish/Core/Event/Tests/LanguageServiceTest.php +++ b/eZ/Publish/Core/Event/Tests/LanguageServiceTest.php @@ -6,16 +6,16 @@ */ namespace eZ\Publish\Core\Event\Tests; -use eZ\Publish\API\Repository\Events\Language\BeforeCreateLanguageEvent as BeforeCreateLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\BeforeDeleteLanguageEvent as BeforeDeleteLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\BeforeDisableLanguageEvent as BeforeDisableLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\BeforeEnableLanguageEvent as BeforeEnableLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\BeforeUpdateLanguageNameEvent as BeforeUpdateLanguageNameEventInterface; -use eZ\Publish\API\Repository\Events\Language\CreateLanguageEvent as CreateLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\DeleteLanguageEvent as DeleteLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\DisableLanguageEvent as DisableLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\EnableLanguageEvent as EnableLanguageEventInterface; -use eZ\Publish\API\Repository\Events\Language\UpdateLanguageNameEvent as UpdateLanguageNameEventInterface; +use eZ\Publish\API\Repository\Events\Language\BeforeCreateLanguageEvent; +use eZ\Publish\API\Repository\Events\Language\BeforeDeleteLanguageEvent; +use eZ\Publish\API\Repository\Events\Language\BeforeDisableLanguageEvent; +use eZ\Publish\API\Repository\Events\Language\BeforeEnableLanguageEvent; +use eZ\Publish\API\Repository\Events\Language\BeforeUpdateLanguageNameEvent; +use eZ\Publish\API\Repository\Events\Language\CreateLanguageEvent; +use eZ\Publish\API\Repository\Events\Language\DeleteLanguageEvent; +use eZ\Publish\API\Repository\Events\Language\DisableLanguageEvent; +use eZ\Publish\API\Repository\Events\Language\EnableLanguageEvent; +use eZ\Publish\API\Repository\Events\Language\UpdateLanguageNameEvent; use eZ\Publish\API\Repository\LanguageService as LanguageServiceInterface; use eZ\Publish\API\Repository\Values\Content\Language; use eZ\Publish\API\Repository\Values\Content\LanguageCreateStruct; @@ -26,8 +26,8 @@ class LanguageServiceTest extends AbstractServiceTest public function testDeleteLanguageEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteLanguageEventInterface::class, - DeleteLanguageEventInterface::class + BeforeDeleteLanguageEvent::class, + DeleteLanguageEvent::class ); $parameters = [ @@ -42,8 +42,8 @@ public function testDeleteLanguageEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteLanguageEventInterface::class, 0], - [DeleteLanguageEventInterface::class, 0], + [BeforeDeleteLanguageEvent::class, 0], + [DeleteLanguageEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -51,8 +51,8 @@ public function testDeleteLanguageEvents() public function testDeleteLanguageStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteLanguageEventInterface::class, - DeleteLanguageEventInterface::class + BeforeDeleteLanguageEvent::class, + DeleteLanguageEvent::class ); $parameters = [ @@ -61,7 +61,7 @@ public function testDeleteLanguageStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteLanguageEventInterface::class, function (BeforeDeleteLanguageEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeDeleteLanguageEvent::class, function (BeforeDeleteLanguageEvent $event) { $event->stopPropagation(); }, 10); @@ -72,19 +72,19 @@ public function testDeleteLanguageStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteLanguageEventInterface::class, 10], + [BeforeDeleteLanguageEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteLanguageEventInterface::class, 0], - [DeleteLanguageEventInterface::class, 0], + [BeforeDeleteLanguageEvent::class, 0], + [DeleteLanguageEvent::class, 0], ]); } public function testCreateLanguageEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateLanguageEventInterface::class, - CreateLanguageEventInterface::class + BeforeCreateLanguageEvent::class, + CreateLanguageEvent::class ); $parameters = [ @@ -102,8 +102,8 @@ public function testCreateLanguageEvents() $this->assertSame($language, $result); $this->assertSame($calledListeners, [ - [BeforeCreateLanguageEventInterface::class, 0], - [CreateLanguageEventInterface::class, 0], + [BeforeCreateLanguageEvent::class, 0], + [CreateLanguageEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -111,8 +111,8 @@ public function testCreateLanguageEvents() public function testReturnCreateLanguageResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateLanguageEventInterface::class, - CreateLanguageEventInterface::class + BeforeCreateLanguageEvent::class, + CreateLanguageEvent::class ); $parameters = [ @@ -124,7 +124,7 @@ public function testReturnCreateLanguageResultInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('createLanguage')->willReturn($language); - $traceableEventDispatcher->addListener(BeforeCreateLanguageEventInterface::class, function (BeforeCreateLanguageEventInterface $event) use ($eventLanguage) { + $traceableEventDispatcher->addListener(BeforeCreateLanguageEvent::class, function (BeforeCreateLanguageEvent $event) use ($eventLanguage) { $event->setLanguage($eventLanguage); }, 10); @@ -135,9 +135,9 @@ public function testReturnCreateLanguageResultInBeforeEvents() $this->assertSame($eventLanguage, $result); $this->assertSame($calledListeners, [ - [BeforeCreateLanguageEventInterface::class, 10], - [BeforeCreateLanguageEventInterface::class, 0], - [CreateLanguageEventInterface::class, 0], + [BeforeCreateLanguageEvent::class, 10], + [BeforeCreateLanguageEvent::class, 0], + [CreateLanguageEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -145,8 +145,8 @@ public function testReturnCreateLanguageResultInBeforeEvents() public function testCreateLanguageStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateLanguageEventInterface::class, - CreateLanguageEventInterface::class + BeforeCreateLanguageEvent::class, + CreateLanguageEvent::class ); $parameters = [ @@ -158,7 +158,7 @@ public function testCreateLanguageStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('createLanguage')->willReturn($language); - $traceableEventDispatcher->addListener(BeforeCreateLanguageEventInterface::class, function (BeforeCreateLanguageEventInterface $event) use ($eventLanguage) { + $traceableEventDispatcher->addListener(BeforeCreateLanguageEvent::class, function (BeforeCreateLanguageEvent $event) use ($eventLanguage) { $event->setLanguage($eventLanguage); $event->stopPropagation(); }, 10); @@ -171,19 +171,19 @@ public function testCreateLanguageStopPropagationInBeforeEvents() $this->assertSame($eventLanguage, $result); $this->assertSame($calledListeners, [ - [BeforeCreateLanguageEventInterface::class, 10], + [BeforeCreateLanguageEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateLanguageEventInterface::class, 0], - [CreateLanguageEventInterface::class, 0], + [BeforeCreateLanguageEvent::class, 0], + [CreateLanguageEvent::class, 0], ]); } public function testUpdateLanguageNameEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateLanguageNameEventInterface::class, - UpdateLanguageNameEventInterface::class + BeforeUpdateLanguageNameEvent::class, + UpdateLanguageNameEvent::class ); $parameters = [ @@ -202,8 +202,8 @@ public function testUpdateLanguageNameEvents() $this->assertSame($updatedLanguage, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateLanguageNameEventInterface::class, 0], - [UpdateLanguageNameEventInterface::class, 0], + [BeforeUpdateLanguageNameEvent::class, 0], + [UpdateLanguageNameEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -211,8 +211,8 @@ public function testUpdateLanguageNameEvents() public function testReturnUpdateLanguageNameResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateLanguageNameEventInterface::class, - UpdateLanguageNameEventInterface::class + BeforeUpdateLanguageNameEvent::class, + UpdateLanguageNameEvent::class ); $parameters = [ @@ -225,7 +225,7 @@ public function testReturnUpdateLanguageNameResultInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('updateLanguageName')->willReturn($updatedLanguage); - $traceableEventDispatcher->addListener(BeforeUpdateLanguageNameEventInterface::class, function (BeforeUpdateLanguageNameEventInterface $event) use ($eventUpdatedLanguage) { + $traceableEventDispatcher->addListener(BeforeUpdateLanguageNameEvent::class, function (BeforeUpdateLanguageNameEvent $event) use ($eventUpdatedLanguage) { $event->setUpdatedLanguage($eventUpdatedLanguage); }, 10); @@ -236,9 +236,9 @@ public function testReturnUpdateLanguageNameResultInBeforeEvents() $this->assertSame($eventUpdatedLanguage, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateLanguageNameEventInterface::class, 10], - [BeforeUpdateLanguageNameEventInterface::class, 0], - [UpdateLanguageNameEventInterface::class, 0], + [BeforeUpdateLanguageNameEvent::class, 10], + [BeforeUpdateLanguageNameEvent::class, 0], + [UpdateLanguageNameEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -246,8 +246,8 @@ public function testReturnUpdateLanguageNameResultInBeforeEvents() public function testUpdateLanguageNameStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateLanguageNameEventInterface::class, - UpdateLanguageNameEventInterface::class + BeforeUpdateLanguageNameEvent::class, + UpdateLanguageNameEvent::class ); $parameters = [ @@ -260,7 +260,7 @@ public function testUpdateLanguageNameStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('updateLanguageName')->willReturn($updatedLanguage); - $traceableEventDispatcher->addListener(BeforeUpdateLanguageNameEventInterface::class, function (BeforeUpdateLanguageNameEventInterface $event) use ($eventUpdatedLanguage) { + $traceableEventDispatcher->addListener(BeforeUpdateLanguageNameEvent::class, function (BeforeUpdateLanguageNameEvent $event) use ($eventUpdatedLanguage) { $event->setUpdatedLanguage($eventUpdatedLanguage); $event->stopPropagation(); }, 10); @@ -273,19 +273,19 @@ public function testUpdateLanguageNameStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedLanguage, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateLanguageNameEventInterface::class, 10], + [BeforeUpdateLanguageNameEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateLanguageNameEventInterface::class, 0], - [UpdateLanguageNameEventInterface::class, 0], + [BeforeUpdateLanguageNameEvent::class, 0], + [UpdateLanguageNameEvent::class, 0], ]); } public function testDisableLanguageEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDisableLanguageEventInterface::class, - DisableLanguageEventInterface::class + BeforeDisableLanguageEvent::class, + DisableLanguageEvent::class ); $parameters = [ @@ -303,8 +303,8 @@ public function testDisableLanguageEvents() $this->assertSame($disabledLanguage, $result); $this->assertSame($calledListeners, [ - [BeforeDisableLanguageEventInterface::class, 0], - [DisableLanguageEventInterface::class, 0], + [BeforeDisableLanguageEvent::class, 0], + [DisableLanguageEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -312,8 +312,8 @@ public function testDisableLanguageEvents() public function testReturnDisableLanguageResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDisableLanguageEventInterface::class, - DisableLanguageEventInterface::class + BeforeDisableLanguageEvent::class, + DisableLanguageEvent::class ); $parameters = [ @@ -325,7 +325,7 @@ public function testReturnDisableLanguageResultInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('disableLanguage')->willReturn($disabledLanguage); - $traceableEventDispatcher->addListener(BeforeDisableLanguageEventInterface::class, function (BeforeDisableLanguageEventInterface $event) use ($eventDisabledLanguage) { + $traceableEventDispatcher->addListener(BeforeDisableLanguageEvent::class, function (BeforeDisableLanguageEvent $event) use ($eventDisabledLanguage) { $event->setDisabledLanguage($eventDisabledLanguage); }, 10); @@ -336,9 +336,9 @@ public function testReturnDisableLanguageResultInBeforeEvents() $this->assertSame($eventDisabledLanguage, $result); $this->assertSame($calledListeners, [ - [BeforeDisableLanguageEventInterface::class, 10], - [BeforeDisableLanguageEventInterface::class, 0], - [DisableLanguageEventInterface::class, 0], + [BeforeDisableLanguageEvent::class, 10], + [BeforeDisableLanguageEvent::class, 0], + [DisableLanguageEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -346,8 +346,8 @@ public function testReturnDisableLanguageResultInBeforeEvents() public function testDisableLanguageStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDisableLanguageEventInterface::class, - DisableLanguageEventInterface::class + BeforeDisableLanguageEvent::class, + DisableLanguageEvent::class ); $parameters = [ @@ -359,7 +359,7 @@ public function testDisableLanguageStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('disableLanguage')->willReturn($disabledLanguage); - $traceableEventDispatcher->addListener(BeforeDisableLanguageEventInterface::class, function (BeforeDisableLanguageEventInterface $event) use ($eventDisabledLanguage) { + $traceableEventDispatcher->addListener(BeforeDisableLanguageEvent::class, function (BeforeDisableLanguageEvent $event) use ($eventDisabledLanguage) { $event->setDisabledLanguage($eventDisabledLanguage); $event->stopPropagation(); }, 10); @@ -372,19 +372,19 @@ public function testDisableLanguageStopPropagationInBeforeEvents() $this->assertSame($eventDisabledLanguage, $result); $this->assertSame($calledListeners, [ - [BeforeDisableLanguageEventInterface::class, 10], + [BeforeDisableLanguageEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDisableLanguageEventInterface::class, 0], - [DisableLanguageEventInterface::class, 0], + [BeforeDisableLanguageEvent::class, 0], + [DisableLanguageEvent::class, 0], ]); } public function testEnableLanguageEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeEnableLanguageEventInterface::class, - EnableLanguageEventInterface::class + BeforeEnableLanguageEvent::class, + EnableLanguageEvent::class ); $parameters = [ @@ -402,8 +402,8 @@ public function testEnableLanguageEvents() $this->assertSame($enabledLanguage, $result); $this->assertSame($calledListeners, [ - [BeforeEnableLanguageEventInterface::class, 0], - [EnableLanguageEventInterface::class, 0], + [BeforeEnableLanguageEvent::class, 0], + [EnableLanguageEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -411,8 +411,8 @@ public function testEnableLanguageEvents() public function testReturnEnableLanguageResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeEnableLanguageEventInterface::class, - EnableLanguageEventInterface::class + BeforeEnableLanguageEvent::class, + EnableLanguageEvent::class ); $parameters = [ @@ -424,7 +424,7 @@ public function testReturnEnableLanguageResultInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('enableLanguage')->willReturn($enabledLanguage); - $traceableEventDispatcher->addListener(BeforeEnableLanguageEventInterface::class, function (BeforeEnableLanguageEventInterface $event) use ($eventEnabledLanguage) { + $traceableEventDispatcher->addListener(BeforeEnableLanguageEvent::class, function (BeforeEnableLanguageEvent $event) use ($eventEnabledLanguage) { $event->setEnabledLanguage($eventEnabledLanguage); }, 10); @@ -435,9 +435,9 @@ public function testReturnEnableLanguageResultInBeforeEvents() $this->assertSame($eventEnabledLanguage, $result); $this->assertSame($calledListeners, [ - [BeforeEnableLanguageEventInterface::class, 10], - [BeforeEnableLanguageEventInterface::class, 0], - [EnableLanguageEventInterface::class, 0], + [BeforeEnableLanguageEvent::class, 10], + [BeforeEnableLanguageEvent::class, 0], + [EnableLanguageEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -445,8 +445,8 @@ public function testReturnEnableLanguageResultInBeforeEvents() public function testEnableLanguageStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeEnableLanguageEventInterface::class, - EnableLanguageEventInterface::class + BeforeEnableLanguageEvent::class, + EnableLanguageEvent::class ); $parameters = [ @@ -458,7 +458,7 @@ public function testEnableLanguageStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('enableLanguage')->willReturn($enabledLanguage); - $traceableEventDispatcher->addListener(BeforeEnableLanguageEventInterface::class, function (BeforeEnableLanguageEventInterface $event) use ($eventEnabledLanguage) { + $traceableEventDispatcher->addListener(BeforeEnableLanguageEvent::class, function (BeforeEnableLanguageEvent $event) use ($eventEnabledLanguage) { $event->setEnabledLanguage($eventEnabledLanguage); $event->stopPropagation(); }, 10); @@ -471,11 +471,11 @@ public function testEnableLanguageStopPropagationInBeforeEvents() $this->assertSame($eventEnabledLanguage, $result); $this->assertSame($calledListeners, [ - [BeforeEnableLanguageEventInterface::class, 10], + [BeforeEnableLanguageEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeEnableLanguageEventInterface::class, 0], - [EnableLanguageEventInterface::class, 0], + [BeforeEnableLanguageEvent::class, 0], + [EnableLanguageEvent::class, 0], ]); } } diff --git a/eZ/Publish/Core/Event/Tests/LocationServiceTest.php b/eZ/Publish/Core/Event/Tests/LocationServiceTest.php index 03294286dda..0db249e1d35 100644 --- a/eZ/Publish/Core/Event/Tests/LocationServiceTest.php +++ b/eZ/Publish/Core/Event/Tests/LocationServiceTest.php @@ -6,22 +6,22 @@ */ namespace eZ\Publish\Core\Event\Tests; -use eZ\Publish\API\Repository\Events\Location\BeforeCopySubtreeEvent as BeforeCopySubtreeEventInterface; -use eZ\Publish\API\Repository\Events\Location\BeforeCreateLocationEvent as BeforeCreateLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\BeforeDeleteLocationEvent as BeforeDeleteLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\BeforeHideLocationEvent as BeforeHideLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\BeforeMoveSubtreeEvent as BeforeMoveSubtreeEventInterface; -use eZ\Publish\API\Repository\Events\Location\BeforeSwapLocationEvent as BeforeSwapLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\BeforeUnhideLocationEvent as BeforeUnhideLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\BeforeUpdateLocationEvent as BeforeUpdateLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\CopySubtreeEvent as CopySubtreeEventInterface; -use eZ\Publish\API\Repository\Events\Location\CreateLocationEvent as CreateLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\DeleteLocationEvent as DeleteLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\HideLocationEvent as HideLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\MoveSubtreeEvent as MoveSubtreeEventInterface; -use eZ\Publish\API\Repository\Events\Location\SwapLocationEvent as SwapLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\UnhideLocationEvent as UnhideLocationEventInterface; -use eZ\Publish\API\Repository\Events\Location\UpdateLocationEvent as UpdateLocationEventInterface; +use eZ\Publish\API\Repository\Events\Location\BeforeCopySubtreeEvent; +use eZ\Publish\API\Repository\Events\Location\BeforeCreateLocationEvent; +use eZ\Publish\API\Repository\Events\Location\BeforeDeleteLocationEvent; +use eZ\Publish\API\Repository\Events\Location\BeforeHideLocationEvent; +use eZ\Publish\API\Repository\Events\Location\BeforeMoveSubtreeEvent; +use eZ\Publish\API\Repository\Events\Location\BeforeSwapLocationEvent; +use eZ\Publish\API\Repository\Events\Location\BeforeUnhideLocationEvent; +use eZ\Publish\API\Repository\Events\Location\BeforeUpdateLocationEvent; +use eZ\Publish\API\Repository\Events\Location\CopySubtreeEvent; +use eZ\Publish\API\Repository\Events\Location\CreateLocationEvent; +use eZ\Publish\API\Repository\Events\Location\DeleteLocationEvent; +use eZ\Publish\API\Repository\Events\Location\HideLocationEvent; +use eZ\Publish\API\Repository\Events\Location\MoveSubtreeEvent; +use eZ\Publish\API\Repository\Events\Location\SwapLocationEvent; +use eZ\Publish\API\Repository\Events\Location\UnhideLocationEvent; +use eZ\Publish\API\Repository\Events\Location\UpdateLocationEvent; use eZ\Publish\API\Repository\LocationService as LocationServiceInterface; use eZ\Publish\API\Repository\Values\Content\ContentInfo; use eZ\Publish\API\Repository\Values\Content\Location; @@ -34,8 +34,8 @@ class LocationServiceTest extends AbstractServiceTest public function testCopySubtreeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCopySubtreeEventInterface::class, - CopySubtreeEventInterface::class + BeforeCopySubtreeEvent::class, + CopySubtreeEvent::class ); $parameters = [ @@ -54,8 +54,8 @@ public function testCopySubtreeEvents() $this->assertSame($location, $result); $this->assertSame($calledListeners, [ - [BeforeCopySubtreeEventInterface::class, 0], - [CopySubtreeEventInterface::class, 0], + [BeforeCopySubtreeEvent::class, 0], + [CopySubtreeEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -63,8 +63,8 @@ public function testCopySubtreeEvents() public function testReturnCopySubtreeResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCopySubtreeEventInterface::class, - CopySubtreeEventInterface::class + BeforeCopySubtreeEvent::class, + CopySubtreeEvent::class ); $parameters = [ @@ -77,7 +77,7 @@ public function testReturnCopySubtreeResultInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('copySubtree')->willReturn($location); - $traceableEventDispatcher->addListener(BeforeCopySubtreeEventInterface::class, function (BeforeCopySubtreeEventInterface $event) use ($eventLocation) { + $traceableEventDispatcher->addListener(BeforeCopySubtreeEvent::class, function (BeforeCopySubtreeEvent $event) use ($eventLocation) { $event->setLocation($eventLocation); }, 10); @@ -88,9 +88,9 @@ public function testReturnCopySubtreeResultInBeforeEvents() $this->assertSame($eventLocation, $result); $this->assertSame($calledListeners, [ - [BeforeCopySubtreeEventInterface::class, 10], - [BeforeCopySubtreeEventInterface::class, 0], - [CopySubtreeEventInterface::class, 0], + [BeforeCopySubtreeEvent::class, 10], + [BeforeCopySubtreeEvent::class, 0], + [CopySubtreeEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -98,8 +98,8 @@ public function testReturnCopySubtreeResultInBeforeEvents() public function testCopySubtreeStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCopySubtreeEventInterface::class, - CopySubtreeEventInterface::class + BeforeCopySubtreeEvent::class, + CopySubtreeEvent::class ); $parameters = [ @@ -112,7 +112,7 @@ public function testCopySubtreeStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('copySubtree')->willReturn($location); - $traceableEventDispatcher->addListener(BeforeCopySubtreeEventInterface::class, function (BeforeCopySubtreeEventInterface $event) use ($eventLocation) { + $traceableEventDispatcher->addListener(BeforeCopySubtreeEvent::class, function (BeforeCopySubtreeEvent $event) use ($eventLocation) { $event->setLocation($eventLocation); $event->stopPropagation(); }, 10); @@ -125,19 +125,19 @@ public function testCopySubtreeStopPropagationInBeforeEvents() $this->assertSame($eventLocation, $result); $this->assertSame($calledListeners, [ - [BeforeCopySubtreeEventInterface::class, 10], + [BeforeCopySubtreeEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCopySubtreeEventInterface::class, 0], - [CopySubtreeEventInterface::class, 0], + [BeforeCopySubtreeEvent::class, 0], + [CopySubtreeEvent::class, 0], ]); } public function testDeleteLocationEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteLocationEventInterface::class, - DeleteLocationEventInterface::class + BeforeDeleteLocationEvent::class, + DeleteLocationEvent::class ); $parameters = [ @@ -152,8 +152,8 @@ public function testDeleteLocationEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteLocationEventInterface::class, 0], - [DeleteLocationEventInterface::class, 0], + [BeforeDeleteLocationEvent::class, 0], + [DeleteLocationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -161,8 +161,8 @@ public function testDeleteLocationEvents() public function testDeleteLocationStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteLocationEventInterface::class, - DeleteLocationEventInterface::class + BeforeDeleteLocationEvent::class, + DeleteLocationEvent::class ); $parameters = [ @@ -171,7 +171,7 @@ public function testDeleteLocationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteLocationEventInterface::class, function (BeforeDeleteLocationEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeDeleteLocationEvent::class, function (BeforeDeleteLocationEvent $event) { $event->stopPropagation(); }, 10); @@ -182,19 +182,19 @@ public function testDeleteLocationStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteLocationEventInterface::class, 10], + [BeforeDeleteLocationEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteLocationEventInterface::class, 0], - [DeleteLocationEventInterface::class, 0], + [BeforeDeleteLocationEvent::class, 0], + [DeleteLocationEvent::class, 0], ]); } public function testUnhideLocationEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUnhideLocationEventInterface::class, - UnhideLocationEventInterface::class + BeforeUnhideLocationEvent::class, + UnhideLocationEvent::class ); $parameters = [ @@ -212,8 +212,8 @@ public function testUnhideLocationEvents() $this->assertSame($revealedLocation, $result); $this->assertSame($calledListeners, [ - [BeforeUnhideLocationEventInterface::class, 0], - [UnhideLocationEventInterface::class, 0], + [BeforeUnhideLocationEvent::class, 0], + [UnhideLocationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -221,8 +221,8 @@ public function testUnhideLocationEvents() public function testReturnUnhideLocationResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUnhideLocationEventInterface::class, - UnhideLocationEventInterface::class + BeforeUnhideLocationEvent::class, + UnhideLocationEvent::class ); $parameters = [ @@ -234,7 +234,7 @@ public function testReturnUnhideLocationResultInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('unhideLocation')->willReturn($revealedLocation); - $traceableEventDispatcher->addListener(BeforeUnhideLocationEventInterface::class, function (BeforeUnhideLocationEventInterface $event) use ($eventRevealedLocation) { + $traceableEventDispatcher->addListener(BeforeUnhideLocationEvent::class, function (BeforeUnhideLocationEvent $event) use ($eventRevealedLocation) { $event->setRevealedLocation($eventRevealedLocation); }, 10); @@ -245,9 +245,9 @@ public function testReturnUnhideLocationResultInBeforeEvents() $this->assertSame($eventRevealedLocation, $result); $this->assertSame($calledListeners, [ - [BeforeUnhideLocationEventInterface::class, 10], - [BeforeUnhideLocationEventInterface::class, 0], - [UnhideLocationEventInterface::class, 0], + [BeforeUnhideLocationEvent::class, 10], + [BeforeUnhideLocationEvent::class, 0], + [UnhideLocationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -255,8 +255,8 @@ public function testReturnUnhideLocationResultInBeforeEvents() public function testUnhideLocationStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUnhideLocationEventInterface::class, - UnhideLocationEventInterface::class + BeforeUnhideLocationEvent::class, + UnhideLocationEvent::class ); $parameters = [ @@ -268,7 +268,7 @@ public function testUnhideLocationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('unhideLocation')->willReturn($revealedLocation); - $traceableEventDispatcher->addListener(BeforeUnhideLocationEventInterface::class, function (BeforeUnhideLocationEventInterface $event) use ($eventRevealedLocation) { + $traceableEventDispatcher->addListener(BeforeUnhideLocationEvent::class, function (BeforeUnhideLocationEvent $event) use ($eventRevealedLocation) { $event->setRevealedLocation($eventRevealedLocation); $event->stopPropagation(); }, 10); @@ -281,19 +281,19 @@ public function testUnhideLocationStopPropagationInBeforeEvents() $this->assertSame($eventRevealedLocation, $result); $this->assertSame($calledListeners, [ - [BeforeUnhideLocationEventInterface::class, 10], + [BeforeUnhideLocationEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUnhideLocationEventInterface::class, 0], - [UnhideLocationEventInterface::class, 0], + [BeforeUnhideLocationEvent::class, 0], + [UnhideLocationEvent::class, 0], ]); } public function testHideLocationEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeHideLocationEventInterface::class, - HideLocationEventInterface::class + BeforeHideLocationEvent::class, + HideLocationEvent::class ); $parameters = [ @@ -311,8 +311,8 @@ public function testHideLocationEvents() $this->assertSame($hiddenLocation, $result); $this->assertSame($calledListeners, [ - [BeforeHideLocationEventInterface::class, 0], - [HideLocationEventInterface::class, 0], + [BeforeHideLocationEvent::class, 0], + [HideLocationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -320,8 +320,8 @@ public function testHideLocationEvents() public function testReturnHideLocationResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeHideLocationEventInterface::class, - HideLocationEventInterface::class + BeforeHideLocationEvent::class, + HideLocationEvent::class ); $parameters = [ @@ -333,7 +333,7 @@ public function testReturnHideLocationResultInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('hideLocation')->willReturn($hiddenLocation); - $traceableEventDispatcher->addListener(BeforeHideLocationEventInterface::class, function (BeforeHideLocationEventInterface $event) use ($eventHiddenLocation) { + $traceableEventDispatcher->addListener(BeforeHideLocationEvent::class, function (BeforeHideLocationEvent $event) use ($eventHiddenLocation) { $event->setHiddenLocation($eventHiddenLocation); }, 10); @@ -344,9 +344,9 @@ public function testReturnHideLocationResultInBeforeEvents() $this->assertSame($eventHiddenLocation, $result); $this->assertSame($calledListeners, [ - [BeforeHideLocationEventInterface::class, 10], - [BeforeHideLocationEventInterface::class, 0], - [HideLocationEventInterface::class, 0], + [BeforeHideLocationEvent::class, 10], + [BeforeHideLocationEvent::class, 0], + [HideLocationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -354,8 +354,8 @@ public function testReturnHideLocationResultInBeforeEvents() public function testHideLocationStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeHideLocationEventInterface::class, - HideLocationEventInterface::class + BeforeHideLocationEvent::class, + HideLocationEvent::class ); $parameters = [ @@ -367,7 +367,7 @@ public function testHideLocationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('hideLocation')->willReturn($hiddenLocation); - $traceableEventDispatcher->addListener(BeforeHideLocationEventInterface::class, function (BeforeHideLocationEventInterface $event) use ($eventHiddenLocation) { + $traceableEventDispatcher->addListener(BeforeHideLocationEvent::class, function (BeforeHideLocationEvent $event) use ($eventHiddenLocation) { $event->setHiddenLocation($eventHiddenLocation); $event->stopPropagation(); }, 10); @@ -380,19 +380,19 @@ public function testHideLocationStopPropagationInBeforeEvents() $this->assertSame($eventHiddenLocation, $result); $this->assertSame($calledListeners, [ - [BeforeHideLocationEventInterface::class, 10], + [BeforeHideLocationEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeHideLocationEventInterface::class, 0], - [HideLocationEventInterface::class, 0], + [BeforeHideLocationEvent::class, 0], + [HideLocationEvent::class, 0], ]); } public function testSwapLocationEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeSwapLocationEventInterface::class, - SwapLocationEventInterface::class + BeforeSwapLocationEvent::class, + SwapLocationEvent::class ); $parameters = [ @@ -408,8 +408,8 @@ public function testSwapLocationEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeSwapLocationEventInterface::class, 0], - [SwapLocationEventInterface::class, 0], + [BeforeSwapLocationEvent::class, 0], + [SwapLocationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -417,8 +417,8 @@ public function testSwapLocationEvents() public function testSwapLocationStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeSwapLocationEventInterface::class, - SwapLocationEventInterface::class + BeforeSwapLocationEvent::class, + SwapLocationEvent::class ); $parameters = [ @@ -428,7 +428,7 @@ public function testSwapLocationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeSwapLocationEventInterface::class, function (BeforeSwapLocationEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeSwapLocationEvent::class, function (BeforeSwapLocationEvent $event) { $event->stopPropagation(); }, 10); @@ -439,19 +439,19 @@ public function testSwapLocationStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeSwapLocationEventInterface::class, 10], + [BeforeSwapLocationEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeSwapLocationEventInterface::class, 0], - [SwapLocationEventInterface::class, 0], + [BeforeSwapLocationEvent::class, 0], + [SwapLocationEvent::class, 0], ]); } public function testMoveSubtreeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeMoveSubtreeEventInterface::class, - MoveSubtreeEventInterface::class + BeforeMoveSubtreeEvent::class, + MoveSubtreeEvent::class ); $parameters = [ @@ -467,8 +467,8 @@ public function testMoveSubtreeEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeMoveSubtreeEventInterface::class, 0], - [MoveSubtreeEventInterface::class, 0], + [BeforeMoveSubtreeEvent::class, 0], + [MoveSubtreeEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -476,8 +476,8 @@ public function testMoveSubtreeEvents() public function testMoveSubtreeStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeMoveSubtreeEventInterface::class, - MoveSubtreeEventInterface::class + BeforeMoveSubtreeEvent::class, + MoveSubtreeEvent::class ); $parameters = [ @@ -487,7 +487,7 @@ public function testMoveSubtreeStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeMoveSubtreeEventInterface::class, function (BeforeMoveSubtreeEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeMoveSubtreeEvent::class, function (BeforeMoveSubtreeEvent $event) { $event->stopPropagation(); }, 10); @@ -498,19 +498,19 @@ public function testMoveSubtreeStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeMoveSubtreeEventInterface::class, 10], + [BeforeMoveSubtreeEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeMoveSubtreeEventInterface::class, 0], - [MoveSubtreeEventInterface::class, 0], + [BeforeMoveSubtreeEvent::class, 0], + [MoveSubtreeEvent::class, 0], ]); } public function testUpdateLocationEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateLocationEventInterface::class, - UpdateLocationEventInterface::class + BeforeUpdateLocationEvent::class, + UpdateLocationEvent::class ); $parameters = [ @@ -529,8 +529,8 @@ public function testUpdateLocationEvents() $this->assertSame($updatedLocation, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateLocationEventInterface::class, 0], - [UpdateLocationEventInterface::class, 0], + [BeforeUpdateLocationEvent::class, 0], + [UpdateLocationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -538,8 +538,8 @@ public function testUpdateLocationEvents() public function testReturnUpdateLocationResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateLocationEventInterface::class, - UpdateLocationEventInterface::class + BeforeUpdateLocationEvent::class, + UpdateLocationEvent::class ); $parameters = [ @@ -552,7 +552,7 @@ public function testReturnUpdateLocationResultInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('updateLocation')->willReturn($updatedLocation); - $traceableEventDispatcher->addListener(BeforeUpdateLocationEventInterface::class, function (BeforeUpdateLocationEventInterface $event) use ($eventUpdatedLocation) { + $traceableEventDispatcher->addListener(BeforeUpdateLocationEvent::class, function (BeforeUpdateLocationEvent $event) use ($eventUpdatedLocation) { $event->setUpdatedLocation($eventUpdatedLocation); }, 10); @@ -563,9 +563,9 @@ public function testReturnUpdateLocationResultInBeforeEvents() $this->assertSame($eventUpdatedLocation, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateLocationEventInterface::class, 10], - [BeforeUpdateLocationEventInterface::class, 0], - [UpdateLocationEventInterface::class, 0], + [BeforeUpdateLocationEvent::class, 10], + [BeforeUpdateLocationEvent::class, 0], + [UpdateLocationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -573,8 +573,8 @@ public function testReturnUpdateLocationResultInBeforeEvents() public function testUpdateLocationStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateLocationEventInterface::class, - UpdateLocationEventInterface::class + BeforeUpdateLocationEvent::class, + UpdateLocationEvent::class ); $parameters = [ @@ -587,7 +587,7 @@ public function testUpdateLocationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('updateLocation')->willReturn($updatedLocation); - $traceableEventDispatcher->addListener(BeforeUpdateLocationEventInterface::class, function (BeforeUpdateLocationEventInterface $event) use ($eventUpdatedLocation) { + $traceableEventDispatcher->addListener(BeforeUpdateLocationEvent::class, function (BeforeUpdateLocationEvent $event) use ($eventUpdatedLocation) { $event->setUpdatedLocation($eventUpdatedLocation); $event->stopPropagation(); }, 10); @@ -600,19 +600,19 @@ public function testUpdateLocationStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedLocation, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateLocationEventInterface::class, 10], + [BeforeUpdateLocationEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateLocationEventInterface::class, 0], - [UpdateLocationEventInterface::class, 0], + [BeforeUpdateLocationEvent::class, 0], + [UpdateLocationEvent::class, 0], ]); } public function testCreateLocationEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateLocationEventInterface::class, - CreateLocationEventInterface::class + BeforeCreateLocationEvent::class, + CreateLocationEvent::class ); $parameters = [ @@ -631,8 +631,8 @@ public function testCreateLocationEvents() $this->assertSame($location, $result); $this->assertSame($calledListeners, [ - [BeforeCreateLocationEventInterface::class, 0], - [CreateLocationEventInterface::class, 0], + [BeforeCreateLocationEvent::class, 0], + [CreateLocationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -640,8 +640,8 @@ public function testCreateLocationEvents() public function testReturnCreateLocationResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateLocationEventInterface::class, - CreateLocationEventInterface::class + BeforeCreateLocationEvent::class, + CreateLocationEvent::class ); $parameters = [ @@ -654,7 +654,7 @@ public function testReturnCreateLocationResultInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('createLocation')->willReturn($location); - $traceableEventDispatcher->addListener(BeforeCreateLocationEventInterface::class, function (BeforeCreateLocationEventInterface $event) use ($eventLocation) { + $traceableEventDispatcher->addListener(BeforeCreateLocationEvent::class, function (BeforeCreateLocationEvent $event) use ($eventLocation) { $event->setLocation($eventLocation); }, 10); @@ -665,9 +665,9 @@ public function testReturnCreateLocationResultInBeforeEvents() $this->assertSame($eventLocation, $result); $this->assertSame($calledListeners, [ - [BeforeCreateLocationEventInterface::class, 10], - [BeforeCreateLocationEventInterface::class, 0], - [CreateLocationEventInterface::class, 0], + [BeforeCreateLocationEvent::class, 10], + [BeforeCreateLocationEvent::class, 0], + [CreateLocationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -675,8 +675,8 @@ public function testReturnCreateLocationResultInBeforeEvents() public function testCreateLocationStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateLocationEventInterface::class, - CreateLocationEventInterface::class + BeforeCreateLocationEvent::class, + CreateLocationEvent::class ); $parameters = [ @@ -689,7 +689,7 @@ public function testCreateLocationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('createLocation')->willReturn($location); - $traceableEventDispatcher->addListener(BeforeCreateLocationEventInterface::class, function (BeforeCreateLocationEventInterface $event) use ($eventLocation) { + $traceableEventDispatcher->addListener(BeforeCreateLocationEvent::class, function (BeforeCreateLocationEvent $event) use ($eventLocation) { $event->setLocation($eventLocation); $event->stopPropagation(); }, 10); @@ -702,11 +702,11 @@ public function testCreateLocationStopPropagationInBeforeEvents() $this->assertSame($eventLocation, $result); $this->assertSame($calledListeners, [ - [BeforeCreateLocationEventInterface::class, 10], + [BeforeCreateLocationEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateLocationEventInterface::class, 0], - [CreateLocationEventInterface::class, 0], + [BeforeCreateLocationEvent::class, 0], + [CreateLocationEvent::class, 0], ]); } } diff --git a/eZ/Publish/Core/Event/Tests/NotificationServiceTest.php b/eZ/Publish/Core/Event/Tests/NotificationServiceTest.php index d716d309cfa..809cc983de9 100644 --- a/eZ/Publish/Core/Event/Tests/NotificationServiceTest.php +++ b/eZ/Publish/Core/Event/Tests/NotificationServiceTest.php @@ -6,12 +6,12 @@ */ namespace eZ\Publish\Core\Event\Tests; -use eZ\Publish\API\Repository\Events\Notification\BeforeCreateNotificationEvent as BeforeCreateNotificationEventInterface; -use eZ\Publish\API\Repository\Events\Notification\BeforeDeleteNotificationEvent as BeforeDeleteNotificationEventInterface; -use eZ\Publish\API\Repository\Events\Notification\BeforeMarkNotificationAsReadEvent as BeforeMarkNotificationAsReadEventInterface; -use eZ\Publish\API\Repository\Events\Notification\CreateNotificationEvent as CreateNotificationEventInterface; -use eZ\Publish\API\Repository\Events\Notification\DeleteNotificationEvent as DeleteNotificationEventInterface; -use eZ\Publish\API\Repository\Events\Notification\MarkNotificationAsReadEvent as MarkNotificationAsReadEventInterface; +use eZ\Publish\API\Repository\Events\Notification\BeforeCreateNotificationEvent; +use eZ\Publish\API\Repository\Events\Notification\BeforeDeleteNotificationEvent; +use eZ\Publish\API\Repository\Events\Notification\BeforeMarkNotificationAsReadEvent; +use eZ\Publish\API\Repository\Events\Notification\CreateNotificationEvent; +use eZ\Publish\API\Repository\Events\Notification\DeleteNotificationEvent; +use eZ\Publish\API\Repository\Events\Notification\MarkNotificationAsReadEvent; use eZ\Publish\API\Repository\NotificationService as NotificationServiceInterface; use eZ\Publish\API\Repository\Values\Notification\CreateStruct; use eZ\Publish\API\Repository\Values\Notification\Notification; @@ -22,8 +22,8 @@ class NotificationServiceTest extends AbstractServiceTest public function testCreateNotificationEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateNotificationEventInterface::class, - CreateNotificationEventInterface::class + BeforeCreateNotificationEvent::class, + CreateNotificationEvent::class ); $parameters = [ @@ -41,8 +41,8 @@ public function testCreateNotificationEvents() $this->assertSame($notification, $result); $this->assertSame($calledListeners, [ - [BeforeCreateNotificationEventInterface::class, 0], - [CreateNotificationEventInterface::class, 0], + [BeforeCreateNotificationEvent::class, 0], + [CreateNotificationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -50,8 +50,8 @@ public function testCreateNotificationEvents() public function testReturnCreateNotificationResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateNotificationEventInterface::class, - CreateNotificationEventInterface::class + BeforeCreateNotificationEvent::class, + CreateNotificationEvent::class ); $parameters = [ @@ -63,7 +63,7 @@ public function testReturnCreateNotificationResultInBeforeEvents() $innerServiceMock = $this->createMock(NotificationServiceInterface::class); $innerServiceMock->method('createNotification')->willReturn($notification); - $traceableEventDispatcher->addListener(BeforeCreateNotificationEventInterface::class, function (BeforeCreateNotificationEventInterface $event) use ($eventNotification) { + $traceableEventDispatcher->addListener(BeforeCreateNotificationEvent::class, function (BeforeCreateNotificationEvent $event) use ($eventNotification) { $event->setNotification($eventNotification); }, 10); @@ -74,9 +74,9 @@ public function testReturnCreateNotificationResultInBeforeEvents() $this->assertSame($eventNotification, $result); $this->assertSame($calledListeners, [ - [BeforeCreateNotificationEventInterface::class, 10], - [BeforeCreateNotificationEventInterface::class, 0], - [CreateNotificationEventInterface::class, 0], + [BeforeCreateNotificationEvent::class, 10], + [BeforeCreateNotificationEvent::class, 0], + [CreateNotificationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -84,8 +84,8 @@ public function testReturnCreateNotificationResultInBeforeEvents() public function testCreateNotificationStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateNotificationEventInterface::class, - CreateNotificationEventInterface::class + BeforeCreateNotificationEvent::class, + CreateNotificationEvent::class ); $parameters = [ @@ -97,7 +97,7 @@ public function testCreateNotificationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(NotificationServiceInterface::class); $innerServiceMock->method('createNotification')->willReturn($notification); - $traceableEventDispatcher->addListener(BeforeCreateNotificationEventInterface::class, function (BeforeCreateNotificationEventInterface $event) use ($eventNotification) { + $traceableEventDispatcher->addListener(BeforeCreateNotificationEvent::class, function (BeforeCreateNotificationEvent $event) use ($eventNotification) { $event->setNotification($eventNotification); $event->stopPropagation(); }, 10); @@ -110,19 +110,19 @@ public function testCreateNotificationStopPropagationInBeforeEvents() $this->assertSame($eventNotification, $result); $this->assertSame($calledListeners, [ - [BeforeCreateNotificationEventInterface::class, 10], + [BeforeCreateNotificationEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateNotificationEventInterface::class, 0], - [CreateNotificationEventInterface::class, 0], + [BeforeCreateNotificationEvent::class, 0], + [CreateNotificationEvent::class, 0], ]); } public function testDeleteNotificationEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteNotificationEventInterface::class, - DeleteNotificationEventInterface::class + BeforeDeleteNotificationEvent::class, + DeleteNotificationEvent::class ); $parameters = [ @@ -137,8 +137,8 @@ public function testDeleteNotificationEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteNotificationEventInterface::class, 0], - [DeleteNotificationEventInterface::class, 0], + [BeforeDeleteNotificationEvent::class, 0], + [DeleteNotificationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -146,8 +146,8 @@ public function testDeleteNotificationEvents() public function testDeleteNotificationStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteNotificationEventInterface::class, - DeleteNotificationEventInterface::class + BeforeDeleteNotificationEvent::class, + DeleteNotificationEvent::class ); $parameters = [ @@ -156,7 +156,7 @@ public function testDeleteNotificationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(NotificationServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteNotificationEventInterface::class, function (BeforeDeleteNotificationEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeDeleteNotificationEvent::class, function (BeforeDeleteNotificationEvent $event) { $event->stopPropagation(); }, 10); @@ -167,19 +167,19 @@ public function testDeleteNotificationStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteNotificationEventInterface::class, 10], + [BeforeDeleteNotificationEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteNotificationEventInterface::class, 0], - [DeleteNotificationEventInterface::class, 0], + [BeforeDeleteNotificationEvent::class, 0], + [DeleteNotificationEvent::class, 0], ]); } public function testMarkNotificationAsReadEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeMarkNotificationAsReadEventInterface::class, - MarkNotificationAsReadEventInterface::class + BeforeMarkNotificationAsReadEvent::class, + MarkNotificationAsReadEvent::class ); $parameters = [ @@ -194,8 +194,8 @@ public function testMarkNotificationAsReadEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeMarkNotificationAsReadEventInterface::class, 0], - [MarkNotificationAsReadEventInterface::class, 0], + [BeforeMarkNotificationAsReadEvent::class, 0], + [MarkNotificationAsReadEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -203,8 +203,8 @@ public function testMarkNotificationAsReadEvents() public function testMarkNotificationAsReadStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeMarkNotificationAsReadEventInterface::class, - MarkNotificationAsReadEventInterface::class + BeforeMarkNotificationAsReadEvent::class, + MarkNotificationAsReadEvent::class ); $parameters = [ @@ -213,7 +213,7 @@ public function testMarkNotificationAsReadStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(NotificationServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeMarkNotificationAsReadEventInterface::class, function (BeforeMarkNotificationAsReadEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeMarkNotificationAsReadEvent::class, function (BeforeMarkNotificationAsReadEvent $event) { $event->stopPropagation(); }, 10); @@ -224,11 +224,11 @@ public function testMarkNotificationAsReadStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeMarkNotificationAsReadEventInterface::class, 10], + [BeforeMarkNotificationAsReadEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeMarkNotificationAsReadEventInterface::class, 0], - [MarkNotificationAsReadEventInterface::class, 0], + [BeforeMarkNotificationAsReadEvent::class, 0], + [MarkNotificationAsReadEvent::class, 0], ]); } } diff --git a/eZ/Publish/Core/Event/Tests/ObjectStateServiceTest.php b/eZ/Publish/Core/Event/Tests/ObjectStateServiceTest.php index 879a29ef9d0..e1a4796d3c9 100644 --- a/eZ/Publish/Core/Event/Tests/ObjectStateServiceTest.php +++ b/eZ/Publish/Core/Event/Tests/ObjectStateServiceTest.php @@ -6,22 +6,22 @@ */ namespace eZ\Publish\Core\Event\Tests; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeCreateObjectStateEvent as BeforeCreateObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeCreateObjectStateGroupEvent as BeforeCreateObjectStateGroupEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeDeleteObjectStateEvent as BeforeDeleteObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeDeleteObjectStateGroupEvent as BeforeDeleteObjectStateGroupEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeSetContentStateEvent as BeforeSetContentStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeSetPriorityOfObjectStateEvent as BeforeSetPriorityOfObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeUpdateObjectStateEvent as BeforeUpdateObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\BeforeUpdateObjectStateGroupEvent as BeforeUpdateObjectStateGroupEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\CreateObjectStateEvent as CreateObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\CreateObjectStateGroupEvent as CreateObjectStateGroupEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\DeleteObjectStateEvent as DeleteObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\DeleteObjectStateGroupEvent as DeleteObjectStateGroupEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\SetContentStateEvent as SetContentStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\SetPriorityOfObjectStateEvent as SetPriorityOfObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\UpdateObjectStateEvent as UpdateObjectStateEventInterface; -use eZ\Publish\API\Repository\Events\ObjectState\UpdateObjectStateGroupEvent as UpdateObjectStateGroupEventInterface; +use eZ\Publish\API\Repository\Events\ObjectState\BeforeCreateObjectStateEvent; +use eZ\Publish\API\Repository\Events\ObjectState\BeforeCreateObjectStateGroupEvent; +use eZ\Publish\API\Repository\Events\ObjectState\BeforeDeleteObjectStateEvent; +use eZ\Publish\API\Repository\Events\ObjectState\BeforeDeleteObjectStateGroupEvent; +use eZ\Publish\API\Repository\Events\ObjectState\BeforeSetContentStateEvent; +use eZ\Publish\API\Repository\Events\ObjectState\BeforeSetPriorityOfObjectStateEvent; +use eZ\Publish\API\Repository\Events\ObjectState\BeforeUpdateObjectStateEvent; +use eZ\Publish\API\Repository\Events\ObjectState\BeforeUpdateObjectStateGroupEvent; +use eZ\Publish\API\Repository\Events\ObjectState\CreateObjectStateEvent; +use eZ\Publish\API\Repository\Events\ObjectState\CreateObjectStateGroupEvent; +use eZ\Publish\API\Repository\Events\ObjectState\DeleteObjectStateEvent; +use eZ\Publish\API\Repository\Events\ObjectState\DeleteObjectStateGroupEvent; +use eZ\Publish\API\Repository\Events\ObjectState\SetContentStateEvent; +use eZ\Publish\API\Repository\Events\ObjectState\SetPriorityOfObjectStateEvent; +use eZ\Publish\API\Repository\Events\ObjectState\UpdateObjectStateEvent; +use eZ\Publish\API\Repository\Events\ObjectState\UpdateObjectStateGroupEvent; use eZ\Publish\API\Repository\ObjectStateService as ObjectStateServiceInterface; use eZ\Publish\API\Repository\Values\Content\ContentInfo; use eZ\Publish\API\Repository\Values\ObjectState\ObjectState; @@ -37,8 +37,8 @@ class ObjectStateServiceTest extends AbstractServiceTest public function testSetContentStateEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeSetContentStateEventInterface::class, - SetContentStateEventInterface::class + BeforeSetContentStateEvent::class, + SetContentStateEvent::class ); $parameters = [ @@ -55,8 +55,8 @@ public function testSetContentStateEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeSetContentStateEventInterface::class, 0], - [SetContentStateEventInterface::class, 0], + [BeforeSetContentStateEvent::class, 0], + [SetContentStateEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -64,8 +64,8 @@ public function testSetContentStateEvents() public function testSetContentStateStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeSetContentStateEventInterface::class, - SetContentStateEventInterface::class + BeforeSetContentStateEvent::class, + SetContentStateEvent::class ); $parameters = [ @@ -76,7 +76,7 @@ public function testSetContentStateStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeSetContentStateEventInterface::class, function (BeforeSetContentStateEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeSetContentStateEvent::class, function (BeforeSetContentStateEvent $event) { $event->stopPropagation(); }, 10); @@ -87,19 +87,19 @@ public function testSetContentStateStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeSetContentStateEventInterface::class, 10], + [BeforeSetContentStateEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeSetContentStateEventInterface::class, 0], - [SetContentStateEventInterface::class, 0], + [BeforeSetContentStateEvent::class, 0], + [SetContentStateEvent::class, 0], ]); } public function testCreateObjectStateGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateObjectStateGroupEventInterface::class, - CreateObjectStateGroupEventInterface::class + BeforeCreateObjectStateGroupEvent::class, + CreateObjectStateGroupEvent::class ); $parameters = [ @@ -117,8 +117,8 @@ public function testCreateObjectStateGroupEvents() $this->assertSame($objectStateGroup, $result); $this->assertSame($calledListeners, [ - [BeforeCreateObjectStateGroupEventInterface::class, 0], - [CreateObjectStateGroupEventInterface::class, 0], + [BeforeCreateObjectStateGroupEvent::class, 0], + [CreateObjectStateGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -126,8 +126,8 @@ public function testCreateObjectStateGroupEvents() public function testReturnCreateObjectStateGroupResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateObjectStateGroupEventInterface::class, - CreateObjectStateGroupEventInterface::class + BeforeCreateObjectStateGroupEvent::class, + CreateObjectStateGroupEvent::class ); $parameters = [ @@ -139,7 +139,7 @@ public function testReturnCreateObjectStateGroupResultInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('createObjectStateGroup')->willReturn($objectStateGroup); - $traceableEventDispatcher->addListener(BeforeCreateObjectStateGroupEventInterface::class, function (BeforeCreateObjectStateGroupEventInterface $event) use ($eventObjectStateGroup) { + $traceableEventDispatcher->addListener(BeforeCreateObjectStateGroupEvent::class, function (BeforeCreateObjectStateGroupEvent $event) use ($eventObjectStateGroup) { $event->setObjectStateGroup($eventObjectStateGroup); }, 10); @@ -150,9 +150,9 @@ public function testReturnCreateObjectStateGroupResultInBeforeEvents() $this->assertSame($eventObjectStateGroup, $result); $this->assertSame($calledListeners, [ - [BeforeCreateObjectStateGroupEventInterface::class, 10], - [BeforeCreateObjectStateGroupEventInterface::class, 0], - [CreateObjectStateGroupEventInterface::class, 0], + [BeforeCreateObjectStateGroupEvent::class, 10], + [BeforeCreateObjectStateGroupEvent::class, 0], + [CreateObjectStateGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -160,8 +160,8 @@ public function testReturnCreateObjectStateGroupResultInBeforeEvents() public function testCreateObjectStateGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateObjectStateGroupEventInterface::class, - CreateObjectStateGroupEventInterface::class + BeforeCreateObjectStateGroupEvent::class, + CreateObjectStateGroupEvent::class ); $parameters = [ @@ -173,7 +173,7 @@ public function testCreateObjectStateGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('createObjectStateGroup')->willReturn($objectStateGroup); - $traceableEventDispatcher->addListener(BeforeCreateObjectStateGroupEventInterface::class, function (BeforeCreateObjectStateGroupEventInterface $event) use ($eventObjectStateGroup) { + $traceableEventDispatcher->addListener(BeforeCreateObjectStateGroupEvent::class, function (BeforeCreateObjectStateGroupEvent $event) use ($eventObjectStateGroup) { $event->setObjectStateGroup($eventObjectStateGroup); $event->stopPropagation(); }, 10); @@ -186,19 +186,19 @@ public function testCreateObjectStateGroupStopPropagationInBeforeEvents() $this->assertSame($eventObjectStateGroup, $result); $this->assertSame($calledListeners, [ - [BeforeCreateObjectStateGroupEventInterface::class, 10], + [BeforeCreateObjectStateGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateObjectStateGroupEventInterface::class, 0], - [CreateObjectStateGroupEventInterface::class, 0], + [BeforeCreateObjectStateGroupEvent::class, 0], + [CreateObjectStateGroupEvent::class, 0], ]); } public function testUpdateObjectStateEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateObjectStateEventInterface::class, - UpdateObjectStateEventInterface::class + BeforeUpdateObjectStateEvent::class, + UpdateObjectStateEvent::class ); $parameters = [ @@ -217,8 +217,8 @@ public function testUpdateObjectStateEvents() $this->assertSame($updatedObjectState, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateObjectStateEventInterface::class, 0], - [UpdateObjectStateEventInterface::class, 0], + [BeforeUpdateObjectStateEvent::class, 0], + [UpdateObjectStateEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -226,8 +226,8 @@ public function testUpdateObjectStateEvents() public function testReturnUpdateObjectStateResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateObjectStateEventInterface::class, - UpdateObjectStateEventInterface::class + BeforeUpdateObjectStateEvent::class, + UpdateObjectStateEvent::class ); $parameters = [ @@ -240,7 +240,7 @@ public function testReturnUpdateObjectStateResultInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('updateObjectState')->willReturn($updatedObjectState); - $traceableEventDispatcher->addListener(BeforeUpdateObjectStateEventInterface::class, function (BeforeUpdateObjectStateEventInterface $event) use ($eventUpdatedObjectState) { + $traceableEventDispatcher->addListener(BeforeUpdateObjectStateEvent::class, function (BeforeUpdateObjectStateEvent $event) use ($eventUpdatedObjectState) { $event->setUpdatedObjectState($eventUpdatedObjectState); }, 10); @@ -251,9 +251,9 @@ public function testReturnUpdateObjectStateResultInBeforeEvents() $this->assertSame($eventUpdatedObjectState, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateObjectStateEventInterface::class, 10], - [BeforeUpdateObjectStateEventInterface::class, 0], - [UpdateObjectStateEventInterface::class, 0], + [BeforeUpdateObjectStateEvent::class, 10], + [BeforeUpdateObjectStateEvent::class, 0], + [UpdateObjectStateEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -261,8 +261,8 @@ public function testReturnUpdateObjectStateResultInBeforeEvents() public function testUpdateObjectStateStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateObjectStateEventInterface::class, - UpdateObjectStateEventInterface::class + BeforeUpdateObjectStateEvent::class, + UpdateObjectStateEvent::class ); $parameters = [ @@ -275,7 +275,7 @@ public function testUpdateObjectStateStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('updateObjectState')->willReturn($updatedObjectState); - $traceableEventDispatcher->addListener(BeforeUpdateObjectStateEventInterface::class, function (BeforeUpdateObjectStateEventInterface $event) use ($eventUpdatedObjectState) { + $traceableEventDispatcher->addListener(BeforeUpdateObjectStateEvent::class, function (BeforeUpdateObjectStateEvent $event) use ($eventUpdatedObjectState) { $event->setUpdatedObjectState($eventUpdatedObjectState); $event->stopPropagation(); }, 10); @@ -288,19 +288,19 @@ public function testUpdateObjectStateStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedObjectState, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateObjectStateEventInterface::class, 10], + [BeforeUpdateObjectStateEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateObjectStateEventInterface::class, 0], - [UpdateObjectStateEventInterface::class, 0], + [BeforeUpdateObjectStateEvent::class, 0], + [UpdateObjectStateEvent::class, 0], ]); } public function testCreateObjectStateEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateObjectStateEventInterface::class, - CreateObjectStateEventInterface::class + BeforeCreateObjectStateEvent::class, + CreateObjectStateEvent::class ); $parameters = [ @@ -319,8 +319,8 @@ public function testCreateObjectStateEvents() $this->assertSame($objectState, $result); $this->assertSame($calledListeners, [ - [BeforeCreateObjectStateEventInterface::class, 0], - [CreateObjectStateEventInterface::class, 0], + [BeforeCreateObjectStateEvent::class, 0], + [CreateObjectStateEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -328,8 +328,8 @@ public function testCreateObjectStateEvents() public function testReturnCreateObjectStateResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateObjectStateEventInterface::class, - CreateObjectStateEventInterface::class + BeforeCreateObjectStateEvent::class, + CreateObjectStateEvent::class ); $parameters = [ @@ -342,7 +342,7 @@ public function testReturnCreateObjectStateResultInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('createObjectState')->willReturn($objectState); - $traceableEventDispatcher->addListener(BeforeCreateObjectStateEventInterface::class, function (BeforeCreateObjectStateEventInterface $event) use ($eventObjectState) { + $traceableEventDispatcher->addListener(BeforeCreateObjectStateEvent::class, function (BeforeCreateObjectStateEvent $event) use ($eventObjectState) { $event->setObjectState($eventObjectState); }, 10); @@ -353,9 +353,9 @@ public function testReturnCreateObjectStateResultInBeforeEvents() $this->assertSame($eventObjectState, $result); $this->assertSame($calledListeners, [ - [BeforeCreateObjectStateEventInterface::class, 10], - [BeforeCreateObjectStateEventInterface::class, 0], - [CreateObjectStateEventInterface::class, 0], + [BeforeCreateObjectStateEvent::class, 10], + [BeforeCreateObjectStateEvent::class, 0], + [CreateObjectStateEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -363,8 +363,8 @@ public function testReturnCreateObjectStateResultInBeforeEvents() public function testCreateObjectStateStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateObjectStateEventInterface::class, - CreateObjectStateEventInterface::class + BeforeCreateObjectStateEvent::class, + CreateObjectStateEvent::class ); $parameters = [ @@ -377,7 +377,7 @@ public function testCreateObjectStateStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('createObjectState')->willReturn($objectState); - $traceableEventDispatcher->addListener(BeforeCreateObjectStateEventInterface::class, function (BeforeCreateObjectStateEventInterface $event) use ($eventObjectState) { + $traceableEventDispatcher->addListener(BeforeCreateObjectStateEvent::class, function (BeforeCreateObjectStateEvent $event) use ($eventObjectState) { $event->setObjectState($eventObjectState); $event->stopPropagation(); }, 10); @@ -390,19 +390,19 @@ public function testCreateObjectStateStopPropagationInBeforeEvents() $this->assertSame($eventObjectState, $result); $this->assertSame($calledListeners, [ - [BeforeCreateObjectStateEventInterface::class, 10], + [BeforeCreateObjectStateEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateObjectStateEventInterface::class, 0], - [CreateObjectStateEventInterface::class, 0], + [BeforeCreateObjectStateEvent::class, 0], + [CreateObjectStateEvent::class, 0], ]); } public function testUpdateObjectStateGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateObjectStateGroupEventInterface::class, - UpdateObjectStateGroupEventInterface::class + BeforeUpdateObjectStateGroupEvent::class, + UpdateObjectStateGroupEvent::class ); $parameters = [ @@ -421,8 +421,8 @@ public function testUpdateObjectStateGroupEvents() $this->assertSame($updatedObjectStateGroup, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateObjectStateGroupEventInterface::class, 0], - [UpdateObjectStateGroupEventInterface::class, 0], + [BeforeUpdateObjectStateGroupEvent::class, 0], + [UpdateObjectStateGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -430,8 +430,8 @@ public function testUpdateObjectStateGroupEvents() public function testReturnUpdateObjectStateGroupResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateObjectStateGroupEventInterface::class, - UpdateObjectStateGroupEventInterface::class + BeforeUpdateObjectStateGroupEvent::class, + UpdateObjectStateGroupEvent::class ); $parameters = [ @@ -444,7 +444,7 @@ public function testReturnUpdateObjectStateGroupResultInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('updateObjectStateGroup')->willReturn($updatedObjectStateGroup); - $traceableEventDispatcher->addListener(BeforeUpdateObjectStateGroupEventInterface::class, function (BeforeUpdateObjectStateGroupEventInterface $event) use ($eventUpdatedObjectStateGroup) { + $traceableEventDispatcher->addListener(BeforeUpdateObjectStateGroupEvent::class, function (BeforeUpdateObjectStateGroupEvent $event) use ($eventUpdatedObjectStateGroup) { $event->setUpdatedObjectStateGroup($eventUpdatedObjectStateGroup); }, 10); @@ -455,9 +455,9 @@ public function testReturnUpdateObjectStateGroupResultInBeforeEvents() $this->assertSame($eventUpdatedObjectStateGroup, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateObjectStateGroupEventInterface::class, 10], - [BeforeUpdateObjectStateGroupEventInterface::class, 0], - [UpdateObjectStateGroupEventInterface::class, 0], + [BeforeUpdateObjectStateGroupEvent::class, 10], + [BeforeUpdateObjectStateGroupEvent::class, 0], + [UpdateObjectStateGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -465,8 +465,8 @@ public function testReturnUpdateObjectStateGroupResultInBeforeEvents() public function testUpdateObjectStateGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateObjectStateGroupEventInterface::class, - UpdateObjectStateGroupEventInterface::class + BeforeUpdateObjectStateGroupEvent::class, + UpdateObjectStateGroupEvent::class ); $parameters = [ @@ -479,7 +479,7 @@ public function testUpdateObjectStateGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('updateObjectStateGroup')->willReturn($updatedObjectStateGroup); - $traceableEventDispatcher->addListener(BeforeUpdateObjectStateGroupEventInterface::class, function (BeforeUpdateObjectStateGroupEventInterface $event) use ($eventUpdatedObjectStateGroup) { + $traceableEventDispatcher->addListener(BeforeUpdateObjectStateGroupEvent::class, function (BeforeUpdateObjectStateGroupEvent $event) use ($eventUpdatedObjectStateGroup) { $event->setUpdatedObjectStateGroup($eventUpdatedObjectStateGroup); $event->stopPropagation(); }, 10); @@ -492,19 +492,19 @@ public function testUpdateObjectStateGroupStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedObjectStateGroup, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateObjectStateGroupEventInterface::class, 10], + [BeforeUpdateObjectStateGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateObjectStateGroupEventInterface::class, 0], - [UpdateObjectStateGroupEventInterface::class, 0], + [BeforeUpdateObjectStateGroupEvent::class, 0], + [UpdateObjectStateGroupEvent::class, 0], ]); } public function testSetPriorityOfObjectStateEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeSetPriorityOfObjectStateEventInterface::class, - SetPriorityOfObjectStateEventInterface::class + BeforeSetPriorityOfObjectStateEvent::class, + SetPriorityOfObjectStateEvent::class ); $parameters = [ @@ -520,8 +520,8 @@ public function testSetPriorityOfObjectStateEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeSetPriorityOfObjectStateEventInterface::class, 0], - [SetPriorityOfObjectStateEventInterface::class, 0], + [BeforeSetPriorityOfObjectStateEvent::class, 0], + [SetPriorityOfObjectStateEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -529,8 +529,8 @@ public function testSetPriorityOfObjectStateEvents() public function testSetPriorityOfObjectStateStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeSetPriorityOfObjectStateEventInterface::class, - SetPriorityOfObjectStateEventInterface::class + BeforeSetPriorityOfObjectStateEvent::class, + SetPriorityOfObjectStateEvent::class ); $parameters = [ @@ -540,7 +540,7 @@ public function testSetPriorityOfObjectStateStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeSetPriorityOfObjectStateEventInterface::class, function (BeforeSetPriorityOfObjectStateEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeSetPriorityOfObjectStateEvent::class, function (BeforeSetPriorityOfObjectStateEvent $event) { $event->stopPropagation(); }, 10); @@ -551,19 +551,19 @@ public function testSetPriorityOfObjectStateStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeSetPriorityOfObjectStateEventInterface::class, 10], + [BeforeSetPriorityOfObjectStateEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeSetPriorityOfObjectStateEventInterface::class, 0], - [SetPriorityOfObjectStateEventInterface::class, 0], + [BeforeSetPriorityOfObjectStateEvent::class, 0], + [SetPriorityOfObjectStateEvent::class, 0], ]); } public function testDeleteObjectStateGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteObjectStateGroupEventInterface::class, - DeleteObjectStateGroupEventInterface::class + BeforeDeleteObjectStateGroupEvent::class, + DeleteObjectStateGroupEvent::class ); $parameters = [ @@ -578,8 +578,8 @@ public function testDeleteObjectStateGroupEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteObjectStateGroupEventInterface::class, 0], - [DeleteObjectStateGroupEventInterface::class, 0], + [BeforeDeleteObjectStateGroupEvent::class, 0], + [DeleteObjectStateGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -587,8 +587,8 @@ public function testDeleteObjectStateGroupEvents() public function testDeleteObjectStateGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteObjectStateGroupEventInterface::class, - DeleteObjectStateGroupEventInterface::class + BeforeDeleteObjectStateGroupEvent::class, + DeleteObjectStateGroupEvent::class ); $parameters = [ @@ -597,7 +597,7 @@ public function testDeleteObjectStateGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteObjectStateGroupEventInterface::class, function (BeforeDeleteObjectStateGroupEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeDeleteObjectStateGroupEvent::class, function (BeforeDeleteObjectStateGroupEvent $event) { $event->stopPropagation(); }, 10); @@ -608,19 +608,19 @@ public function testDeleteObjectStateGroupStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteObjectStateGroupEventInterface::class, 10], + [BeforeDeleteObjectStateGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteObjectStateGroupEventInterface::class, 0], - [DeleteObjectStateGroupEventInterface::class, 0], + [BeforeDeleteObjectStateGroupEvent::class, 0], + [DeleteObjectStateGroupEvent::class, 0], ]); } public function testDeleteObjectStateEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteObjectStateEventInterface::class, - DeleteObjectStateEventInterface::class + BeforeDeleteObjectStateEvent::class, + DeleteObjectStateEvent::class ); $parameters = [ @@ -635,8 +635,8 @@ public function testDeleteObjectStateEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteObjectStateEventInterface::class, 0], - [DeleteObjectStateEventInterface::class, 0], + [BeforeDeleteObjectStateEvent::class, 0], + [DeleteObjectStateEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -644,8 +644,8 @@ public function testDeleteObjectStateEvents() public function testDeleteObjectStateStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteObjectStateEventInterface::class, - DeleteObjectStateEventInterface::class + BeforeDeleteObjectStateEvent::class, + DeleteObjectStateEvent::class ); $parameters = [ @@ -654,7 +654,7 @@ public function testDeleteObjectStateStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteObjectStateEventInterface::class, function (BeforeDeleteObjectStateEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeDeleteObjectStateEvent::class, function (BeforeDeleteObjectStateEvent $event) { $event->stopPropagation(); }, 10); @@ -665,11 +665,11 @@ public function testDeleteObjectStateStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteObjectStateEventInterface::class, 10], + [BeforeDeleteObjectStateEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteObjectStateEventInterface::class, 0], - [DeleteObjectStateEventInterface::class, 0], + [BeforeDeleteObjectStateEvent::class, 0], + [DeleteObjectStateEvent::class, 0], ]); } } diff --git a/eZ/Publish/Core/Event/Tests/RoleServiceTest.php b/eZ/Publish/Core/Event/Tests/RoleServiceTest.php index ed7376f1fec..eb38c59779c 100644 --- a/eZ/Publish/Core/Event/Tests/RoleServiceTest.php +++ b/eZ/Publish/Core/Event/Tests/RoleServiceTest.php @@ -6,42 +6,42 @@ */ namespace eZ\Publish\Core\Event\Tests; -use eZ\Publish\API\Repository\Events\Role\AddPolicyByRoleDraftEvent as AddPolicyByRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\AddPolicyEvent as AddPolicyEventInterface; -use eZ\Publish\API\Repository\Events\Role\AssignRoleToUserEvent as AssignRoleToUserEventInterface; -use eZ\Publish\API\Repository\Events\Role\AssignRoleToUserGroupEvent as AssignRoleToUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeAddPolicyByRoleDraftEvent as BeforeAddPolicyByRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeAddPolicyEvent as BeforeAddPolicyEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeAssignRoleToUserEvent as BeforeAssignRoleToUserEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeAssignRoleToUserGroupEvent as BeforeAssignRoleToUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeCreateRoleDraftEvent as BeforeCreateRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeCreateRoleEvent as BeforeCreateRoleEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeDeletePolicyEvent as BeforeDeletePolicyEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeDeleteRoleDraftEvent as BeforeDeleteRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeDeleteRoleEvent as BeforeDeleteRoleEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforePublishRoleDraftEvent as BeforePublishRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeRemovePolicyByRoleDraftEvent as BeforeRemovePolicyByRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeRemoveRoleAssignmentEvent as BeforeRemoveRoleAssignmentEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeUnassignRoleFromUserEvent as BeforeUnassignRoleFromUserEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeUnassignRoleFromUserGroupEvent as BeforeUnassignRoleFromUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeUpdatePolicyByRoleDraftEvent as BeforeUpdatePolicyByRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeUpdatePolicyEvent as BeforeUpdatePolicyEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeUpdateRoleDraftEvent as BeforeUpdateRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\BeforeUpdateRoleEvent as BeforeUpdateRoleEventInterface; -use eZ\Publish\API\Repository\Events\Role\CreateRoleDraftEvent as CreateRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\CreateRoleEvent as CreateRoleEventInterface; -use eZ\Publish\API\Repository\Events\Role\DeletePolicyEvent as DeletePolicyEventInterface; -use eZ\Publish\API\Repository\Events\Role\DeleteRoleDraftEvent as DeleteRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\DeleteRoleEvent as DeleteRoleEventInterface; -use eZ\Publish\API\Repository\Events\Role\PublishRoleDraftEvent as PublishRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\RemovePolicyByRoleDraftEvent as RemovePolicyByRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\RemoveRoleAssignmentEvent as RemoveRoleAssignmentEventInterface; -use eZ\Publish\API\Repository\Events\Role\UnassignRoleFromUserEvent as UnassignRoleFromUserEventInterface; -use eZ\Publish\API\Repository\Events\Role\UnassignRoleFromUserGroupEvent as UnassignRoleFromUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\Role\UpdatePolicyByRoleDraftEvent as UpdatePolicyByRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\UpdatePolicyEvent as UpdatePolicyEventInterface; -use eZ\Publish\API\Repository\Events\Role\UpdateRoleDraftEvent as UpdateRoleDraftEventInterface; -use eZ\Publish\API\Repository\Events\Role\UpdateRoleEvent as UpdateRoleEventInterface; +use eZ\Publish\API\Repository\Events\Role\AddPolicyByRoleDraftEvent; +use eZ\Publish\API\Repository\Events\Role\AddPolicyEvent; +use eZ\Publish\API\Repository\Events\Role\AssignRoleToUserEvent; +use eZ\Publish\API\Repository\Events\Role\AssignRoleToUserGroupEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeAddPolicyByRoleDraftEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeAddPolicyEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeAssignRoleToUserEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeAssignRoleToUserGroupEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeCreateRoleDraftEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeCreateRoleEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeDeletePolicyEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeDeleteRoleDraftEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeDeleteRoleEvent; +use eZ\Publish\API\Repository\Events\Role\BeforePublishRoleDraftEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeRemovePolicyByRoleDraftEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeRemoveRoleAssignmentEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeUnassignRoleFromUserEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeUnassignRoleFromUserGroupEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeUpdatePolicyByRoleDraftEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeUpdatePolicyEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeUpdateRoleDraftEvent; +use eZ\Publish\API\Repository\Events\Role\BeforeUpdateRoleEvent; +use eZ\Publish\API\Repository\Events\Role\CreateRoleDraftEvent; +use eZ\Publish\API\Repository\Events\Role\CreateRoleEvent; +use eZ\Publish\API\Repository\Events\Role\DeletePolicyEvent; +use eZ\Publish\API\Repository\Events\Role\DeleteRoleDraftEvent; +use eZ\Publish\API\Repository\Events\Role\DeleteRoleEvent; +use eZ\Publish\API\Repository\Events\Role\PublishRoleDraftEvent; +use eZ\Publish\API\Repository\Events\Role\RemovePolicyByRoleDraftEvent; +use eZ\Publish\API\Repository\Events\Role\RemoveRoleAssignmentEvent; +use eZ\Publish\API\Repository\Events\Role\UnassignRoleFromUserEvent; +use eZ\Publish\API\Repository\Events\Role\UnassignRoleFromUserGroupEvent; +use eZ\Publish\API\Repository\Events\Role\UpdatePolicyByRoleDraftEvent; +use eZ\Publish\API\Repository\Events\Role\UpdatePolicyEvent; +use eZ\Publish\API\Repository\Events\Role\UpdateRoleDraftEvent; +use eZ\Publish\API\Repository\Events\Role\UpdateRoleEvent; use eZ\Publish\API\Repository\RoleService as RoleServiceInterface; use eZ\Publish\API\Repository\Values\User\Limitation\RoleLimitation; use eZ\Publish\API\Repository\Values\User\Policy; @@ -62,8 +62,8 @@ class RoleServiceTest extends AbstractServiceTest public function testDeletePolicyEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeletePolicyEventInterface::class, - DeletePolicyEventInterface::class + BeforeDeletePolicyEvent::class, + DeletePolicyEvent::class ); $parameters = [ @@ -78,8 +78,8 @@ public function testDeletePolicyEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeletePolicyEventInterface::class, 0], - [DeletePolicyEventInterface::class, 0], + [BeforeDeletePolicyEvent::class, 0], + [DeletePolicyEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -87,8 +87,8 @@ public function testDeletePolicyEvents() public function testDeletePolicyStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeletePolicyEventInterface::class, - DeletePolicyEventInterface::class + BeforeDeletePolicyEvent::class, + DeletePolicyEvent::class ); $parameters = [ @@ -97,7 +97,7 @@ public function testDeletePolicyStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeletePolicyEventInterface::class, function (BeforeDeletePolicyEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeDeletePolicyEvent::class, function (BeforeDeletePolicyEvent $event) { $event->stopPropagation(); }, 10); @@ -108,19 +108,19 @@ public function testDeletePolicyStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeletePolicyEventInterface::class, 10], + [BeforeDeletePolicyEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeletePolicyEventInterface::class, 0], - [DeletePolicyEventInterface::class, 0], + [BeforeDeletePolicyEvent::class, 0], + [DeletePolicyEvent::class, 0], ]); } public function testUpdateRoleEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateRoleEventInterface::class, - UpdateRoleEventInterface::class + BeforeUpdateRoleEvent::class, + UpdateRoleEvent::class ); $parameters = [ @@ -139,8 +139,8 @@ public function testUpdateRoleEvents() $this->assertSame($updatedRole, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateRoleEventInterface::class, 0], - [UpdateRoleEventInterface::class, 0], + [BeforeUpdateRoleEvent::class, 0], + [UpdateRoleEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -148,8 +148,8 @@ public function testUpdateRoleEvents() public function testReturnUpdateRoleResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateRoleEventInterface::class, - UpdateRoleEventInterface::class + BeforeUpdateRoleEvent::class, + UpdateRoleEvent::class ); $parameters = [ @@ -162,7 +162,7 @@ public function testReturnUpdateRoleResultInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('updateRole')->willReturn($updatedRole); - $traceableEventDispatcher->addListener(BeforeUpdateRoleEventInterface::class, function (BeforeUpdateRoleEventInterface $event) use ($eventUpdatedRole) { + $traceableEventDispatcher->addListener(BeforeUpdateRoleEvent::class, function (BeforeUpdateRoleEvent $event) use ($eventUpdatedRole) { $event->setUpdatedRole($eventUpdatedRole); }, 10); @@ -173,9 +173,9 @@ public function testReturnUpdateRoleResultInBeforeEvents() $this->assertSame($eventUpdatedRole, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateRoleEventInterface::class, 10], - [BeforeUpdateRoleEventInterface::class, 0], - [UpdateRoleEventInterface::class, 0], + [BeforeUpdateRoleEvent::class, 10], + [BeforeUpdateRoleEvent::class, 0], + [UpdateRoleEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -183,8 +183,8 @@ public function testReturnUpdateRoleResultInBeforeEvents() public function testUpdateRoleStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateRoleEventInterface::class, - UpdateRoleEventInterface::class + BeforeUpdateRoleEvent::class, + UpdateRoleEvent::class ); $parameters = [ @@ -197,7 +197,7 @@ public function testUpdateRoleStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('updateRole')->willReturn($updatedRole); - $traceableEventDispatcher->addListener(BeforeUpdateRoleEventInterface::class, function (BeforeUpdateRoleEventInterface $event) use ($eventUpdatedRole) { + $traceableEventDispatcher->addListener(BeforeUpdateRoleEvent::class, function (BeforeUpdateRoleEvent $event) use ($eventUpdatedRole) { $event->setUpdatedRole($eventUpdatedRole); $event->stopPropagation(); }, 10); @@ -210,19 +210,19 @@ public function testUpdateRoleStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedRole, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateRoleEventInterface::class, 10], + [BeforeUpdateRoleEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateRoleEventInterface::class, 0], - [UpdateRoleEventInterface::class, 0], + [BeforeUpdateRoleEvent::class, 0], + [UpdateRoleEvent::class, 0], ]); } public function testPublishRoleDraftEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforePublishRoleDraftEventInterface::class, - PublishRoleDraftEventInterface::class + BeforePublishRoleDraftEvent::class, + PublishRoleDraftEvent::class ); $parameters = [ @@ -237,8 +237,8 @@ public function testPublishRoleDraftEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforePublishRoleDraftEventInterface::class, 0], - [PublishRoleDraftEventInterface::class, 0], + [BeforePublishRoleDraftEvent::class, 0], + [PublishRoleDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -246,8 +246,8 @@ public function testPublishRoleDraftEvents() public function testPublishRoleDraftStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforePublishRoleDraftEventInterface::class, - PublishRoleDraftEventInterface::class + BeforePublishRoleDraftEvent::class, + PublishRoleDraftEvent::class ); $parameters = [ @@ -256,7 +256,7 @@ public function testPublishRoleDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); - $traceableEventDispatcher->addListener(BeforePublishRoleDraftEventInterface::class, function (BeforePublishRoleDraftEventInterface $event) { + $traceableEventDispatcher->addListener(BeforePublishRoleDraftEvent::class, function (BeforePublishRoleDraftEvent $event) { $event->stopPropagation(); }, 10); @@ -267,19 +267,19 @@ public function testPublishRoleDraftStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforePublishRoleDraftEventInterface::class, 10], + [BeforePublishRoleDraftEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforePublishRoleDraftEventInterface::class, 0], - [PublishRoleDraftEventInterface::class, 0], + [BeforePublishRoleDraftEvent::class, 0], + [PublishRoleDraftEvent::class, 0], ]); } public function testAssignRoleToUserEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAssignRoleToUserEventInterface::class, - AssignRoleToUserEventInterface::class + BeforeAssignRoleToUserEvent::class, + AssignRoleToUserEvent::class ); $parameters = [ @@ -296,8 +296,8 @@ public function testAssignRoleToUserEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeAssignRoleToUserEventInterface::class, 0], - [AssignRoleToUserEventInterface::class, 0], + [BeforeAssignRoleToUserEvent::class, 0], + [AssignRoleToUserEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -305,8 +305,8 @@ public function testAssignRoleToUserEvents() public function testAssignRoleToUserStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAssignRoleToUserEventInterface::class, - AssignRoleToUserEventInterface::class + BeforeAssignRoleToUserEvent::class, + AssignRoleToUserEvent::class ); $parameters = [ @@ -317,7 +317,7 @@ public function testAssignRoleToUserStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeAssignRoleToUserEventInterface::class, function (BeforeAssignRoleToUserEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeAssignRoleToUserEvent::class, function (BeforeAssignRoleToUserEvent $event) { $event->stopPropagation(); }, 10); @@ -328,19 +328,19 @@ public function testAssignRoleToUserStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeAssignRoleToUserEventInterface::class, 10], + [BeforeAssignRoleToUserEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [AssignRoleToUserEventInterface::class, 0], - [BeforeAssignRoleToUserEventInterface::class, 0], + [AssignRoleToUserEvent::class, 0], + [BeforeAssignRoleToUserEvent::class, 0], ]); } public function testAddPolicyEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAddPolicyEventInterface::class, - AddPolicyEventInterface::class + BeforeAddPolicyEvent::class, + AddPolicyEvent::class ); $parameters = [ @@ -359,8 +359,8 @@ public function testAddPolicyEvents() $this->assertSame($updatedRole, $result); $this->assertSame($calledListeners, [ - [BeforeAddPolicyEventInterface::class, 0], - [AddPolicyEventInterface::class, 0], + [BeforeAddPolicyEvent::class, 0], + [AddPolicyEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -368,8 +368,8 @@ public function testAddPolicyEvents() public function testReturnAddPolicyResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAddPolicyEventInterface::class, - AddPolicyEventInterface::class + BeforeAddPolicyEvent::class, + AddPolicyEvent::class ); $parameters = [ @@ -382,7 +382,7 @@ public function testReturnAddPolicyResultInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('addPolicy')->willReturn($updatedRole); - $traceableEventDispatcher->addListener(BeforeAddPolicyEventInterface::class, function (BeforeAddPolicyEventInterface $event) use ($eventUpdatedRole) { + $traceableEventDispatcher->addListener(BeforeAddPolicyEvent::class, function (BeforeAddPolicyEvent $event) use ($eventUpdatedRole) { $event->setUpdatedRole($eventUpdatedRole); }, 10); @@ -393,9 +393,9 @@ public function testReturnAddPolicyResultInBeforeEvents() $this->assertSame($eventUpdatedRole, $result); $this->assertSame($calledListeners, [ - [BeforeAddPolicyEventInterface::class, 10], - [BeforeAddPolicyEventInterface::class, 0], - [AddPolicyEventInterface::class, 0], + [BeforeAddPolicyEvent::class, 10], + [BeforeAddPolicyEvent::class, 0], + [AddPolicyEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -403,8 +403,8 @@ public function testReturnAddPolicyResultInBeforeEvents() public function testAddPolicyStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAddPolicyEventInterface::class, - AddPolicyEventInterface::class + BeforeAddPolicyEvent::class, + AddPolicyEvent::class ); $parameters = [ @@ -417,7 +417,7 @@ public function testAddPolicyStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('addPolicy')->willReturn($updatedRole); - $traceableEventDispatcher->addListener(BeforeAddPolicyEventInterface::class, function (BeforeAddPolicyEventInterface $event) use ($eventUpdatedRole) { + $traceableEventDispatcher->addListener(BeforeAddPolicyEvent::class, function (BeforeAddPolicyEvent $event) use ($eventUpdatedRole) { $event->setUpdatedRole($eventUpdatedRole); $event->stopPropagation(); }, 10); @@ -430,19 +430,19 @@ public function testAddPolicyStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedRole, $result); $this->assertSame($calledListeners, [ - [BeforeAddPolicyEventInterface::class, 10], + [BeforeAddPolicyEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [AddPolicyEventInterface::class, 0], - [BeforeAddPolicyEventInterface::class, 0], + [AddPolicyEvent::class, 0], + [BeforeAddPolicyEvent::class, 0], ]); } public function testUpdateRoleDraftEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateRoleDraftEventInterface::class, - UpdateRoleDraftEventInterface::class + BeforeUpdateRoleDraftEvent::class, + UpdateRoleDraftEvent::class ); $parameters = [ @@ -461,8 +461,8 @@ public function testUpdateRoleDraftEvents() $this->assertSame($updatedRoleDraft, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateRoleDraftEventInterface::class, 0], - [UpdateRoleDraftEventInterface::class, 0], + [BeforeUpdateRoleDraftEvent::class, 0], + [UpdateRoleDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -470,8 +470,8 @@ public function testUpdateRoleDraftEvents() public function testReturnUpdateRoleDraftResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateRoleDraftEventInterface::class, - UpdateRoleDraftEventInterface::class + BeforeUpdateRoleDraftEvent::class, + UpdateRoleDraftEvent::class ); $parameters = [ @@ -484,7 +484,7 @@ public function testReturnUpdateRoleDraftResultInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('updateRoleDraft')->willReturn($updatedRoleDraft); - $traceableEventDispatcher->addListener(BeforeUpdateRoleDraftEventInterface::class, function (BeforeUpdateRoleDraftEventInterface $event) use ($eventUpdatedRoleDraft) { + $traceableEventDispatcher->addListener(BeforeUpdateRoleDraftEvent::class, function (BeforeUpdateRoleDraftEvent $event) use ($eventUpdatedRoleDraft) { $event->setUpdatedRoleDraft($eventUpdatedRoleDraft); }, 10); @@ -495,9 +495,9 @@ public function testReturnUpdateRoleDraftResultInBeforeEvents() $this->assertSame($eventUpdatedRoleDraft, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateRoleDraftEventInterface::class, 10], - [BeforeUpdateRoleDraftEventInterface::class, 0], - [UpdateRoleDraftEventInterface::class, 0], + [BeforeUpdateRoleDraftEvent::class, 10], + [BeforeUpdateRoleDraftEvent::class, 0], + [UpdateRoleDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -505,8 +505,8 @@ public function testReturnUpdateRoleDraftResultInBeforeEvents() public function testUpdateRoleDraftStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateRoleDraftEventInterface::class, - UpdateRoleDraftEventInterface::class + BeforeUpdateRoleDraftEvent::class, + UpdateRoleDraftEvent::class ); $parameters = [ @@ -519,7 +519,7 @@ public function testUpdateRoleDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('updateRoleDraft')->willReturn($updatedRoleDraft); - $traceableEventDispatcher->addListener(BeforeUpdateRoleDraftEventInterface::class, function (BeforeUpdateRoleDraftEventInterface $event) use ($eventUpdatedRoleDraft) { + $traceableEventDispatcher->addListener(BeforeUpdateRoleDraftEvent::class, function (BeforeUpdateRoleDraftEvent $event) use ($eventUpdatedRoleDraft) { $event->setUpdatedRoleDraft($eventUpdatedRoleDraft); $event->stopPropagation(); }, 10); @@ -532,19 +532,19 @@ public function testUpdateRoleDraftStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedRoleDraft, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateRoleDraftEventInterface::class, 10], + [BeforeUpdateRoleDraftEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateRoleDraftEventInterface::class, 0], - [UpdateRoleDraftEventInterface::class, 0], + [BeforeUpdateRoleDraftEvent::class, 0], + [UpdateRoleDraftEvent::class, 0], ]); } public function testAssignRoleToUserGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAssignRoleToUserGroupEventInterface::class, - AssignRoleToUserGroupEventInterface::class + BeforeAssignRoleToUserGroupEvent::class, + AssignRoleToUserGroupEvent::class ); $parameters = [ @@ -561,8 +561,8 @@ public function testAssignRoleToUserGroupEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeAssignRoleToUserGroupEventInterface::class, 0], - [AssignRoleToUserGroupEventInterface::class, 0], + [BeforeAssignRoleToUserGroupEvent::class, 0], + [AssignRoleToUserGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -570,8 +570,8 @@ public function testAssignRoleToUserGroupEvents() public function testAssignRoleToUserGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAssignRoleToUserGroupEventInterface::class, - AssignRoleToUserGroupEventInterface::class + BeforeAssignRoleToUserGroupEvent::class, + AssignRoleToUserGroupEvent::class ); $parameters = [ @@ -582,7 +582,7 @@ public function testAssignRoleToUserGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeAssignRoleToUserGroupEventInterface::class, function (BeforeAssignRoleToUserGroupEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeAssignRoleToUserGroupEvent::class, function (BeforeAssignRoleToUserGroupEvent $event) { $event->stopPropagation(); }, 10); @@ -593,19 +593,19 @@ public function testAssignRoleToUserGroupStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeAssignRoleToUserGroupEventInterface::class, 10], + [BeforeAssignRoleToUserGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [AssignRoleToUserGroupEventInterface::class, 0], - [BeforeAssignRoleToUserGroupEventInterface::class, 0], + [AssignRoleToUserGroupEvent::class, 0], + [BeforeAssignRoleToUserGroupEvent::class, 0], ]); } public function testUnassignRoleFromUserEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUnassignRoleFromUserEventInterface::class, - UnassignRoleFromUserEventInterface::class + BeforeUnassignRoleFromUserEvent::class, + UnassignRoleFromUserEvent::class ); $parameters = [ @@ -621,8 +621,8 @@ public function testUnassignRoleFromUserEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeUnassignRoleFromUserEventInterface::class, 0], - [UnassignRoleFromUserEventInterface::class, 0], + [BeforeUnassignRoleFromUserEvent::class, 0], + [UnassignRoleFromUserEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -630,8 +630,8 @@ public function testUnassignRoleFromUserEvents() public function testUnassignRoleFromUserStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUnassignRoleFromUserEventInterface::class, - UnassignRoleFromUserEventInterface::class + BeforeUnassignRoleFromUserEvent::class, + UnassignRoleFromUserEvent::class ); $parameters = [ @@ -641,7 +641,7 @@ public function testUnassignRoleFromUserStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeUnassignRoleFromUserEventInterface::class, function (BeforeUnassignRoleFromUserEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeUnassignRoleFromUserEvent::class, function (BeforeUnassignRoleFromUserEvent $event) { $event->stopPropagation(); }, 10); @@ -652,19 +652,19 @@ public function testUnassignRoleFromUserStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeUnassignRoleFromUserEventInterface::class, 10], + [BeforeUnassignRoleFromUserEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUnassignRoleFromUserEventInterface::class, 0], - [UnassignRoleFromUserEventInterface::class, 0], + [BeforeUnassignRoleFromUserEvent::class, 0], + [UnassignRoleFromUserEvent::class, 0], ]); } public function testUpdatePolicyByRoleDraftEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdatePolicyByRoleDraftEventInterface::class, - UpdatePolicyByRoleDraftEventInterface::class + BeforeUpdatePolicyByRoleDraftEvent::class, + UpdatePolicyByRoleDraftEvent::class ); $parameters = [ @@ -684,8 +684,8 @@ public function testUpdatePolicyByRoleDraftEvents() $this->assertSame($updatedPolicyDraft, $result); $this->assertSame($calledListeners, [ - [BeforeUpdatePolicyByRoleDraftEventInterface::class, 0], - [UpdatePolicyByRoleDraftEventInterface::class, 0], + [BeforeUpdatePolicyByRoleDraftEvent::class, 0], + [UpdatePolicyByRoleDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -693,8 +693,8 @@ public function testUpdatePolicyByRoleDraftEvents() public function testReturnUpdatePolicyByRoleDraftResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdatePolicyByRoleDraftEventInterface::class, - UpdatePolicyByRoleDraftEventInterface::class + BeforeUpdatePolicyByRoleDraftEvent::class, + UpdatePolicyByRoleDraftEvent::class ); $parameters = [ @@ -708,7 +708,7 @@ public function testReturnUpdatePolicyByRoleDraftResultInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('updatePolicyByRoleDraft')->willReturn($updatedPolicyDraft); - $traceableEventDispatcher->addListener(BeforeUpdatePolicyByRoleDraftEventInterface::class, function (BeforeUpdatePolicyByRoleDraftEventInterface $event) use ($eventUpdatedPolicyDraft) { + $traceableEventDispatcher->addListener(BeforeUpdatePolicyByRoleDraftEvent::class, function (BeforeUpdatePolicyByRoleDraftEvent $event) use ($eventUpdatedPolicyDraft) { $event->setUpdatedPolicyDraft($eventUpdatedPolicyDraft); }, 10); @@ -719,9 +719,9 @@ public function testReturnUpdatePolicyByRoleDraftResultInBeforeEvents() $this->assertSame($eventUpdatedPolicyDraft, $result); $this->assertSame($calledListeners, [ - [BeforeUpdatePolicyByRoleDraftEventInterface::class, 10], - [BeforeUpdatePolicyByRoleDraftEventInterface::class, 0], - [UpdatePolicyByRoleDraftEventInterface::class, 0], + [BeforeUpdatePolicyByRoleDraftEvent::class, 10], + [BeforeUpdatePolicyByRoleDraftEvent::class, 0], + [UpdatePolicyByRoleDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -729,8 +729,8 @@ public function testReturnUpdatePolicyByRoleDraftResultInBeforeEvents() public function testUpdatePolicyByRoleDraftStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdatePolicyByRoleDraftEventInterface::class, - UpdatePolicyByRoleDraftEventInterface::class + BeforeUpdatePolicyByRoleDraftEvent::class, + UpdatePolicyByRoleDraftEvent::class ); $parameters = [ @@ -744,7 +744,7 @@ public function testUpdatePolicyByRoleDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('updatePolicyByRoleDraft')->willReturn($updatedPolicyDraft); - $traceableEventDispatcher->addListener(BeforeUpdatePolicyByRoleDraftEventInterface::class, function (BeforeUpdatePolicyByRoleDraftEventInterface $event) use ($eventUpdatedPolicyDraft) { + $traceableEventDispatcher->addListener(BeforeUpdatePolicyByRoleDraftEvent::class, function (BeforeUpdatePolicyByRoleDraftEvent $event) use ($eventUpdatedPolicyDraft) { $event->setUpdatedPolicyDraft($eventUpdatedPolicyDraft); $event->stopPropagation(); }, 10); @@ -757,19 +757,19 @@ public function testUpdatePolicyByRoleDraftStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedPolicyDraft, $result); $this->assertSame($calledListeners, [ - [BeforeUpdatePolicyByRoleDraftEventInterface::class, 10], + [BeforeUpdatePolicyByRoleDraftEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdatePolicyByRoleDraftEventInterface::class, 0], - [UpdatePolicyByRoleDraftEventInterface::class, 0], + [BeforeUpdatePolicyByRoleDraftEvent::class, 0], + [UpdatePolicyByRoleDraftEvent::class, 0], ]); } public function testCreateRoleEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateRoleEventInterface::class, - CreateRoleEventInterface::class + BeforeCreateRoleEvent::class, + CreateRoleEvent::class ); $parameters = [ @@ -787,8 +787,8 @@ public function testCreateRoleEvents() $this->assertSame($roleDraft, $result); $this->assertSame($calledListeners, [ - [BeforeCreateRoleEventInterface::class, 0], - [CreateRoleEventInterface::class, 0], + [BeforeCreateRoleEvent::class, 0], + [CreateRoleEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -796,8 +796,8 @@ public function testCreateRoleEvents() public function testReturnCreateRoleResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateRoleEventInterface::class, - CreateRoleEventInterface::class + BeforeCreateRoleEvent::class, + CreateRoleEvent::class ); $parameters = [ @@ -809,7 +809,7 @@ public function testReturnCreateRoleResultInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('createRole')->willReturn($roleDraft); - $traceableEventDispatcher->addListener(BeforeCreateRoleEventInterface::class, function (BeforeCreateRoleEventInterface $event) use ($eventRoleDraft) { + $traceableEventDispatcher->addListener(BeforeCreateRoleEvent::class, function (BeforeCreateRoleEvent $event) use ($eventRoleDraft) { $event->setRoleDraft($eventRoleDraft); }, 10); @@ -820,9 +820,9 @@ public function testReturnCreateRoleResultInBeforeEvents() $this->assertSame($eventRoleDraft, $result); $this->assertSame($calledListeners, [ - [BeforeCreateRoleEventInterface::class, 10], - [BeforeCreateRoleEventInterface::class, 0], - [CreateRoleEventInterface::class, 0], + [BeforeCreateRoleEvent::class, 10], + [BeforeCreateRoleEvent::class, 0], + [CreateRoleEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -830,8 +830,8 @@ public function testReturnCreateRoleResultInBeforeEvents() public function testCreateRoleStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateRoleEventInterface::class, - CreateRoleEventInterface::class + BeforeCreateRoleEvent::class, + CreateRoleEvent::class ); $parameters = [ @@ -843,7 +843,7 @@ public function testCreateRoleStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('createRole')->willReturn($roleDraft); - $traceableEventDispatcher->addListener(BeforeCreateRoleEventInterface::class, function (BeforeCreateRoleEventInterface $event) use ($eventRoleDraft) { + $traceableEventDispatcher->addListener(BeforeCreateRoleEvent::class, function (BeforeCreateRoleEvent $event) use ($eventRoleDraft) { $event->setRoleDraft($eventRoleDraft); $event->stopPropagation(); }, 10); @@ -856,19 +856,19 @@ public function testCreateRoleStopPropagationInBeforeEvents() $this->assertSame($eventRoleDraft, $result); $this->assertSame($calledListeners, [ - [BeforeCreateRoleEventInterface::class, 10], + [BeforeCreateRoleEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateRoleEventInterface::class, 0], - [CreateRoleEventInterface::class, 0], + [BeforeCreateRoleEvent::class, 0], + [CreateRoleEvent::class, 0], ]); } public function testRemovePolicyByRoleDraftEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRemovePolicyByRoleDraftEventInterface::class, - RemovePolicyByRoleDraftEventInterface::class + BeforeRemovePolicyByRoleDraftEvent::class, + RemovePolicyByRoleDraftEvent::class ); $parameters = [ @@ -887,8 +887,8 @@ public function testRemovePolicyByRoleDraftEvents() $this->assertSame($updatedRoleDraft, $result); $this->assertSame($calledListeners, [ - [BeforeRemovePolicyByRoleDraftEventInterface::class, 0], - [RemovePolicyByRoleDraftEventInterface::class, 0], + [BeforeRemovePolicyByRoleDraftEvent::class, 0], + [RemovePolicyByRoleDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -896,8 +896,8 @@ public function testRemovePolicyByRoleDraftEvents() public function testReturnRemovePolicyByRoleDraftResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRemovePolicyByRoleDraftEventInterface::class, - RemovePolicyByRoleDraftEventInterface::class + BeforeRemovePolicyByRoleDraftEvent::class, + RemovePolicyByRoleDraftEvent::class ); $parameters = [ @@ -910,7 +910,7 @@ public function testReturnRemovePolicyByRoleDraftResultInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('removePolicyByRoleDraft')->willReturn($updatedRoleDraft); - $traceableEventDispatcher->addListener(BeforeRemovePolicyByRoleDraftEventInterface::class, function (BeforeRemovePolicyByRoleDraftEventInterface $event) use ($eventUpdatedRoleDraft) { + $traceableEventDispatcher->addListener(BeforeRemovePolicyByRoleDraftEvent::class, function (BeforeRemovePolicyByRoleDraftEvent $event) use ($eventUpdatedRoleDraft) { $event->setUpdatedRoleDraft($eventUpdatedRoleDraft); }, 10); @@ -921,9 +921,9 @@ public function testReturnRemovePolicyByRoleDraftResultInBeforeEvents() $this->assertSame($eventUpdatedRoleDraft, $result); $this->assertSame($calledListeners, [ - [BeforeRemovePolicyByRoleDraftEventInterface::class, 10], - [BeforeRemovePolicyByRoleDraftEventInterface::class, 0], - [RemovePolicyByRoleDraftEventInterface::class, 0], + [BeforeRemovePolicyByRoleDraftEvent::class, 10], + [BeforeRemovePolicyByRoleDraftEvent::class, 0], + [RemovePolicyByRoleDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -931,8 +931,8 @@ public function testReturnRemovePolicyByRoleDraftResultInBeforeEvents() public function testRemovePolicyByRoleDraftStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRemovePolicyByRoleDraftEventInterface::class, - RemovePolicyByRoleDraftEventInterface::class + BeforeRemovePolicyByRoleDraftEvent::class, + RemovePolicyByRoleDraftEvent::class ); $parameters = [ @@ -945,7 +945,7 @@ public function testRemovePolicyByRoleDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('removePolicyByRoleDraft')->willReturn($updatedRoleDraft); - $traceableEventDispatcher->addListener(BeforeRemovePolicyByRoleDraftEventInterface::class, function (BeforeRemovePolicyByRoleDraftEventInterface $event) use ($eventUpdatedRoleDraft) { + $traceableEventDispatcher->addListener(BeforeRemovePolicyByRoleDraftEvent::class, function (BeforeRemovePolicyByRoleDraftEvent $event) use ($eventUpdatedRoleDraft) { $event->setUpdatedRoleDraft($eventUpdatedRoleDraft); $event->stopPropagation(); }, 10); @@ -958,19 +958,19 @@ public function testRemovePolicyByRoleDraftStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedRoleDraft, $result); $this->assertSame($calledListeners, [ - [BeforeRemovePolicyByRoleDraftEventInterface::class, 10], + [BeforeRemovePolicyByRoleDraftEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeRemovePolicyByRoleDraftEventInterface::class, 0], - [RemovePolicyByRoleDraftEventInterface::class, 0], + [BeforeRemovePolicyByRoleDraftEvent::class, 0], + [RemovePolicyByRoleDraftEvent::class, 0], ]); } public function testAddPolicyByRoleDraftEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAddPolicyByRoleDraftEventInterface::class, - AddPolicyByRoleDraftEventInterface::class + BeforeAddPolicyByRoleDraftEvent::class, + AddPolicyByRoleDraftEvent::class ); $parameters = [ @@ -989,8 +989,8 @@ public function testAddPolicyByRoleDraftEvents() $this->assertSame($updatedRoleDraft, $result); $this->assertSame($calledListeners, [ - [BeforeAddPolicyByRoleDraftEventInterface::class, 0], - [AddPolicyByRoleDraftEventInterface::class, 0], + [BeforeAddPolicyByRoleDraftEvent::class, 0], + [AddPolicyByRoleDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -998,8 +998,8 @@ public function testAddPolicyByRoleDraftEvents() public function testReturnAddPolicyByRoleDraftResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAddPolicyByRoleDraftEventInterface::class, - AddPolicyByRoleDraftEventInterface::class + BeforeAddPolicyByRoleDraftEvent::class, + AddPolicyByRoleDraftEvent::class ); $parameters = [ @@ -1012,7 +1012,7 @@ public function testReturnAddPolicyByRoleDraftResultInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('addPolicyByRoleDraft')->willReturn($updatedRoleDraft); - $traceableEventDispatcher->addListener(BeforeAddPolicyByRoleDraftEventInterface::class, function (BeforeAddPolicyByRoleDraftEventInterface $event) use ($eventUpdatedRoleDraft) { + $traceableEventDispatcher->addListener(BeforeAddPolicyByRoleDraftEvent::class, function (BeforeAddPolicyByRoleDraftEvent $event) use ($eventUpdatedRoleDraft) { $event->setUpdatedRoleDraft($eventUpdatedRoleDraft); }, 10); @@ -1023,9 +1023,9 @@ public function testReturnAddPolicyByRoleDraftResultInBeforeEvents() $this->assertSame($eventUpdatedRoleDraft, $result); $this->assertSame($calledListeners, [ - [BeforeAddPolicyByRoleDraftEventInterface::class, 10], - [BeforeAddPolicyByRoleDraftEventInterface::class, 0], - [AddPolicyByRoleDraftEventInterface::class, 0], + [BeforeAddPolicyByRoleDraftEvent::class, 10], + [BeforeAddPolicyByRoleDraftEvent::class, 0], + [AddPolicyByRoleDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -1033,8 +1033,8 @@ public function testReturnAddPolicyByRoleDraftResultInBeforeEvents() public function testAddPolicyByRoleDraftStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAddPolicyByRoleDraftEventInterface::class, - AddPolicyByRoleDraftEventInterface::class + BeforeAddPolicyByRoleDraftEvent::class, + AddPolicyByRoleDraftEvent::class ); $parameters = [ @@ -1047,7 +1047,7 @@ public function testAddPolicyByRoleDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('addPolicyByRoleDraft')->willReturn($updatedRoleDraft); - $traceableEventDispatcher->addListener(BeforeAddPolicyByRoleDraftEventInterface::class, function (BeforeAddPolicyByRoleDraftEventInterface $event) use ($eventUpdatedRoleDraft) { + $traceableEventDispatcher->addListener(BeforeAddPolicyByRoleDraftEvent::class, function (BeforeAddPolicyByRoleDraftEvent $event) use ($eventUpdatedRoleDraft) { $event->setUpdatedRoleDraft($eventUpdatedRoleDraft); $event->stopPropagation(); }, 10); @@ -1060,19 +1060,19 @@ public function testAddPolicyByRoleDraftStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedRoleDraft, $result); $this->assertSame($calledListeners, [ - [BeforeAddPolicyByRoleDraftEventInterface::class, 10], + [BeforeAddPolicyByRoleDraftEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [AddPolicyByRoleDraftEventInterface::class, 0], - [BeforeAddPolicyByRoleDraftEventInterface::class, 0], + [AddPolicyByRoleDraftEvent::class, 0], + [BeforeAddPolicyByRoleDraftEvent::class, 0], ]); } public function testDeleteRoleEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteRoleEventInterface::class, - DeleteRoleEventInterface::class + BeforeDeleteRoleEvent::class, + DeleteRoleEvent::class ); $parameters = [ @@ -1087,8 +1087,8 @@ public function testDeleteRoleEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteRoleEventInterface::class, 0], - [DeleteRoleEventInterface::class, 0], + [BeforeDeleteRoleEvent::class, 0], + [DeleteRoleEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -1096,8 +1096,8 @@ public function testDeleteRoleEvents() public function testDeleteRoleStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteRoleEventInterface::class, - DeleteRoleEventInterface::class + BeforeDeleteRoleEvent::class, + DeleteRoleEvent::class ); $parameters = [ @@ -1106,7 +1106,7 @@ public function testDeleteRoleStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteRoleEventInterface::class, function (BeforeDeleteRoleEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeDeleteRoleEvent::class, function (BeforeDeleteRoleEvent $event) { $event->stopPropagation(); }, 10); @@ -1117,19 +1117,19 @@ public function testDeleteRoleStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteRoleEventInterface::class, 10], + [BeforeDeleteRoleEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteRoleEventInterface::class, 0], - [DeleteRoleEventInterface::class, 0], + [BeforeDeleteRoleEvent::class, 0], + [DeleteRoleEvent::class, 0], ]); } public function testDeleteRoleDraftEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteRoleDraftEventInterface::class, - DeleteRoleDraftEventInterface::class + BeforeDeleteRoleDraftEvent::class, + DeleteRoleDraftEvent::class ); $parameters = [ @@ -1144,8 +1144,8 @@ public function testDeleteRoleDraftEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteRoleDraftEventInterface::class, 0], - [DeleteRoleDraftEventInterface::class, 0], + [BeforeDeleteRoleDraftEvent::class, 0], + [DeleteRoleDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -1153,8 +1153,8 @@ public function testDeleteRoleDraftEvents() public function testDeleteRoleDraftStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteRoleDraftEventInterface::class, - DeleteRoleDraftEventInterface::class + BeforeDeleteRoleDraftEvent::class, + DeleteRoleDraftEvent::class ); $parameters = [ @@ -1163,7 +1163,7 @@ public function testDeleteRoleDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteRoleDraftEventInterface::class, function (BeforeDeleteRoleDraftEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeDeleteRoleDraftEvent::class, function (BeforeDeleteRoleDraftEvent $event) { $event->stopPropagation(); }, 10); @@ -1174,19 +1174,19 @@ public function testDeleteRoleDraftStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteRoleDraftEventInterface::class, 10], + [BeforeDeleteRoleDraftEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteRoleDraftEventInterface::class, 0], - [DeleteRoleDraftEventInterface::class, 0], + [BeforeDeleteRoleDraftEvent::class, 0], + [DeleteRoleDraftEvent::class, 0], ]); } public function testRemoveRoleAssignmentEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRemoveRoleAssignmentEventInterface::class, - RemoveRoleAssignmentEventInterface::class + BeforeRemoveRoleAssignmentEvent::class, + RemoveRoleAssignmentEvent::class ); $parameters = [ @@ -1201,8 +1201,8 @@ public function testRemoveRoleAssignmentEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeRemoveRoleAssignmentEventInterface::class, 0], - [RemoveRoleAssignmentEventInterface::class, 0], + [BeforeRemoveRoleAssignmentEvent::class, 0], + [RemoveRoleAssignmentEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -1210,8 +1210,8 @@ public function testRemoveRoleAssignmentEvents() public function testRemoveRoleAssignmentStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRemoveRoleAssignmentEventInterface::class, - RemoveRoleAssignmentEventInterface::class + BeforeRemoveRoleAssignmentEvent::class, + RemoveRoleAssignmentEvent::class ); $parameters = [ @@ -1220,7 +1220,7 @@ public function testRemoveRoleAssignmentStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeRemoveRoleAssignmentEventInterface::class, function (BeforeRemoveRoleAssignmentEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeRemoveRoleAssignmentEvent::class, function (BeforeRemoveRoleAssignmentEvent $event) { $event->stopPropagation(); }, 10); @@ -1231,19 +1231,19 @@ public function testRemoveRoleAssignmentStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeRemoveRoleAssignmentEventInterface::class, 10], + [BeforeRemoveRoleAssignmentEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeRemoveRoleAssignmentEventInterface::class, 0], - [RemoveRoleAssignmentEventInterface::class, 0], + [BeforeRemoveRoleAssignmentEvent::class, 0], + [RemoveRoleAssignmentEvent::class, 0], ]); } public function testCreateRoleDraftEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateRoleDraftEventInterface::class, - CreateRoleDraftEventInterface::class + BeforeCreateRoleDraftEvent::class, + CreateRoleDraftEvent::class ); $parameters = [ @@ -1261,8 +1261,8 @@ public function testCreateRoleDraftEvents() $this->assertSame($roleDraft, $result); $this->assertSame($calledListeners, [ - [BeforeCreateRoleDraftEventInterface::class, 0], - [CreateRoleDraftEventInterface::class, 0], + [BeforeCreateRoleDraftEvent::class, 0], + [CreateRoleDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -1270,8 +1270,8 @@ public function testCreateRoleDraftEvents() public function testReturnCreateRoleDraftResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateRoleDraftEventInterface::class, - CreateRoleDraftEventInterface::class + BeforeCreateRoleDraftEvent::class, + CreateRoleDraftEvent::class ); $parameters = [ @@ -1283,7 +1283,7 @@ public function testReturnCreateRoleDraftResultInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('createRoleDraft')->willReturn($roleDraft); - $traceableEventDispatcher->addListener(BeforeCreateRoleDraftEventInterface::class, function (BeforeCreateRoleDraftEventInterface $event) use ($eventRoleDraft) { + $traceableEventDispatcher->addListener(BeforeCreateRoleDraftEvent::class, function (BeforeCreateRoleDraftEvent $event) use ($eventRoleDraft) { $event->setRoleDraft($eventRoleDraft); }, 10); @@ -1294,9 +1294,9 @@ public function testReturnCreateRoleDraftResultInBeforeEvents() $this->assertSame($eventRoleDraft, $result); $this->assertSame($calledListeners, [ - [BeforeCreateRoleDraftEventInterface::class, 10], - [BeforeCreateRoleDraftEventInterface::class, 0], - [CreateRoleDraftEventInterface::class, 0], + [BeforeCreateRoleDraftEvent::class, 10], + [BeforeCreateRoleDraftEvent::class, 0], + [CreateRoleDraftEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -1304,8 +1304,8 @@ public function testReturnCreateRoleDraftResultInBeforeEvents() public function testCreateRoleDraftStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateRoleDraftEventInterface::class, - CreateRoleDraftEventInterface::class + BeforeCreateRoleDraftEvent::class, + CreateRoleDraftEvent::class ); $parameters = [ @@ -1317,7 +1317,7 @@ public function testCreateRoleDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('createRoleDraft')->willReturn($roleDraft); - $traceableEventDispatcher->addListener(BeforeCreateRoleDraftEventInterface::class, function (BeforeCreateRoleDraftEventInterface $event) use ($eventRoleDraft) { + $traceableEventDispatcher->addListener(BeforeCreateRoleDraftEvent::class, function (BeforeCreateRoleDraftEvent $event) use ($eventRoleDraft) { $event->setRoleDraft($eventRoleDraft); $event->stopPropagation(); }, 10); @@ -1330,19 +1330,19 @@ public function testCreateRoleDraftStopPropagationInBeforeEvents() $this->assertSame($eventRoleDraft, $result); $this->assertSame($calledListeners, [ - [BeforeCreateRoleDraftEventInterface::class, 10], + [BeforeCreateRoleDraftEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateRoleDraftEventInterface::class, 0], - [CreateRoleDraftEventInterface::class, 0], + [BeforeCreateRoleDraftEvent::class, 0], + [CreateRoleDraftEvent::class, 0], ]); } public function testUpdatePolicyEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdatePolicyEventInterface::class, - UpdatePolicyEventInterface::class + BeforeUpdatePolicyEvent::class, + UpdatePolicyEvent::class ); $parameters = [ @@ -1361,8 +1361,8 @@ public function testUpdatePolicyEvents() $this->assertSame($updatedPolicy, $result); $this->assertSame($calledListeners, [ - [BeforeUpdatePolicyEventInterface::class, 0], - [UpdatePolicyEventInterface::class, 0], + [BeforeUpdatePolicyEvent::class, 0], + [UpdatePolicyEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -1370,8 +1370,8 @@ public function testUpdatePolicyEvents() public function testReturnUpdatePolicyResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdatePolicyEventInterface::class, - UpdatePolicyEventInterface::class + BeforeUpdatePolicyEvent::class, + UpdatePolicyEvent::class ); $parameters = [ @@ -1384,7 +1384,7 @@ public function testReturnUpdatePolicyResultInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('updatePolicy')->willReturn($updatedPolicy); - $traceableEventDispatcher->addListener(BeforeUpdatePolicyEventInterface::class, function (BeforeUpdatePolicyEventInterface $event) use ($eventUpdatedPolicy) { + $traceableEventDispatcher->addListener(BeforeUpdatePolicyEvent::class, function (BeforeUpdatePolicyEvent $event) use ($eventUpdatedPolicy) { $event->setUpdatedPolicy($eventUpdatedPolicy); }, 10); @@ -1395,9 +1395,9 @@ public function testReturnUpdatePolicyResultInBeforeEvents() $this->assertSame($eventUpdatedPolicy, $result); $this->assertSame($calledListeners, [ - [BeforeUpdatePolicyEventInterface::class, 10], - [BeforeUpdatePolicyEventInterface::class, 0], - [UpdatePolicyEventInterface::class, 0], + [BeforeUpdatePolicyEvent::class, 10], + [BeforeUpdatePolicyEvent::class, 0], + [UpdatePolicyEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -1405,8 +1405,8 @@ public function testReturnUpdatePolicyResultInBeforeEvents() public function testUpdatePolicyStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdatePolicyEventInterface::class, - UpdatePolicyEventInterface::class + BeforeUpdatePolicyEvent::class, + UpdatePolicyEvent::class ); $parameters = [ @@ -1419,7 +1419,7 @@ public function testUpdatePolicyStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('updatePolicy')->willReturn($updatedPolicy); - $traceableEventDispatcher->addListener(BeforeUpdatePolicyEventInterface::class, function (BeforeUpdatePolicyEventInterface $event) use ($eventUpdatedPolicy) { + $traceableEventDispatcher->addListener(BeforeUpdatePolicyEvent::class, function (BeforeUpdatePolicyEvent $event) use ($eventUpdatedPolicy) { $event->setUpdatedPolicy($eventUpdatedPolicy); $event->stopPropagation(); }, 10); @@ -1432,19 +1432,19 @@ public function testUpdatePolicyStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedPolicy, $result); $this->assertSame($calledListeners, [ - [BeforeUpdatePolicyEventInterface::class, 10], + [BeforeUpdatePolicyEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdatePolicyEventInterface::class, 0], - [UpdatePolicyEventInterface::class, 0], + [BeforeUpdatePolicyEvent::class, 0], + [UpdatePolicyEvent::class, 0], ]); } public function testUnassignRoleFromUserGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUnassignRoleFromUserGroupEventInterface::class, - UnassignRoleFromUserGroupEventInterface::class + BeforeUnassignRoleFromUserGroupEvent::class, + UnassignRoleFromUserGroupEvent::class ); $parameters = [ @@ -1460,8 +1460,8 @@ public function testUnassignRoleFromUserGroupEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeUnassignRoleFromUserGroupEventInterface::class, 0], - [UnassignRoleFromUserGroupEventInterface::class, 0], + [BeforeUnassignRoleFromUserGroupEvent::class, 0], + [UnassignRoleFromUserGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -1469,8 +1469,8 @@ public function testUnassignRoleFromUserGroupEvents() public function testUnassignRoleFromUserGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUnassignRoleFromUserGroupEventInterface::class, - UnassignRoleFromUserGroupEventInterface::class + BeforeUnassignRoleFromUserGroupEvent::class, + UnassignRoleFromUserGroupEvent::class ); $parameters = [ @@ -1480,7 +1480,7 @@ public function testUnassignRoleFromUserGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeUnassignRoleFromUserGroupEventInterface::class, function (BeforeUnassignRoleFromUserGroupEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeUnassignRoleFromUserGroupEvent::class, function (BeforeUnassignRoleFromUserGroupEvent $event) { $event->stopPropagation(); }, 10); @@ -1491,11 +1491,11 @@ public function testUnassignRoleFromUserGroupStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeUnassignRoleFromUserGroupEventInterface::class, 10], + [BeforeUnassignRoleFromUserGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUnassignRoleFromUserGroupEventInterface::class, 0], - [UnassignRoleFromUserGroupEventInterface::class, 0], + [BeforeUnassignRoleFromUserGroupEvent::class, 0], + [UnassignRoleFromUserGroupEvent::class, 0], ]); } } diff --git a/eZ/Publish/Core/Event/Tests/SectionServiceTest.php b/eZ/Publish/Core/Event/Tests/SectionServiceTest.php index 27b4dd43002..39789a23683 100644 --- a/eZ/Publish/Core/Event/Tests/SectionServiceTest.php +++ b/eZ/Publish/Core/Event/Tests/SectionServiceTest.php @@ -6,16 +6,16 @@ */ namespace eZ\Publish\Core\Event\Tests; -use eZ\Publish\API\Repository\Events\Section\AssignSectionEvent as AssignSectionEventInterface; -use eZ\Publish\API\Repository\Events\Section\AssignSectionToSubtreeEvent as AssignSectionToSubtreeEventInterface; -use eZ\Publish\API\Repository\Events\Section\BeforeAssignSectionEvent as BeforeAssignSectionEventInterface; -use eZ\Publish\API\Repository\Events\Section\BeforeAssignSectionToSubtreeEvent as BeforeAssignSectionToSubtreeEventInterface; -use eZ\Publish\API\Repository\Events\Section\BeforeCreateSectionEvent as BeforeCreateSectionEventInterface; -use eZ\Publish\API\Repository\Events\Section\BeforeDeleteSectionEvent as BeforeDeleteSectionEventInterface; -use eZ\Publish\API\Repository\Events\Section\BeforeUpdateSectionEvent as BeforeUpdateSectionEventInterface; -use eZ\Publish\API\Repository\Events\Section\CreateSectionEvent as CreateSectionEventInterface; -use eZ\Publish\API\Repository\Events\Section\DeleteSectionEvent as DeleteSectionEventInterface; -use eZ\Publish\API\Repository\Events\Section\UpdateSectionEvent as UpdateSectionEventInterface; +use eZ\Publish\API\Repository\Events\Section\AssignSectionEvent; +use eZ\Publish\API\Repository\Events\Section\AssignSectionToSubtreeEvent; +use eZ\Publish\API\Repository\Events\Section\BeforeAssignSectionEvent; +use eZ\Publish\API\Repository\Events\Section\BeforeAssignSectionToSubtreeEvent; +use eZ\Publish\API\Repository\Events\Section\BeforeCreateSectionEvent; +use eZ\Publish\API\Repository\Events\Section\BeforeDeleteSectionEvent; +use eZ\Publish\API\Repository\Events\Section\BeforeUpdateSectionEvent; +use eZ\Publish\API\Repository\Events\Section\CreateSectionEvent; +use eZ\Publish\API\Repository\Events\Section\DeleteSectionEvent; +use eZ\Publish\API\Repository\Events\Section\UpdateSectionEvent; use eZ\Publish\API\Repository\SectionService as SectionServiceInterface; use eZ\Publish\API\Repository\Values\Content\ContentInfo; use eZ\Publish\API\Repository\Values\Content\Location; @@ -29,8 +29,8 @@ class SectionServiceTest extends AbstractServiceTest public function testAssignSectionEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAssignSectionEventInterface::class, - AssignSectionEventInterface::class + BeforeAssignSectionEvent::class, + AssignSectionEvent::class ); $parameters = [ @@ -46,8 +46,8 @@ public function testAssignSectionEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeAssignSectionEventInterface::class, 0], - [AssignSectionEventInterface::class, 0], + [BeforeAssignSectionEvent::class, 0], + [AssignSectionEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -55,8 +55,8 @@ public function testAssignSectionEvents() public function testAssignSectionStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAssignSectionEventInterface::class, - AssignSectionEventInterface::class + BeforeAssignSectionEvent::class, + AssignSectionEvent::class ); $parameters = [ @@ -66,7 +66,7 @@ public function testAssignSectionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(SectionServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeAssignSectionEventInterface::class, function (BeforeAssignSectionEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeAssignSectionEvent::class, function (BeforeAssignSectionEvent $event) { $event->stopPropagation(); }, 10); @@ -77,19 +77,19 @@ public function testAssignSectionStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeAssignSectionEventInterface::class, 10], + [BeforeAssignSectionEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [AssignSectionEventInterface::class, 0], - [BeforeAssignSectionEventInterface::class, 0], + [AssignSectionEvent::class, 0], + [BeforeAssignSectionEvent::class, 0], ]); } public function testUpdateSectionEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateSectionEventInterface::class, - UpdateSectionEventInterface::class + BeforeUpdateSectionEvent::class, + UpdateSectionEvent::class ); $parameters = [ @@ -108,8 +108,8 @@ public function testUpdateSectionEvents() $this->assertSame($updatedSection, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateSectionEventInterface::class, 0], - [UpdateSectionEventInterface::class, 0], + [BeforeUpdateSectionEvent::class, 0], + [UpdateSectionEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -117,8 +117,8 @@ public function testUpdateSectionEvents() public function testReturnUpdateSectionResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateSectionEventInterface::class, - UpdateSectionEventInterface::class + BeforeUpdateSectionEvent::class, + UpdateSectionEvent::class ); $parameters = [ @@ -131,7 +131,7 @@ public function testReturnUpdateSectionResultInBeforeEvents() $innerServiceMock = $this->createMock(SectionServiceInterface::class); $innerServiceMock->method('updateSection')->willReturn($updatedSection); - $traceableEventDispatcher->addListener(BeforeUpdateSectionEventInterface::class, function (BeforeUpdateSectionEventInterface $event) use ($eventUpdatedSection) { + $traceableEventDispatcher->addListener(BeforeUpdateSectionEvent::class, function (BeforeUpdateSectionEvent $event) use ($eventUpdatedSection) { $event->setUpdatedSection($eventUpdatedSection); }, 10); @@ -142,9 +142,9 @@ public function testReturnUpdateSectionResultInBeforeEvents() $this->assertSame($eventUpdatedSection, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateSectionEventInterface::class, 10], - [BeforeUpdateSectionEventInterface::class, 0], - [UpdateSectionEventInterface::class, 0], + [BeforeUpdateSectionEvent::class, 10], + [BeforeUpdateSectionEvent::class, 0], + [UpdateSectionEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -152,8 +152,8 @@ public function testReturnUpdateSectionResultInBeforeEvents() public function testUpdateSectionStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateSectionEventInterface::class, - UpdateSectionEventInterface::class + BeforeUpdateSectionEvent::class, + UpdateSectionEvent::class ); $parameters = [ @@ -166,7 +166,7 @@ public function testUpdateSectionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(SectionServiceInterface::class); $innerServiceMock->method('updateSection')->willReturn($updatedSection); - $traceableEventDispatcher->addListener(BeforeUpdateSectionEventInterface::class, function (BeforeUpdateSectionEventInterface $event) use ($eventUpdatedSection) { + $traceableEventDispatcher->addListener(BeforeUpdateSectionEvent::class, function (BeforeUpdateSectionEvent $event) use ($eventUpdatedSection) { $event->setUpdatedSection($eventUpdatedSection); $event->stopPropagation(); }, 10); @@ -179,19 +179,19 @@ public function testUpdateSectionStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedSection, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateSectionEventInterface::class, 10], + [BeforeUpdateSectionEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateSectionEventInterface::class, 0], - [UpdateSectionEventInterface::class, 0], + [BeforeUpdateSectionEvent::class, 0], + [UpdateSectionEvent::class, 0], ]); } public function testAssignSectionToSubtreeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAssignSectionToSubtreeEventInterface::class, - AssignSectionToSubtreeEventInterface::class + BeforeAssignSectionToSubtreeEvent::class, + AssignSectionToSubtreeEvent::class ); $parameters = [ @@ -207,8 +207,8 @@ public function testAssignSectionToSubtreeEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeAssignSectionToSubtreeEventInterface::class, 0], - [AssignSectionToSubtreeEventInterface::class, 0], + [BeforeAssignSectionToSubtreeEvent::class, 0], + [AssignSectionToSubtreeEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -216,8 +216,8 @@ public function testAssignSectionToSubtreeEvents() public function testAssignSectionToSubtreeStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAssignSectionToSubtreeEventInterface::class, - AssignSectionToSubtreeEventInterface::class + BeforeAssignSectionToSubtreeEvent::class, + AssignSectionToSubtreeEvent::class ); $parameters = [ @@ -227,7 +227,7 @@ public function testAssignSectionToSubtreeStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(SectionServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeAssignSectionToSubtreeEventInterface::class, function (BeforeAssignSectionToSubtreeEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeAssignSectionToSubtreeEvent::class, function (BeforeAssignSectionToSubtreeEvent $event) { $event->stopPropagation(); }, 10); @@ -238,19 +238,19 @@ public function testAssignSectionToSubtreeStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeAssignSectionToSubtreeEventInterface::class, 10], + [BeforeAssignSectionToSubtreeEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [AssignSectionToSubtreeEventInterface::class, 0], - [BeforeAssignSectionToSubtreeEventInterface::class, 0], + [AssignSectionToSubtreeEvent::class, 0], + [BeforeAssignSectionToSubtreeEvent::class, 0], ]); } public function testDeleteSectionEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteSectionEventInterface::class, - DeleteSectionEventInterface::class + BeforeDeleteSectionEvent::class, + DeleteSectionEvent::class ); $parameters = [ @@ -265,8 +265,8 @@ public function testDeleteSectionEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteSectionEventInterface::class, 0], - [DeleteSectionEventInterface::class, 0], + [BeforeDeleteSectionEvent::class, 0], + [DeleteSectionEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -274,8 +274,8 @@ public function testDeleteSectionEvents() public function testDeleteSectionStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteSectionEventInterface::class, - DeleteSectionEventInterface::class + BeforeDeleteSectionEvent::class, + DeleteSectionEvent::class ); $parameters = [ @@ -284,7 +284,7 @@ public function testDeleteSectionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(SectionServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteSectionEventInterface::class, function (BeforeDeleteSectionEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeDeleteSectionEvent::class, function (BeforeDeleteSectionEvent $event) { $event->stopPropagation(); }, 10); @@ -295,19 +295,19 @@ public function testDeleteSectionStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeDeleteSectionEventInterface::class, 10], + [BeforeDeleteSectionEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteSectionEventInterface::class, 0], - [DeleteSectionEventInterface::class, 0], + [BeforeDeleteSectionEvent::class, 0], + [DeleteSectionEvent::class, 0], ]); } public function testCreateSectionEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateSectionEventInterface::class, - CreateSectionEventInterface::class + BeforeCreateSectionEvent::class, + CreateSectionEvent::class ); $parameters = [ @@ -325,8 +325,8 @@ public function testCreateSectionEvents() $this->assertSame($section, $result); $this->assertSame($calledListeners, [ - [BeforeCreateSectionEventInterface::class, 0], - [CreateSectionEventInterface::class, 0], + [BeforeCreateSectionEvent::class, 0], + [CreateSectionEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -334,8 +334,8 @@ public function testCreateSectionEvents() public function testReturnCreateSectionResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateSectionEventInterface::class, - CreateSectionEventInterface::class + BeforeCreateSectionEvent::class, + CreateSectionEvent::class ); $parameters = [ @@ -347,7 +347,7 @@ public function testReturnCreateSectionResultInBeforeEvents() $innerServiceMock = $this->createMock(SectionServiceInterface::class); $innerServiceMock->method('createSection')->willReturn($section); - $traceableEventDispatcher->addListener(BeforeCreateSectionEventInterface::class, function (BeforeCreateSectionEventInterface $event) use ($eventSection) { + $traceableEventDispatcher->addListener(BeforeCreateSectionEvent::class, function (BeforeCreateSectionEvent $event) use ($eventSection) { $event->setSection($eventSection); }, 10); @@ -358,9 +358,9 @@ public function testReturnCreateSectionResultInBeforeEvents() $this->assertSame($eventSection, $result); $this->assertSame($calledListeners, [ - [BeforeCreateSectionEventInterface::class, 10], - [BeforeCreateSectionEventInterface::class, 0], - [CreateSectionEventInterface::class, 0], + [BeforeCreateSectionEvent::class, 10], + [BeforeCreateSectionEvent::class, 0], + [CreateSectionEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -368,8 +368,8 @@ public function testReturnCreateSectionResultInBeforeEvents() public function testCreateSectionStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateSectionEventInterface::class, - CreateSectionEventInterface::class + BeforeCreateSectionEvent::class, + CreateSectionEvent::class ); $parameters = [ @@ -381,7 +381,7 @@ public function testCreateSectionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(SectionServiceInterface::class); $innerServiceMock->method('createSection')->willReturn($section); - $traceableEventDispatcher->addListener(BeforeCreateSectionEventInterface::class, function (BeforeCreateSectionEventInterface $event) use ($eventSection) { + $traceableEventDispatcher->addListener(BeforeCreateSectionEvent::class, function (BeforeCreateSectionEvent $event) use ($eventSection) { $event->setSection($eventSection); $event->stopPropagation(); }, 10); @@ -394,11 +394,11 @@ public function testCreateSectionStopPropagationInBeforeEvents() $this->assertSame($eventSection, $result); $this->assertSame($calledListeners, [ - [BeforeCreateSectionEventInterface::class, 10], + [BeforeCreateSectionEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateSectionEventInterface::class, 0], - [CreateSectionEventInterface::class, 0], + [BeforeCreateSectionEvent::class, 0], + [CreateSectionEvent::class, 0], ]); } } diff --git a/eZ/Publish/Core/Event/Tests/TrashServiceTest.php b/eZ/Publish/Core/Event/Tests/TrashServiceTest.php index 3e445d5c756..68012fe77af 100644 --- a/eZ/Publish/Core/Event/Tests/TrashServiceTest.php +++ b/eZ/Publish/Core/Event/Tests/TrashServiceTest.php @@ -6,14 +6,14 @@ */ namespace eZ\Publish\Core\Event\Tests; -use eZ\Publish\API\Repository\Events\Trash\BeforeDeleteTrashItemEvent as BeforeDeleteTrashItemEventInterface; -use eZ\Publish\API\Repository\Events\Trash\BeforeEmptyTrashEvent as BeforeEmptyTrashEventInterface; -use eZ\Publish\API\Repository\Events\Trash\BeforeRecoverEvent as BeforeRecoverEventInterface; -use eZ\Publish\API\Repository\Events\Trash\BeforeTrashEvent as BeforeTrashEventInterface; -use eZ\Publish\API\Repository\Events\Trash\DeleteTrashItemEvent as DeleteTrashItemEventInterface; -use eZ\Publish\API\Repository\Events\Trash\EmptyTrashEvent as EmptyTrashEventInterface; -use eZ\Publish\API\Repository\Events\Trash\RecoverEvent as RecoverEventInterface; -use eZ\Publish\API\Repository\Events\Trash\TrashEvent as TrashEventInterface; +use eZ\Publish\API\Repository\Events\Trash\BeforeDeleteTrashItemEvent; +use eZ\Publish\API\Repository\Events\Trash\BeforeEmptyTrashEvent; +use eZ\Publish\API\Repository\Events\Trash\BeforeRecoverEvent; +use eZ\Publish\API\Repository\Events\Trash\BeforeTrashEvent; +use eZ\Publish\API\Repository\Events\Trash\DeleteTrashItemEvent; +use eZ\Publish\API\Repository\Events\Trash\EmptyTrashEvent; +use eZ\Publish\API\Repository\Events\Trash\RecoverEvent; +use eZ\Publish\API\Repository\Events\Trash\TrashEvent; use eZ\Publish\API\Repository\TrashService as TrashServiceInterface; use eZ\Publish\API\Repository\Values\Content\Location; use eZ\Publish\API\Repository\Values\Content\Trash\TrashItemDeleteResult; @@ -26,8 +26,8 @@ class TrashServiceTest extends AbstractServiceTest public function testEmptyTrashEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeEmptyTrashEventInterface::class, - EmptyTrashEventInterface::class + BeforeEmptyTrashEvent::class, + EmptyTrashEvent::class ); $parameters = [ @@ -44,8 +44,8 @@ public function testEmptyTrashEvents() $this->assertSame($resultList, $result); $this->assertSame($calledListeners, [ - [BeforeEmptyTrashEventInterface::class, 0], - [EmptyTrashEventInterface::class, 0], + [BeforeEmptyTrashEvent::class, 0], + [EmptyTrashEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -53,8 +53,8 @@ public function testEmptyTrashEvents() public function testReturnEmptyTrashResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeEmptyTrashEventInterface::class, - EmptyTrashEventInterface::class + BeforeEmptyTrashEvent::class, + EmptyTrashEvent::class ); $parameters = [ @@ -65,7 +65,7 @@ public function testReturnEmptyTrashResultInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('emptyTrash')->willReturn($resultList); - $traceableEventDispatcher->addListener(BeforeEmptyTrashEventInterface::class, function (BeforeEmptyTrashEventInterface $event) use ($eventResultList) { + $traceableEventDispatcher->addListener(BeforeEmptyTrashEvent::class, function (BeforeEmptyTrashEvent $event) use ($eventResultList) { $event->setResultList($eventResultList); }, 10); @@ -76,9 +76,9 @@ public function testReturnEmptyTrashResultInBeforeEvents() $this->assertSame($eventResultList, $result); $this->assertSame($calledListeners, [ - [BeforeEmptyTrashEventInterface::class, 10], - [BeforeEmptyTrashEventInterface::class, 0], - [EmptyTrashEventInterface::class, 0], + [BeforeEmptyTrashEvent::class, 10], + [BeforeEmptyTrashEvent::class, 0], + [EmptyTrashEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -86,8 +86,8 @@ public function testReturnEmptyTrashResultInBeforeEvents() public function testEmptyTrashStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeEmptyTrashEventInterface::class, - EmptyTrashEventInterface::class + BeforeEmptyTrashEvent::class, + EmptyTrashEvent::class ); $parameters = [ @@ -98,7 +98,7 @@ public function testEmptyTrashStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('emptyTrash')->willReturn($resultList); - $traceableEventDispatcher->addListener(BeforeEmptyTrashEventInterface::class, function (BeforeEmptyTrashEventInterface $event) use ($eventResultList) { + $traceableEventDispatcher->addListener(BeforeEmptyTrashEvent::class, function (BeforeEmptyTrashEvent $event) use ($eventResultList) { $event->setResultList($eventResultList); $event->stopPropagation(); }, 10); @@ -111,19 +111,19 @@ public function testEmptyTrashStopPropagationInBeforeEvents() $this->assertSame($eventResultList, $result); $this->assertSame($calledListeners, [ - [BeforeEmptyTrashEventInterface::class, 10], + [BeforeEmptyTrashEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeEmptyTrashEventInterface::class, 0], - [EmptyTrashEventInterface::class, 0], + [BeforeEmptyTrashEvent::class, 0], + [EmptyTrashEvent::class, 0], ]); } public function testTrashEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeTrashEventInterface::class, - TrashEventInterface::class + BeforeTrashEvent::class, + TrashEvent::class ); $parameters = [ @@ -141,8 +141,8 @@ public function testTrashEvents() $this->assertSame($trashItem, $result); $this->assertSame($calledListeners, [ - [BeforeTrashEventInterface::class, 0], - [TrashEventInterface::class, 0], + [BeforeTrashEvent::class, 0], + [TrashEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -150,8 +150,8 @@ public function testTrashEvents() public function testReturnTrashResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeTrashEventInterface::class, - TrashEventInterface::class + BeforeTrashEvent::class, + TrashEvent::class ); $parameters = [ @@ -163,7 +163,7 @@ public function testReturnTrashResultInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('trash')->willReturn($trashItem); - $traceableEventDispatcher->addListener(BeforeTrashEventInterface::class, function (BeforeTrashEventInterface $event) use ($eventTrashItem) { + $traceableEventDispatcher->addListener(BeforeTrashEvent::class, function (BeforeTrashEvent $event) use ($eventTrashItem) { $event->setResult($eventTrashItem); }, 10); @@ -174,9 +174,9 @@ public function testReturnTrashResultInBeforeEvents() $this->assertSame($eventTrashItem, $result); $this->assertSame($calledListeners, [ - [BeforeTrashEventInterface::class, 10], - [BeforeTrashEventInterface::class, 0], - [TrashEventInterface::class, 0], + [BeforeTrashEvent::class, 10], + [BeforeTrashEvent::class, 0], + [TrashEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -184,8 +184,8 @@ public function testReturnTrashResultInBeforeEvents() public function testTrashStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeTrashEventInterface::class, - TrashEventInterface::class + BeforeTrashEvent::class, + TrashEvent::class ); $parameters = [ @@ -197,7 +197,7 @@ public function testTrashStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('trash')->willReturn($trashItem); - $traceableEventDispatcher->addListener(BeforeTrashEventInterface::class, function (BeforeTrashEventInterface $event) use ($eventTrashItem) { + $traceableEventDispatcher->addListener(BeforeTrashEvent::class, function (BeforeTrashEvent $event) use ($eventTrashItem) { $event->setResult($eventTrashItem); $event->stopPropagation(); }, 10); @@ -210,19 +210,19 @@ public function testTrashStopPropagationInBeforeEvents() $this->assertSame($eventTrashItem, $result); $this->assertSame($calledListeners, [ - [BeforeTrashEventInterface::class, 10], + [BeforeTrashEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeTrashEventInterface::class, 0], - [TrashEventInterface::class, 0], + [BeforeTrashEvent::class, 0], + [TrashEvent::class, 0], ]); } public function testRecoverEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRecoverEventInterface::class, - RecoverEventInterface::class + BeforeRecoverEvent::class, + RecoverEvent::class ); $parameters = [ @@ -241,8 +241,8 @@ public function testRecoverEvents() $this->assertSame($location, $result); $this->assertSame($calledListeners, [ - [BeforeRecoverEventInterface::class, 0], - [RecoverEventInterface::class, 0], + [BeforeRecoverEvent::class, 0], + [RecoverEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -250,8 +250,8 @@ public function testRecoverEvents() public function testReturnRecoverResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRecoverEventInterface::class, - RecoverEventInterface::class + BeforeRecoverEvent::class, + RecoverEvent::class ); $parameters = [ @@ -264,7 +264,7 @@ public function testReturnRecoverResultInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('recover')->willReturn($location); - $traceableEventDispatcher->addListener(BeforeRecoverEventInterface::class, function (BeforeRecoverEventInterface $event) use ($eventLocation) { + $traceableEventDispatcher->addListener(BeforeRecoverEvent::class, function (BeforeRecoverEvent $event) use ($eventLocation) { $event->setLocation($eventLocation); }, 10); @@ -275,9 +275,9 @@ public function testReturnRecoverResultInBeforeEvents() $this->assertSame($eventLocation, $result); $this->assertSame($calledListeners, [ - [BeforeRecoverEventInterface::class, 10], - [BeforeRecoverEventInterface::class, 0], - [RecoverEventInterface::class, 0], + [BeforeRecoverEvent::class, 10], + [BeforeRecoverEvent::class, 0], + [RecoverEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -285,8 +285,8 @@ public function testReturnRecoverResultInBeforeEvents() public function testRecoverStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRecoverEventInterface::class, - RecoverEventInterface::class + BeforeRecoverEvent::class, + RecoverEvent::class ); $parameters = [ @@ -299,7 +299,7 @@ public function testRecoverStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('recover')->willReturn($location); - $traceableEventDispatcher->addListener(BeforeRecoverEventInterface::class, function (BeforeRecoverEventInterface $event) use ($eventLocation) { + $traceableEventDispatcher->addListener(BeforeRecoverEvent::class, function (BeforeRecoverEvent $event) use ($eventLocation) { $event->setLocation($eventLocation); $event->stopPropagation(); }, 10); @@ -312,19 +312,19 @@ public function testRecoverStopPropagationInBeforeEvents() $this->assertSame($eventLocation, $result); $this->assertSame($calledListeners, [ - [BeforeRecoverEventInterface::class, 10], + [BeforeRecoverEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeRecoverEventInterface::class, 0], - [RecoverEventInterface::class, 0], + [BeforeRecoverEvent::class, 0], + [RecoverEvent::class, 0], ]); } public function testDeleteTrashItemEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteTrashItemEventInterface::class, - DeleteTrashItemEventInterface::class + BeforeDeleteTrashItemEvent::class, + DeleteTrashItemEvent::class ); $parameters = [ @@ -342,8 +342,8 @@ public function testDeleteTrashItemEvents() $this->assertSame($result, $result); $this->assertSame($calledListeners, [ - [BeforeDeleteTrashItemEventInterface::class, 0], - [DeleteTrashItemEventInterface::class, 0], + [BeforeDeleteTrashItemEvent::class, 0], + [DeleteTrashItemEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -351,8 +351,8 @@ public function testDeleteTrashItemEvents() public function testReturnDeleteTrashItemResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteTrashItemEventInterface::class, - DeleteTrashItemEventInterface::class + BeforeDeleteTrashItemEvent::class, + DeleteTrashItemEvent::class ); $parameters = [ @@ -364,7 +364,7 @@ public function testReturnDeleteTrashItemResultInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('deleteTrashItem')->willReturn($result); - $traceableEventDispatcher->addListener(BeforeDeleteTrashItemEventInterface::class, function (BeforeDeleteTrashItemEventInterface $event) use ($eventResult) { + $traceableEventDispatcher->addListener(BeforeDeleteTrashItemEvent::class, function (BeforeDeleteTrashItemEvent $event) use ($eventResult) { $event->setResult($eventResult); }, 10); @@ -375,9 +375,9 @@ public function testReturnDeleteTrashItemResultInBeforeEvents() $this->assertSame($eventResult, $result); $this->assertSame($calledListeners, [ - [BeforeDeleteTrashItemEventInterface::class, 10], - [BeforeDeleteTrashItemEventInterface::class, 0], - [DeleteTrashItemEventInterface::class, 0], + [BeforeDeleteTrashItemEvent::class, 10], + [BeforeDeleteTrashItemEvent::class, 0], + [DeleteTrashItemEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -385,8 +385,8 @@ public function testReturnDeleteTrashItemResultInBeforeEvents() public function testDeleteTrashItemStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteTrashItemEventInterface::class, - DeleteTrashItemEventInterface::class + BeforeDeleteTrashItemEvent::class, + DeleteTrashItemEvent::class ); $parameters = [ @@ -398,7 +398,7 @@ public function testDeleteTrashItemStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('deleteTrashItem')->willReturn($result); - $traceableEventDispatcher->addListener(BeforeDeleteTrashItemEventInterface::class, function (BeforeDeleteTrashItemEventInterface $event) use ($eventResult) { + $traceableEventDispatcher->addListener(BeforeDeleteTrashItemEvent::class, function (BeforeDeleteTrashItemEvent $event) use ($eventResult) { $event->setResult($eventResult); $event->stopPropagation(); }, 10); @@ -411,11 +411,11 @@ public function testDeleteTrashItemStopPropagationInBeforeEvents() $this->assertSame($eventResult, $result); $this->assertSame($calledListeners, [ - [BeforeDeleteTrashItemEventInterface::class, 10], + [BeforeDeleteTrashItemEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteTrashItemEventInterface::class, 0], - [DeleteTrashItemEventInterface::class, 0], + [BeforeDeleteTrashItemEvent::class, 0], + [DeleteTrashItemEvent::class, 0], ]); } } diff --git a/eZ/Publish/Core/Event/Tests/URLAliasServiceTest.php b/eZ/Publish/Core/Event/Tests/URLAliasServiceTest.php index a7320b0d108..ee1e8dd49fd 100644 --- a/eZ/Publish/Core/Event/Tests/URLAliasServiceTest.php +++ b/eZ/Publish/Core/Event/Tests/URLAliasServiceTest.php @@ -6,14 +6,14 @@ */ namespace eZ\Publish\Core\Event\Tests; -use eZ\Publish\API\Repository\Events\URLAlias\BeforeCreateGlobalUrlAliasEvent as BeforeCreateGlobalUrlAliasEventInterface; -use eZ\Publish\API\Repository\Events\URLAlias\BeforeCreateUrlAliasEvent as BeforeCreateUrlAliasEventInterface; -use eZ\Publish\API\Repository\Events\URLAlias\BeforeRefreshSystemUrlAliasesForLocationEvent as BeforeRefreshSystemUrlAliasesForLocationEventInterface; -use eZ\Publish\API\Repository\Events\URLAlias\BeforeRemoveAliasesEvent as BeforeRemoveAliasesEventInterface; -use eZ\Publish\API\Repository\Events\URLAlias\CreateGlobalUrlAliasEvent as CreateGlobalUrlAliasEventInterface; -use eZ\Publish\API\Repository\Events\URLAlias\CreateUrlAliasEvent as CreateUrlAliasEventInterface; -use eZ\Publish\API\Repository\Events\URLAlias\RefreshSystemUrlAliasesForLocationEvent as RefreshSystemUrlAliasesForLocationEventInterface; -use eZ\Publish\API\Repository\Events\URLAlias\RemoveAliasesEvent as RemoveAliasesEventInterface; +use eZ\Publish\API\Repository\Events\URLAlias\BeforeCreateGlobalUrlAliasEvent; +use eZ\Publish\API\Repository\Events\URLAlias\BeforeCreateUrlAliasEvent; +use eZ\Publish\API\Repository\Events\URLAlias\BeforeRefreshSystemUrlAliasesForLocationEvent; +use eZ\Publish\API\Repository\Events\URLAlias\BeforeRemoveAliasesEvent; +use eZ\Publish\API\Repository\Events\URLAlias\CreateGlobalUrlAliasEvent; +use eZ\Publish\API\Repository\Events\URLAlias\CreateUrlAliasEvent; +use eZ\Publish\API\Repository\Events\URLAlias\RefreshSystemUrlAliasesForLocationEvent; +use eZ\Publish\API\Repository\Events\URLAlias\RemoveAliasesEvent; use eZ\Publish\API\Repository\URLAliasService as URLAliasServiceInterface; use eZ\Publish\API\Repository\Values\Content\Location; use eZ\Publish\API\Repository\Values\Content\URLAlias; @@ -24,8 +24,8 @@ class URLAliasServiceTest extends AbstractServiceTest public function testCreateGlobalUrlAliasEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateGlobalUrlAliasEventInterface::class, - CreateGlobalUrlAliasEventInterface::class + BeforeCreateGlobalUrlAliasEvent::class, + CreateGlobalUrlAliasEvent::class ); $parameters = [ @@ -47,8 +47,8 @@ public function testCreateGlobalUrlAliasEvents() $this->assertSame($urlAlias, $result); $this->assertSame($calledListeners, [ - [BeforeCreateGlobalUrlAliasEventInterface::class, 0], - [CreateGlobalUrlAliasEventInterface::class, 0], + [BeforeCreateGlobalUrlAliasEvent::class, 0], + [CreateGlobalUrlAliasEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -56,8 +56,8 @@ public function testCreateGlobalUrlAliasEvents() public function testReturnCreateGlobalUrlAliasResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateGlobalUrlAliasEventInterface::class, - CreateGlobalUrlAliasEventInterface::class + BeforeCreateGlobalUrlAliasEvent::class, + CreateGlobalUrlAliasEvent::class ); $parameters = [ @@ -73,7 +73,7 @@ public function testReturnCreateGlobalUrlAliasResultInBeforeEvents() $innerServiceMock = $this->createMock(URLAliasServiceInterface::class); $innerServiceMock->method('createGlobalUrlAlias')->willReturn($urlAlias); - $traceableEventDispatcher->addListener(BeforeCreateGlobalUrlAliasEventInterface::class, function (BeforeCreateGlobalUrlAliasEventInterface $event) use ($eventUrlAlias) { + $traceableEventDispatcher->addListener(BeforeCreateGlobalUrlAliasEvent::class, function (BeforeCreateGlobalUrlAliasEvent $event) use ($eventUrlAlias) { $event->setUrlAlias($eventUrlAlias); }, 10); @@ -84,9 +84,9 @@ public function testReturnCreateGlobalUrlAliasResultInBeforeEvents() $this->assertSame($eventUrlAlias, $result); $this->assertSame($calledListeners, [ - [BeforeCreateGlobalUrlAliasEventInterface::class, 10], - [BeforeCreateGlobalUrlAliasEventInterface::class, 0], - [CreateGlobalUrlAliasEventInterface::class, 0], + [BeforeCreateGlobalUrlAliasEvent::class, 10], + [BeforeCreateGlobalUrlAliasEvent::class, 0], + [CreateGlobalUrlAliasEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -94,8 +94,8 @@ public function testReturnCreateGlobalUrlAliasResultInBeforeEvents() public function testCreateGlobalUrlAliasStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateGlobalUrlAliasEventInterface::class, - CreateGlobalUrlAliasEventInterface::class + BeforeCreateGlobalUrlAliasEvent::class, + CreateGlobalUrlAliasEvent::class ); $parameters = [ @@ -111,7 +111,7 @@ public function testCreateGlobalUrlAliasStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(URLAliasServiceInterface::class); $innerServiceMock->method('createGlobalUrlAlias')->willReturn($urlAlias); - $traceableEventDispatcher->addListener(BeforeCreateGlobalUrlAliasEventInterface::class, function (BeforeCreateGlobalUrlAliasEventInterface $event) use ($eventUrlAlias) { + $traceableEventDispatcher->addListener(BeforeCreateGlobalUrlAliasEvent::class, function (BeforeCreateGlobalUrlAliasEvent $event) use ($eventUrlAlias) { $event->setUrlAlias($eventUrlAlias); $event->stopPropagation(); }, 10); @@ -124,19 +124,19 @@ public function testCreateGlobalUrlAliasStopPropagationInBeforeEvents() $this->assertSame($eventUrlAlias, $result); $this->assertSame($calledListeners, [ - [BeforeCreateGlobalUrlAliasEventInterface::class, 10], + [BeforeCreateGlobalUrlAliasEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateGlobalUrlAliasEventInterface::class, 0], - [CreateGlobalUrlAliasEventInterface::class, 0], + [BeforeCreateGlobalUrlAliasEvent::class, 0], + [CreateGlobalUrlAliasEvent::class, 0], ]); } public function testRefreshSystemUrlAliasesForLocationEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRefreshSystemUrlAliasesForLocationEventInterface::class, - RefreshSystemUrlAliasesForLocationEventInterface::class + BeforeRefreshSystemUrlAliasesForLocationEvent::class, + RefreshSystemUrlAliasesForLocationEvent::class ); $parameters = [ @@ -151,8 +151,8 @@ public function testRefreshSystemUrlAliasesForLocationEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeRefreshSystemUrlAliasesForLocationEventInterface::class, 0], - [RefreshSystemUrlAliasesForLocationEventInterface::class, 0], + [BeforeRefreshSystemUrlAliasesForLocationEvent::class, 0], + [RefreshSystemUrlAliasesForLocationEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -160,8 +160,8 @@ public function testRefreshSystemUrlAliasesForLocationEvents() public function testRefreshSystemUrlAliasesForLocationStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRefreshSystemUrlAliasesForLocationEventInterface::class, - RefreshSystemUrlAliasesForLocationEventInterface::class + BeforeRefreshSystemUrlAliasesForLocationEvent::class, + RefreshSystemUrlAliasesForLocationEvent::class ); $parameters = [ @@ -170,7 +170,7 @@ public function testRefreshSystemUrlAliasesForLocationStopPropagationInBeforeEve $innerServiceMock = $this->createMock(URLAliasServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeRefreshSystemUrlAliasesForLocationEventInterface::class, function (BeforeRefreshSystemUrlAliasesForLocationEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeRefreshSystemUrlAliasesForLocationEvent::class, function (BeforeRefreshSystemUrlAliasesForLocationEvent $event) { $event->stopPropagation(); }, 10); @@ -181,19 +181,19 @@ public function testRefreshSystemUrlAliasesForLocationStopPropagationInBeforeEve $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeRefreshSystemUrlAliasesForLocationEventInterface::class, 10], + [BeforeRefreshSystemUrlAliasesForLocationEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeRefreshSystemUrlAliasesForLocationEventInterface::class, 0], - [RefreshSystemUrlAliasesForLocationEventInterface::class, 0], + [BeforeRefreshSystemUrlAliasesForLocationEvent::class, 0], + [RefreshSystemUrlAliasesForLocationEvent::class, 0], ]); } public function testCreateUrlAliasEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateUrlAliasEventInterface::class, - CreateUrlAliasEventInterface::class + BeforeCreateUrlAliasEvent::class, + CreateUrlAliasEvent::class ); $parameters = [ @@ -215,8 +215,8 @@ public function testCreateUrlAliasEvents() $this->assertSame($urlAlias, $result); $this->assertSame($calledListeners, [ - [BeforeCreateUrlAliasEventInterface::class, 0], - [CreateUrlAliasEventInterface::class, 0], + [BeforeCreateUrlAliasEvent::class, 0], + [CreateUrlAliasEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -224,8 +224,8 @@ public function testCreateUrlAliasEvents() public function testReturnCreateUrlAliasResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateUrlAliasEventInterface::class, - CreateUrlAliasEventInterface::class + BeforeCreateUrlAliasEvent::class, + CreateUrlAliasEvent::class ); $parameters = [ @@ -241,7 +241,7 @@ public function testReturnCreateUrlAliasResultInBeforeEvents() $innerServiceMock = $this->createMock(URLAliasServiceInterface::class); $innerServiceMock->method('createUrlAlias')->willReturn($urlAlias); - $traceableEventDispatcher->addListener(BeforeCreateUrlAliasEventInterface::class, function (BeforeCreateUrlAliasEventInterface $event) use ($eventUrlAlias) { + $traceableEventDispatcher->addListener(BeforeCreateUrlAliasEvent::class, function (BeforeCreateUrlAliasEvent $event) use ($eventUrlAlias) { $event->setUrlAlias($eventUrlAlias); }, 10); @@ -252,9 +252,9 @@ public function testReturnCreateUrlAliasResultInBeforeEvents() $this->assertSame($eventUrlAlias, $result); $this->assertSame($calledListeners, [ - [BeforeCreateUrlAliasEventInterface::class, 10], - [BeforeCreateUrlAliasEventInterface::class, 0], - [CreateUrlAliasEventInterface::class, 0], + [BeforeCreateUrlAliasEvent::class, 10], + [BeforeCreateUrlAliasEvent::class, 0], + [CreateUrlAliasEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -262,8 +262,8 @@ public function testReturnCreateUrlAliasResultInBeforeEvents() public function testCreateUrlAliasStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateUrlAliasEventInterface::class, - CreateUrlAliasEventInterface::class + BeforeCreateUrlAliasEvent::class, + CreateUrlAliasEvent::class ); $parameters = [ @@ -279,7 +279,7 @@ public function testCreateUrlAliasStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(URLAliasServiceInterface::class); $innerServiceMock->method('createUrlAlias')->willReturn($urlAlias); - $traceableEventDispatcher->addListener(BeforeCreateUrlAliasEventInterface::class, function (BeforeCreateUrlAliasEventInterface $event) use ($eventUrlAlias) { + $traceableEventDispatcher->addListener(BeforeCreateUrlAliasEvent::class, function (BeforeCreateUrlAliasEvent $event) use ($eventUrlAlias) { $event->setUrlAlias($eventUrlAlias); $event->stopPropagation(); }, 10); @@ -292,19 +292,19 @@ public function testCreateUrlAliasStopPropagationInBeforeEvents() $this->assertSame($eventUrlAlias, $result); $this->assertSame($calledListeners, [ - [BeforeCreateUrlAliasEventInterface::class, 10], + [BeforeCreateUrlAliasEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateUrlAliasEventInterface::class, 0], - [CreateUrlAliasEventInterface::class, 0], + [BeforeCreateUrlAliasEvent::class, 0], + [CreateUrlAliasEvent::class, 0], ]); } public function testRemoveAliasesEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRemoveAliasesEventInterface::class, - RemoveAliasesEventInterface::class + BeforeRemoveAliasesEvent::class, + RemoveAliasesEvent::class ); $parameters = [ @@ -319,8 +319,8 @@ public function testRemoveAliasesEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeRemoveAliasesEventInterface::class, 0], - [RemoveAliasesEventInterface::class, 0], + [BeforeRemoveAliasesEvent::class, 0], + [RemoveAliasesEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -328,8 +328,8 @@ public function testRemoveAliasesEvents() public function testRemoveAliasesStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRemoveAliasesEventInterface::class, - RemoveAliasesEventInterface::class + BeforeRemoveAliasesEvent::class, + RemoveAliasesEvent::class ); $parameters = [ @@ -338,7 +338,7 @@ public function testRemoveAliasesStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(URLAliasServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeRemoveAliasesEventInterface::class, function (BeforeRemoveAliasesEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeRemoveAliasesEvent::class, function (BeforeRemoveAliasesEvent $event) { $event->stopPropagation(); }, 10); @@ -349,11 +349,11 @@ public function testRemoveAliasesStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeRemoveAliasesEventInterface::class, 10], + [BeforeRemoveAliasesEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeRemoveAliasesEventInterface::class, 0], - [RemoveAliasesEventInterface::class, 0], + [BeforeRemoveAliasesEvent::class, 0], + [RemoveAliasesEvent::class, 0], ]); } } diff --git a/eZ/Publish/Core/Event/Tests/URLServiceTest.php b/eZ/Publish/Core/Event/Tests/URLServiceTest.php index add1cb2eb92..12d2afd9188 100644 --- a/eZ/Publish/Core/Event/Tests/URLServiceTest.php +++ b/eZ/Publish/Core/Event/Tests/URLServiceTest.php @@ -6,8 +6,8 @@ */ namespace eZ\Publish\Core\Event\Tests; -use eZ\Publish\API\Repository\Events\URL\BeforeUpdateUrlEvent as BeforeUpdateUrlEventInterface; -use eZ\Publish\API\Repository\Events\URL\UpdateUrlEvent as UpdateUrlEventInterface; +use eZ\Publish\API\Repository\Events\URL\BeforeUpdateUrlEvent; +use eZ\Publish\API\Repository\Events\URL\UpdateUrlEvent; use eZ\Publish\API\Repository\URLService as URLServiceInterface; use eZ\Publish\API\Repository\Values\URL\URL; use eZ\Publish\API\Repository\Values\URL\URLUpdateStruct; @@ -18,8 +18,8 @@ class URLServiceTest extends AbstractServiceTest public function testUpdateUrlEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateUrlEventInterface::class, - UpdateUrlEventInterface::class + BeforeUpdateUrlEvent::class, + UpdateUrlEvent::class ); $parameters = [ @@ -38,8 +38,8 @@ public function testUpdateUrlEvents() $this->assertSame($updatedUrl, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateUrlEventInterface::class, 0], - [UpdateUrlEventInterface::class, 0], + [BeforeUpdateUrlEvent::class, 0], + [UpdateUrlEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -47,8 +47,8 @@ public function testUpdateUrlEvents() public function testReturnUpdateUrlResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateUrlEventInterface::class, - UpdateUrlEventInterface::class + BeforeUpdateUrlEvent::class, + UpdateUrlEvent::class ); $parameters = [ @@ -61,7 +61,7 @@ public function testReturnUpdateUrlResultInBeforeEvents() $innerServiceMock = $this->createMock(URLServiceInterface::class); $innerServiceMock->method('updateUrl')->willReturn($updatedUrl); - $traceableEventDispatcher->addListener(BeforeUpdateUrlEventInterface::class, function (BeforeUpdateUrlEventInterface $event) use ($eventUpdatedUrl) { + $traceableEventDispatcher->addListener(BeforeUpdateUrlEvent::class, function (BeforeUpdateUrlEvent $event) use ($eventUpdatedUrl) { $event->setUpdatedUrl($eventUpdatedUrl); }, 10); @@ -72,9 +72,9 @@ public function testReturnUpdateUrlResultInBeforeEvents() $this->assertSame($eventUpdatedUrl, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateUrlEventInterface::class, 10], - [BeforeUpdateUrlEventInterface::class, 0], - [UpdateUrlEventInterface::class, 0], + [BeforeUpdateUrlEvent::class, 10], + [BeforeUpdateUrlEvent::class, 0], + [UpdateUrlEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -82,8 +82,8 @@ public function testReturnUpdateUrlResultInBeforeEvents() public function testUpdateUrlStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateUrlEventInterface::class, - UpdateUrlEventInterface::class + BeforeUpdateUrlEvent::class, + UpdateUrlEvent::class ); $parameters = [ @@ -96,7 +96,7 @@ public function testUpdateUrlStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(URLServiceInterface::class); $innerServiceMock->method('updateUrl')->willReturn($updatedUrl); - $traceableEventDispatcher->addListener(BeforeUpdateUrlEventInterface::class, function (BeforeUpdateUrlEventInterface $event) use ($eventUpdatedUrl) { + $traceableEventDispatcher->addListener(BeforeUpdateUrlEvent::class, function (BeforeUpdateUrlEvent $event) use ($eventUpdatedUrl) { $event->setUpdatedUrl($eventUpdatedUrl); $event->stopPropagation(); }, 10); @@ -109,11 +109,11 @@ public function testUpdateUrlStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedUrl, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateUrlEventInterface::class, 10], + [BeforeUpdateUrlEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateUrlEventInterface::class, 0], - [UpdateUrlEventInterface::class, 0], + [BeforeUpdateUrlEvent::class, 0], + [UpdateUrlEvent::class, 0], ]); } } diff --git a/eZ/Publish/Core/Event/Tests/URLWildcardServiceTest.php b/eZ/Publish/Core/Event/Tests/URLWildcardServiceTest.php index fd6ef10a85e..ac6f7b25537 100644 --- a/eZ/Publish/Core/Event/Tests/URLWildcardServiceTest.php +++ b/eZ/Publish/Core/Event/Tests/URLWildcardServiceTest.php @@ -6,12 +6,12 @@ */ namespace eZ\Publish\Core\Event\Tests; -use eZ\Publish\API\Repository\Events\URLWildcard\BeforeCreateEvent as BeforeCreateEventInterface; -use eZ\Publish\API\Repository\Events\URLWildcard\BeforeRemoveEvent as BeforeRemoveEventInterface; -use eZ\Publish\API\Repository\Events\URLWildcard\BeforeTranslateEvent as BeforeTranslateEventInterface; -use eZ\Publish\API\Repository\Events\URLWildcard\CreateEvent as CreateEventInterface; -use eZ\Publish\API\Repository\Events\URLWildcard\RemoveEvent as RemoveEventInterface; -use eZ\Publish\API\Repository\Events\URLWildcard\TranslateEvent as TranslateEventInterface; +use eZ\Publish\API\Repository\Events\URLWildcard\BeforeCreateEvent; +use eZ\Publish\API\Repository\Events\URLWildcard\BeforeRemoveEvent; +use eZ\Publish\API\Repository\Events\URLWildcard\BeforeTranslateEvent; +use eZ\Publish\API\Repository\Events\URLWildcard\CreateEvent; +use eZ\Publish\API\Repository\Events\URLWildcard\RemoveEvent; +use eZ\Publish\API\Repository\Events\URLWildcard\TranslateEvent; use eZ\Publish\API\Repository\URLWildcardService as URLWildcardServiceInterface; use eZ\Publish\API\Repository\Values\Content\URLWildcard; use eZ\Publish\API\Repository\Values\Content\URLWildcardTranslationResult; @@ -22,8 +22,8 @@ class URLWildcardServiceTest extends AbstractServiceTest public function testRemoveEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRemoveEventInterface::class, - RemoveEventInterface::class + BeforeRemoveEvent::class, + RemoveEvent::class ); $parameters = [ @@ -38,8 +38,8 @@ public function testRemoveEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeRemoveEventInterface::class, 0], - [RemoveEventInterface::class, 0], + [BeforeRemoveEvent::class, 0], + [RemoveEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -47,8 +47,8 @@ public function testRemoveEvents() public function testRemoveStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeRemoveEventInterface::class, - RemoveEventInterface::class + BeforeRemoveEvent::class, + RemoveEvent::class ); $parameters = [ @@ -57,7 +57,7 @@ public function testRemoveStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(URLWildcardServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeRemoveEventInterface::class, function (BeforeRemoveEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeRemoveEvent::class, function (BeforeRemoveEvent $event) { $event->stopPropagation(); }, 10); @@ -68,19 +68,19 @@ public function testRemoveStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeRemoveEventInterface::class, 10], + [BeforeRemoveEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeRemoveEventInterface::class, 0], - [RemoveEventInterface::class, 0], + [BeforeRemoveEvent::class, 0], + [RemoveEvent::class, 0], ]); } public function testCreateEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateEventInterface::class, - CreateEventInterface::class + BeforeCreateEvent::class, + CreateEvent::class ); $parameters = [ @@ -100,8 +100,8 @@ public function testCreateEvents() $this->assertSame($urlWildcard, $result); $this->assertSame($calledListeners, [ - [BeforeCreateEventInterface::class, 0], - [CreateEventInterface::class, 0], + [BeforeCreateEvent::class, 0], + [CreateEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -109,8 +109,8 @@ public function testCreateEvents() public function testReturnCreateResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateEventInterface::class, - CreateEventInterface::class + BeforeCreateEvent::class, + CreateEvent::class ); $parameters = [ @@ -124,7 +124,7 @@ public function testReturnCreateResultInBeforeEvents() $innerServiceMock = $this->createMock(URLWildcardServiceInterface::class); $innerServiceMock->method('create')->willReturn($urlWildcard); - $traceableEventDispatcher->addListener(BeforeCreateEventInterface::class, function (BeforeCreateEventInterface $event) use ($eventUrlWildcard) { + $traceableEventDispatcher->addListener(BeforeCreateEvent::class, function (BeforeCreateEvent $event) use ($eventUrlWildcard) { $event->setUrlWildcard($eventUrlWildcard); }, 10); @@ -135,9 +135,9 @@ public function testReturnCreateResultInBeforeEvents() $this->assertSame($eventUrlWildcard, $result); $this->assertSame($calledListeners, [ - [BeforeCreateEventInterface::class, 10], - [BeforeCreateEventInterface::class, 0], - [CreateEventInterface::class, 0], + [BeforeCreateEvent::class, 10], + [BeforeCreateEvent::class, 0], + [CreateEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -145,8 +145,8 @@ public function testReturnCreateResultInBeforeEvents() public function testCreateStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateEventInterface::class, - CreateEventInterface::class + BeforeCreateEvent::class, + CreateEvent::class ); $parameters = [ @@ -160,7 +160,7 @@ public function testCreateStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(URLWildcardServiceInterface::class); $innerServiceMock->method('create')->willReturn($urlWildcard); - $traceableEventDispatcher->addListener(BeforeCreateEventInterface::class, function (BeforeCreateEventInterface $event) use ($eventUrlWildcard) { + $traceableEventDispatcher->addListener(BeforeCreateEvent::class, function (BeforeCreateEvent $event) use ($eventUrlWildcard) { $event->setUrlWildcard($eventUrlWildcard); $event->stopPropagation(); }, 10); @@ -173,19 +173,19 @@ public function testCreateStopPropagationInBeforeEvents() $this->assertSame($eventUrlWildcard, $result); $this->assertSame($calledListeners, [ - [BeforeCreateEventInterface::class, 10], + [BeforeCreateEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateEventInterface::class, 0], - [CreateEventInterface::class, 0], + [BeforeCreateEvent::class, 0], + [CreateEvent::class, 0], ]); } public function testTranslateEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeTranslateEventInterface::class, - TranslateEventInterface::class + BeforeTranslateEvent::class, + TranslateEvent::class ); $parameters = [ @@ -203,8 +203,8 @@ public function testTranslateEvents() $this->assertSame($result, $result); $this->assertSame($calledListeners, [ - [BeforeTranslateEventInterface::class, 0], - [TranslateEventInterface::class, 0], + [BeforeTranslateEvent::class, 0], + [TranslateEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -212,8 +212,8 @@ public function testTranslateEvents() public function testReturnTranslateResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeTranslateEventInterface::class, - TranslateEventInterface::class + BeforeTranslateEvent::class, + TranslateEvent::class ); $parameters = [ @@ -225,7 +225,7 @@ public function testReturnTranslateResultInBeforeEvents() $innerServiceMock = $this->createMock(URLWildcardServiceInterface::class); $innerServiceMock->method('translate')->willReturn($result); - $traceableEventDispatcher->addListener(BeforeTranslateEventInterface::class, function (BeforeTranslateEventInterface $event) use ($eventResult) { + $traceableEventDispatcher->addListener(BeforeTranslateEvent::class, function (BeforeTranslateEvent $event) use ($eventResult) { $event->setResult($eventResult); }, 10); @@ -236,9 +236,9 @@ public function testReturnTranslateResultInBeforeEvents() $this->assertSame($eventResult, $result); $this->assertSame($calledListeners, [ - [BeforeTranslateEventInterface::class, 10], - [BeforeTranslateEventInterface::class, 0], - [TranslateEventInterface::class, 0], + [BeforeTranslateEvent::class, 10], + [BeforeTranslateEvent::class, 0], + [TranslateEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -246,8 +246,8 @@ public function testReturnTranslateResultInBeforeEvents() public function testTranslateStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeTranslateEventInterface::class, - TranslateEventInterface::class + BeforeTranslateEvent::class, + TranslateEvent::class ); $parameters = [ @@ -259,7 +259,7 @@ public function testTranslateStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(URLWildcardServiceInterface::class); $innerServiceMock->method('translate')->willReturn($result); - $traceableEventDispatcher->addListener(BeforeTranslateEventInterface::class, function (BeforeTranslateEventInterface $event) use ($eventResult) { + $traceableEventDispatcher->addListener(BeforeTranslateEvent::class, function (BeforeTranslateEvent $event) use ($eventResult) { $event->setResult($eventResult); $event->stopPropagation(); }, 10); @@ -272,11 +272,11 @@ public function testTranslateStopPropagationInBeforeEvents() $this->assertSame($eventResult, $result); $this->assertSame($calledListeners, [ - [BeforeTranslateEventInterface::class, 10], + [BeforeTranslateEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeTranslateEventInterface::class, 0], - [TranslateEventInterface::class, 0], + [BeforeTranslateEvent::class, 0], + [TranslateEvent::class, 0], ]); } } diff --git a/eZ/Publish/Core/Event/Tests/UserPreferenceServiceTest.php b/eZ/Publish/Core/Event/Tests/UserPreferenceServiceTest.php index 79a0cffb283..7c03287d2bb 100644 --- a/eZ/Publish/Core/Event/Tests/UserPreferenceServiceTest.php +++ b/eZ/Publish/Core/Event/Tests/UserPreferenceServiceTest.php @@ -6,8 +6,8 @@ */ namespace eZ\Publish\Core\Event\Tests; -use eZ\Publish\API\Repository\Events\UserPreference\BeforeSetUserPreferenceEvent as BeforeSetUserPreferenceEventInterface; -use eZ\Publish\API\Repository\Events\UserPreference\SetUserPreferenceEvent as SetUserPreferenceEventInterface; +use eZ\Publish\API\Repository\Events\UserPreference\BeforeSetUserPreferenceEvent; +use eZ\Publish\API\Repository\Events\UserPreference\SetUserPreferenceEvent; use eZ\Publish\API\Repository\UserPreferenceService as UserPreferenceServiceInterface; use eZ\Publish\Core\Event\UserPreferenceService; @@ -16,8 +16,8 @@ class UserPreferenceServiceTest extends AbstractServiceTest public function testSetUserPreferenceEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeSetUserPreferenceEventInterface::class, - SetUserPreferenceEventInterface::class + BeforeSetUserPreferenceEvent::class, + SetUserPreferenceEvent::class ); $parameters = [ @@ -32,8 +32,8 @@ public function testSetUserPreferenceEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeSetUserPreferenceEventInterface::class, 0], - [SetUserPreferenceEventInterface::class, 0], + [BeforeSetUserPreferenceEvent::class, 0], + [SetUserPreferenceEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -41,8 +41,8 @@ public function testSetUserPreferenceEvents() public function testSetUserPreferenceStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeSetUserPreferenceEventInterface::class, - SetUserPreferenceEventInterface::class + BeforeSetUserPreferenceEvent::class, + SetUserPreferenceEvent::class ); $parameters = [ @@ -51,7 +51,7 @@ public function testSetUserPreferenceStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserPreferenceServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeSetUserPreferenceEventInterface::class, function (BeforeSetUserPreferenceEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeSetUserPreferenceEvent::class, function (BeforeSetUserPreferenceEvent $event) { $event->stopPropagation(); }, 10); @@ -62,11 +62,11 @@ public function testSetUserPreferenceStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeSetUserPreferenceEventInterface::class, 10], + [BeforeSetUserPreferenceEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeSetUserPreferenceEventInterface::class, 0], - [SetUserPreferenceEventInterface::class, 0], + [BeforeSetUserPreferenceEvent::class, 0], + [SetUserPreferenceEvent::class, 0], ]); } } diff --git a/eZ/Publish/Core/Event/Tests/UserServiceTest.php b/eZ/Publish/Core/Event/Tests/UserServiceTest.php index 67c443a0bee..0f7267d7c78 100644 --- a/eZ/Publish/Core/Event/Tests/UserServiceTest.php +++ b/eZ/Publish/Core/Event/Tests/UserServiceTest.php @@ -6,26 +6,26 @@ */ namespace eZ\Publish\Core\Event\Tests; -use eZ\Publish\API\Repository\Events\User\AssignUserToUserGroupEvent as AssignUserToUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeAssignUserToUserGroupEvent as BeforeAssignUserToUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeCreateUserEvent as BeforeCreateUserEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeCreateUserGroupEvent as BeforeCreateUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeDeleteUserEvent as BeforeDeleteUserEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeDeleteUserGroupEvent as BeforeDeleteUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeMoveUserGroupEvent as BeforeMoveUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeUnAssignUserFromUserGroupEvent as BeforeUnAssignUserFromUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeUpdateUserEvent as BeforeUpdateUserEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeUpdateUserGroupEvent as BeforeUpdateUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeUpdateUserTokenEvent as BeforeUpdateUserTokenEventInterface; -use eZ\Publish\API\Repository\Events\User\CreateUserEvent as CreateUserEventInterface; -use eZ\Publish\API\Repository\Events\User\CreateUserGroupEvent as CreateUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\DeleteUserEvent as DeleteUserEventInterface; -use eZ\Publish\API\Repository\Events\User\DeleteUserGroupEvent as DeleteUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\MoveUserGroupEvent as MoveUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\UnAssignUserFromUserGroupEvent as UnAssignUserFromUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\UpdateUserEvent as UpdateUserEventInterface; -use eZ\Publish\API\Repository\Events\User\UpdateUserGroupEvent as UpdateUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\UpdateUserTokenEvent as UpdateUserTokenEventInterface; +use eZ\Publish\API\Repository\Events\User\AssignUserToUserGroupEvent; +use eZ\Publish\API\Repository\Events\User\BeforeAssignUserToUserGroupEvent; +use eZ\Publish\API\Repository\Events\User\BeforeCreateUserEvent; +use eZ\Publish\API\Repository\Events\User\BeforeCreateUserGroupEvent; +use eZ\Publish\API\Repository\Events\User\BeforeDeleteUserEvent; +use eZ\Publish\API\Repository\Events\User\BeforeDeleteUserGroupEvent; +use eZ\Publish\API\Repository\Events\User\BeforeMoveUserGroupEvent; +use eZ\Publish\API\Repository\Events\User\BeforeUnAssignUserFromUserGroupEvent; +use eZ\Publish\API\Repository\Events\User\BeforeUpdateUserEvent; +use eZ\Publish\API\Repository\Events\User\BeforeUpdateUserGroupEvent; +use eZ\Publish\API\Repository\Events\User\BeforeUpdateUserTokenEvent; +use eZ\Publish\API\Repository\Events\User\CreateUserEvent; +use eZ\Publish\API\Repository\Events\User\CreateUserGroupEvent; +use eZ\Publish\API\Repository\Events\User\DeleteUserEvent; +use eZ\Publish\API\Repository\Events\User\DeleteUserGroupEvent; +use eZ\Publish\API\Repository\Events\User\MoveUserGroupEvent; +use eZ\Publish\API\Repository\Events\User\UnAssignUserFromUserGroupEvent; +use eZ\Publish\API\Repository\Events\User\UpdateUserEvent; +use eZ\Publish\API\Repository\Events\User\UpdateUserGroupEvent; +use eZ\Publish\API\Repository\Events\User\UpdateUserTokenEvent; use eZ\Publish\API\Repository\UserService as UserServiceInterface; use eZ\Publish\API\Repository\Values\User\User; use eZ\Publish\API\Repository\Values\User\UserCreateStruct; @@ -41,8 +41,8 @@ class UserServiceTest extends AbstractServiceTest public function testUpdateUserGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateUserGroupEventInterface::class, - UpdateUserGroupEventInterface::class + BeforeUpdateUserGroupEvent::class, + UpdateUserGroupEvent::class ); $parameters = [ @@ -61,8 +61,8 @@ public function testUpdateUserGroupEvents() $this->assertSame($updatedUserGroup, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateUserGroupEventInterface::class, 0], - [UpdateUserGroupEventInterface::class, 0], + [BeforeUpdateUserGroupEvent::class, 0], + [UpdateUserGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -70,8 +70,8 @@ public function testUpdateUserGroupEvents() public function testReturnUpdateUserGroupResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateUserGroupEventInterface::class, - UpdateUserGroupEventInterface::class + BeforeUpdateUserGroupEvent::class, + UpdateUserGroupEvent::class ); $parameters = [ @@ -84,7 +84,7 @@ public function testReturnUpdateUserGroupResultInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('updateUserGroup')->willReturn($updatedUserGroup); - $traceableEventDispatcher->addListener(BeforeUpdateUserGroupEventInterface::class, function (BeforeUpdateUserGroupEventInterface $event) use ($eventUpdatedUserGroup) { + $traceableEventDispatcher->addListener(BeforeUpdateUserGroupEvent::class, function (BeforeUpdateUserGroupEvent $event) use ($eventUpdatedUserGroup) { $event->setUpdatedUserGroup($eventUpdatedUserGroup); }, 10); @@ -95,9 +95,9 @@ public function testReturnUpdateUserGroupResultInBeforeEvents() $this->assertSame($eventUpdatedUserGroup, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateUserGroupEventInterface::class, 10], - [BeforeUpdateUserGroupEventInterface::class, 0], - [UpdateUserGroupEventInterface::class, 0], + [BeforeUpdateUserGroupEvent::class, 10], + [BeforeUpdateUserGroupEvent::class, 0], + [UpdateUserGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -105,8 +105,8 @@ public function testReturnUpdateUserGroupResultInBeforeEvents() public function testUpdateUserGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateUserGroupEventInterface::class, - UpdateUserGroupEventInterface::class + BeforeUpdateUserGroupEvent::class, + UpdateUserGroupEvent::class ); $parameters = [ @@ -119,7 +119,7 @@ public function testUpdateUserGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('updateUserGroup')->willReturn($updatedUserGroup); - $traceableEventDispatcher->addListener(BeforeUpdateUserGroupEventInterface::class, function (BeforeUpdateUserGroupEventInterface $event) use ($eventUpdatedUserGroup) { + $traceableEventDispatcher->addListener(BeforeUpdateUserGroupEvent::class, function (BeforeUpdateUserGroupEvent $event) use ($eventUpdatedUserGroup) { $event->setUpdatedUserGroup($eventUpdatedUserGroup); $event->stopPropagation(); }, 10); @@ -132,19 +132,19 @@ public function testUpdateUserGroupStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedUserGroup, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateUserGroupEventInterface::class, 10], + [BeforeUpdateUserGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateUserGroupEventInterface::class, 0], - [UpdateUserGroupEventInterface::class, 0], + [BeforeUpdateUserGroupEvent::class, 0], + [UpdateUserGroupEvent::class, 0], ]); } public function testUpdateUserEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateUserEventInterface::class, - UpdateUserEventInterface::class + BeforeUpdateUserEvent::class, + UpdateUserEvent::class ); $parameters = [ @@ -163,8 +163,8 @@ public function testUpdateUserEvents() $this->assertSame($updatedUser, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateUserEventInterface::class, 0], - [UpdateUserEventInterface::class, 0], + [BeforeUpdateUserEvent::class, 0], + [UpdateUserEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -172,8 +172,8 @@ public function testUpdateUserEvents() public function testReturnUpdateUserResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateUserEventInterface::class, - UpdateUserEventInterface::class + BeforeUpdateUserEvent::class, + UpdateUserEvent::class ); $parameters = [ @@ -186,7 +186,7 @@ public function testReturnUpdateUserResultInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('updateUser')->willReturn($updatedUser); - $traceableEventDispatcher->addListener(BeforeUpdateUserEventInterface::class, function (BeforeUpdateUserEventInterface $event) use ($eventUpdatedUser) { + $traceableEventDispatcher->addListener(BeforeUpdateUserEvent::class, function (BeforeUpdateUserEvent $event) use ($eventUpdatedUser) { $event->setUpdatedUser($eventUpdatedUser); }, 10); @@ -197,9 +197,9 @@ public function testReturnUpdateUserResultInBeforeEvents() $this->assertSame($eventUpdatedUser, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateUserEventInterface::class, 10], - [BeforeUpdateUserEventInterface::class, 0], - [UpdateUserEventInterface::class, 0], + [BeforeUpdateUserEvent::class, 10], + [BeforeUpdateUserEvent::class, 0], + [UpdateUserEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -207,8 +207,8 @@ public function testReturnUpdateUserResultInBeforeEvents() public function testUpdateUserStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateUserEventInterface::class, - UpdateUserEventInterface::class + BeforeUpdateUserEvent::class, + UpdateUserEvent::class ); $parameters = [ @@ -221,7 +221,7 @@ public function testUpdateUserStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('updateUser')->willReturn($updatedUser); - $traceableEventDispatcher->addListener(BeforeUpdateUserEventInterface::class, function (BeforeUpdateUserEventInterface $event) use ($eventUpdatedUser) { + $traceableEventDispatcher->addListener(BeforeUpdateUserEvent::class, function (BeforeUpdateUserEvent $event) use ($eventUpdatedUser) { $event->setUpdatedUser($eventUpdatedUser); $event->stopPropagation(); }, 10); @@ -234,19 +234,19 @@ public function testUpdateUserStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedUser, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateUserEventInterface::class, 10], + [BeforeUpdateUserEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateUserEventInterface::class, 0], - [UpdateUserEventInterface::class, 0], + [BeforeUpdateUserEvent::class, 0], + [UpdateUserEvent::class, 0], ]); } public function testUnAssignUserFromUserGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUnAssignUserFromUserGroupEventInterface::class, - UnAssignUserFromUserGroupEventInterface::class + BeforeUnAssignUserFromUserGroupEvent::class, + UnAssignUserFromUserGroupEvent::class ); $parameters = [ @@ -262,8 +262,8 @@ public function testUnAssignUserFromUserGroupEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeUnAssignUserFromUserGroupEventInterface::class, 0], - [UnAssignUserFromUserGroupEventInterface::class, 0], + [BeforeUnAssignUserFromUserGroupEvent::class, 0], + [UnAssignUserFromUserGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -271,8 +271,8 @@ public function testUnAssignUserFromUserGroupEvents() public function testUnAssignUserFromUserGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUnAssignUserFromUserGroupEventInterface::class, - UnAssignUserFromUserGroupEventInterface::class + BeforeUnAssignUserFromUserGroupEvent::class, + UnAssignUserFromUserGroupEvent::class ); $parameters = [ @@ -282,7 +282,7 @@ public function testUnAssignUserFromUserGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeUnAssignUserFromUserGroupEventInterface::class, function (BeforeUnAssignUserFromUserGroupEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeUnAssignUserFromUserGroupEvent::class, function (BeforeUnAssignUserFromUserGroupEvent $event) { $event->stopPropagation(); }, 10); @@ -293,19 +293,19 @@ public function testUnAssignUserFromUserGroupStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeUnAssignUserFromUserGroupEventInterface::class, 10], + [BeforeUnAssignUserFromUserGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUnAssignUserFromUserGroupEventInterface::class, 0], - [UnAssignUserFromUserGroupEventInterface::class, 0], + [BeforeUnAssignUserFromUserGroupEvent::class, 0], + [UnAssignUserFromUserGroupEvent::class, 0], ]); } public function testDeleteUserGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteUserGroupEventInterface::class, - DeleteUserGroupEventInterface::class + BeforeDeleteUserGroupEvent::class, + DeleteUserGroupEvent::class ); $parameters = [ @@ -323,8 +323,8 @@ public function testDeleteUserGroupEvents() $this->assertSame($locations, $result); $this->assertSame($calledListeners, [ - [BeforeDeleteUserGroupEventInterface::class, 0], - [DeleteUserGroupEventInterface::class, 0], + [BeforeDeleteUserGroupEvent::class, 0], + [DeleteUserGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -332,8 +332,8 @@ public function testDeleteUserGroupEvents() public function testReturnDeleteUserGroupResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteUserGroupEventInterface::class, - DeleteUserGroupEventInterface::class + BeforeDeleteUserGroupEvent::class, + DeleteUserGroupEvent::class ); $parameters = [ @@ -345,7 +345,7 @@ public function testReturnDeleteUserGroupResultInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('deleteUserGroup')->willReturn($locations); - $traceableEventDispatcher->addListener(BeforeDeleteUserGroupEventInterface::class, function (BeforeDeleteUserGroupEventInterface $event) use ($eventLocations) { + $traceableEventDispatcher->addListener(BeforeDeleteUserGroupEvent::class, function (BeforeDeleteUserGroupEvent $event) use ($eventLocations) { $event->setLocations($eventLocations); }, 10); @@ -356,9 +356,9 @@ public function testReturnDeleteUserGroupResultInBeforeEvents() $this->assertSame($eventLocations, $result); $this->assertSame($calledListeners, [ - [BeforeDeleteUserGroupEventInterface::class, 10], - [BeforeDeleteUserGroupEventInterface::class, 0], - [DeleteUserGroupEventInterface::class, 0], + [BeforeDeleteUserGroupEvent::class, 10], + [BeforeDeleteUserGroupEvent::class, 0], + [DeleteUserGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -366,8 +366,8 @@ public function testReturnDeleteUserGroupResultInBeforeEvents() public function testDeleteUserGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteUserGroupEventInterface::class, - DeleteUserGroupEventInterface::class + BeforeDeleteUserGroupEvent::class, + DeleteUserGroupEvent::class ); $parameters = [ @@ -379,7 +379,7 @@ public function testDeleteUserGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('deleteUserGroup')->willReturn($locations); - $traceableEventDispatcher->addListener(BeforeDeleteUserGroupEventInterface::class, function (BeforeDeleteUserGroupEventInterface $event) use ($eventLocations) { + $traceableEventDispatcher->addListener(BeforeDeleteUserGroupEvent::class, function (BeforeDeleteUserGroupEvent $event) use ($eventLocations) { $event->setLocations($eventLocations); $event->stopPropagation(); }, 10); @@ -392,19 +392,19 @@ public function testDeleteUserGroupStopPropagationInBeforeEvents() $this->assertSame($eventLocations, $result); $this->assertSame($calledListeners, [ - [BeforeDeleteUserGroupEventInterface::class, 10], + [BeforeDeleteUserGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteUserGroupEventInterface::class, 0], - [DeleteUserGroupEventInterface::class, 0], + [BeforeDeleteUserGroupEvent::class, 0], + [DeleteUserGroupEvent::class, 0], ]); } public function testAssignUserToUserGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAssignUserToUserGroupEventInterface::class, - AssignUserToUserGroupEventInterface::class + BeforeAssignUserToUserGroupEvent::class, + AssignUserToUserGroupEvent::class ); $parameters = [ @@ -420,8 +420,8 @@ public function testAssignUserToUserGroupEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeAssignUserToUserGroupEventInterface::class, 0], - [AssignUserToUserGroupEventInterface::class, 0], + [BeforeAssignUserToUserGroupEvent::class, 0], + [AssignUserToUserGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -429,8 +429,8 @@ public function testAssignUserToUserGroupEvents() public function testAssignUserToUserGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeAssignUserToUserGroupEventInterface::class, - AssignUserToUserGroupEventInterface::class + BeforeAssignUserToUserGroupEvent::class, + AssignUserToUserGroupEvent::class ); $parameters = [ @@ -440,7 +440,7 @@ public function testAssignUserToUserGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeAssignUserToUserGroupEventInterface::class, function (BeforeAssignUserToUserGroupEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeAssignUserToUserGroupEvent::class, function (BeforeAssignUserToUserGroupEvent $event) { $event->stopPropagation(); }, 10); @@ -451,19 +451,19 @@ public function testAssignUserToUserGroupStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeAssignUserToUserGroupEventInterface::class, 10], + [BeforeAssignUserToUserGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [AssignUserToUserGroupEventInterface::class, 0], - [BeforeAssignUserToUserGroupEventInterface::class, 0], + [AssignUserToUserGroupEvent::class, 0], + [BeforeAssignUserToUserGroupEvent::class, 0], ]); } public function testDeleteUserEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteUserEventInterface::class, - DeleteUserEventInterface::class + BeforeDeleteUserEvent::class, + DeleteUserEvent::class ); $parameters = [ @@ -481,8 +481,8 @@ public function testDeleteUserEvents() $this->assertSame($locations, $result); $this->assertSame($calledListeners, [ - [BeforeDeleteUserEventInterface::class, 0], - [DeleteUserEventInterface::class, 0], + [BeforeDeleteUserEvent::class, 0], + [DeleteUserEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -490,8 +490,8 @@ public function testDeleteUserEvents() public function testReturnDeleteUserResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteUserEventInterface::class, - DeleteUserEventInterface::class + BeforeDeleteUserEvent::class, + DeleteUserEvent::class ); $parameters = [ @@ -503,7 +503,7 @@ public function testReturnDeleteUserResultInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('deleteUser')->willReturn($locations); - $traceableEventDispatcher->addListener(BeforeDeleteUserEventInterface::class, function (BeforeDeleteUserEventInterface $event) use ($eventLocations) { + $traceableEventDispatcher->addListener(BeforeDeleteUserEvent::class, function (BeforeDeleteUserEvent $event) use ($eventLocations) { $event->setLocations($eventLocations); }, 10); @@ -514,9 +514,9 @@ public function testReturnDeleteUserResultInBeforeEvents() $this->assertSame($eventLocations, $result); $this->assertSame($calledListeners, [ - [BeforeDeleteUserEventInterface::class, 10], - [BeforeDeleteUserEventInterface::class, 0], - [DeleteUserEventInterface::class, 0], + [BeforeDeleteUserEvent::class, 10], + [BeforeDeleteUserEvent::class, 0], + [DeleteUserEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -524,8 +524,8 @@ public function testReturnDeleteUserResultInBeforeEvents() public function testDeleteUserStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeDeleteUserEventInterface::class, - DeleteUserEventInterface::class + BeforeDeleteUserEvent::class, + DeleteUserEvent::class ); $parameters = [ @@ -537,7 +537,7 @@ public function testDeleteUserStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('deleteUser')->willReturn($locations); - $traceableEventDispatcher->addListener(BeforeDeleteUserEventInterface::class, function (BeforeDeleteUserEventInterface $event) use ($eventLocations) { + $traceableEventDispatcher->addListener(BeforeDeleteUserEvent::class, function (BeforeDeleteUserEvent $event) use ($eventLocations) { $event->setLocations($eventLocations); $event->stopPropagation(); }, 10); @@ -550,19 +550,19 @@ public function testDeleteUserStopPropagationInBeforeEvents() $this->assertSame($eventLocations, $result); $this->assertSame($calledListeners, [ - [BeforeDeleteUserEventInterface::class, 10], + [BeforeDeleteUserEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeDeleteUserEventInterface::class, 0], - [DeleteUserEventInterface::class, 0], + [BeforeDeleteUserEvent::class, 0], + [DeleteUserEvent::class, 0], ]); } public function testMoveUserGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeMoveUserGroupEventInterface::class, - MoveUserGroupEventInterface::class + BeforeMoveUserGroupEvent::class, + MoveUserGroupEvent::class ); $parameters = [ @@ -578,8 +578,8 @@ public function testMoveUserGroupEvents() $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeMoveUserGroupEventInterface::class, 0], - [MoveUserGroupEventInterface::class, 0], + [BeforeMoveUserGroupEvent::class, 0], + [MoveUserGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -587,8 +587,8 @@ public function testMoveUserGroupEvents() public function testMoveUserGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeMoveUserGroupEventInterface::class, - MoveUserGroupEventInterface::class + BeforeMoveUserGroupEvent::class, + MoveUserGroupEvent::class ); $parameters = [ @@ -598,7 +598,7 @@ public function testMoveUserGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeMoveUserGroupEventInterface::class, function (BeforeMoveUserGroupEventInterface $event) { + $traceableEventDispatcher->addListener(BeforeMoveUserGroupEvent::class, function (BeforeMoveUserGroupEvent $event) { $event->stopPropagation(); }, 10); @@ -609,19 +609,19 @@ public function testMoveUserGroupStopPropagationInBeforeEvents() $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); $this->assertSame($calledListeners, [ - [BeforeMoveUserGroupEventInterface::class, 10], + [BeforeMoveUserGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeMoveUserGroupEventInterface::class, 0], - [MoveUserGroupEventInterface::class, 0], + [BeforeMoveUserGroupEvent::class, 0], + [MoveUserGroupEvent::class, 0], ]); } public function testCreateUserEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateUserEventInterface::class, - CreateUserEventInterface::class + BeforeCreateUserEvent::class, + CreateUserEvent::class ); $parameters = [ @@ -640,8 +640,8 @@ public function testCreateUserEvents() $this->assertSame($user, $result); $this->assertSame($calledListeners, [ - [BeforeCreateUserEventInterface::class, 0], - [CreateUserEventInterface::class, 0], + [BeforeCreateUserEvent::class, 0], + [CreateUserEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -649,8 +649,8 @@ public function testCreateUserEvents() public function testReturnCreateUserResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateUserEventInterface::class, - CreateUserEventInterface::class + BeforeCreateUserEvent::class, + CreateUserEvent::class ); $parameters = [ @@ -663,7 +663,7 @@ public function testReturnCreateUserResultInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('createUser')->willReturn($user); - $traceableEventDispatcher->addListener(BeforeCreateUserEventInterface::class, function (BeforeCreateUserEventInterface $event) use ($eventUser) { + $traceableEventDispatcher->addListener(BeforeCreateUserEvent::class, function (BeforeCreateUserEvent $event) use ($eventUser) { $event->setUser($eventUser); }, 10); @@ -674,9 +674,9 @@ public function testReturnCreateUserResultInBeforeEvents() $this->assertSame($eventUser, $result); $this->assertSame($calledListeners, [ - [BeforeCreateUserEventInterface::class, 10], - [BeforeCreateUserEventInterface::class, 0], - [CreateUserEventInterface::class, 0], + [BeforeCreateUserEvent::class, 10], + [BeforeCreateUserEvent::class, 0], + [CreateUserEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -684,8 +684,8 @@ public function testReturnCreateUserResultInBeforeEvents() public function testCreateUserStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateUserEventInterface::class, - CreateUserEventInterface::class + BeforeCreateUserEvent::class, + CreateUserEvent::class ); $parameters = [ @@ -698,7 +698,7 @@ public function testCreateUserStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('createUser')->willReturn($user); - $traceableEventDispatcher->addListener(BeforeCreateUserEventInterface::class, function (BeforeCreateUserEventInterface $event) use ($eventUser) { + $traceableEventDispatcher->addListener(BeforeCreateUserEvent::class, function (BeforeCreateUserEvent $event) use ($eventUser) { $event->setUser($eventUser); $event->stopPropagation(); }, 10); @@ -711,19 +711,19 @@ public function testCreateUserStopPropagationInBeforeEvents() $this->assertSame($eventUser, $result); $this->assertSame($calledListeners, [ - [BeforeCreateUserEventInterface::class, 10], + [BeforeCreateUserEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateUserEventInterface::class, 0], - [CreateUserEventInterface::class, 0], + [BeforeCreateUserEvent::class, 0], + [CreateUserEvent::class, 0], ]); } public function testCreateUserGroupEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateUserGroupEventInterface::class, - CreateUserGroupEventInterface::class + BeforeCreateUserGroupEvent::class, + CreateUserGroupEvent::class ); $parameters = [ @@ -742,8 +742,8 @@ public function testCreateUserGroupEvents() $this->assertSame($userGroup, $result); $this->assertSame($calledListeners, [ - [BeforeCreateUserGroupEventInterface::class, 0], - [CreateUserGroupEventInterface::class, 0], + [BeforeCreateUserGroupEvent::class, 0], + [CreateUserGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -751,8 +751,8 @@ public function testCreateUserGroupEvents() public function testReturnCreateUserGroupResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateUserGroupEventInterface::class, - CreateUserGroupEventInterface::class + BeforeCreateUserGroupEvent::class, + CreateUserGroupEvent::class ); $parameters = [ @@ -765,7 +765,7 @@ public function testReturnCreateUserGroupResultInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('createUserGroup')->willReturn($userGroup); - $traceableEventDispatcher->addListener(BeforeCreateUserGroupEventInterface::class, function (BeforeCreateUserGroupEventInterface $event) use ($eventUserGroup) { + $traceableEventDispatcher->addListener(BeforeCreateUserGroupEvent::class, function (BeforeCreateUserGroupEvent $event) use ($eventUserGroup) { $event->setUserGroup($eventUserGroup); }, 10); @@ -776,9 +776,9 @@ public function testReturnCreateUserGroupResultInBeforeEvents() $this->assertSame($eventUserGroup, $result); $this->assertSame($calledListeners, [ - [BeforeCreateUserGroupEventInterface::class, 10], - [BeforeCreateUserGroupEventInterface::class, 0], - [CreateUserGroupEventInterface::class, 0], + [BeforeCreateUserGroupEvent::class, 10], + [BeforeCreateUserGroupEvent::class, 0], + [CreateUserGroupEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -786,8 +786,8 @@ public function testReturnCreateUserGroupResultInBeforeEvents() public function testCreateUserGroupStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeCreateUserGroupEventInterface::class, - CreateUserGroupEventInterface::class + BeforeCreateUserGroupEvent::class, + CreateUserGroupEvent::class ); $parameters = [ @@ -800,7 +800,7 @@ public function testCreateUserGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('createUserGroup')->willReturn($userGroup); - $traceableEventDispatcher->addListener(BeforeCreateUserGroupEventInterface::class, function (BeforeCreateUserGroupEventInterface $event) use ($eventUserGroup) { + $traceableEventDispatcher->addListener(BeforeCreateUserGroupEvent::class, function (BeforeCreateUserGroupEvent $event) use ($eventUserGroup) { $event->setUserGroup($eventUserGroup); $event->stopPropagation(); }, 10); @@ -813,19 +813,19 @@ public function testCreateUserGroupStopPropagationInBeforeEvents() $this->assertSame($eventUserGroup, $result); $this->assertSame($calledListeners, [ - [BeforeCreateUserGroupEventInterface::class, 10], + [BeforeCreateUserGroupEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeCreateUserGroupEventInterface::class, 0], - [CreateUserGroupEventInterface::class, 0], + [BeforeCreateUserGroupEvent::class, 0], + [CreateUserGroupEvent::class, 0], ]); } public function testUpdateUserTokenEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateUserTokenEventInterface::class, - UpdateUserTokenEventInterface::class + BeforeUpdateUserTokenEvent::class, + UpdateUserTokenEvent::class ); $parameters = [ @@ -844,8 +844,8 @@ public function testUpdateUserTokenEvents() $this->assertSame($updatedUser, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateUserTokenEventInterface::class, 0], - [UpdateUserTokenEventInterface::class, 0], + [BeforeUpdateUserTokenEvent::class, 0], + [UpdateUserTokenEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -853,8 +853,8 @@ public function testUpdateUserTokenEvents() public function testReturnUpdateUserTokenResultInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateUserTokenEventInterface::class, - UpdateUserTokenEventInterface::class + BeforeUpdateUserTokenEvent::class, + UpdateUserTokenEvent::class ); $parameters = [ @@ -867,7 +867,7 @@ public function testReturnUpdateUserTokenResultInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('updateUserToken')->willReturn($updatedUser); - $traceableEventDispatcher->addListener(BeforeUpdateUserTokenEventInterface::class, function (BeforeUpdateUserTokenEventInterface $event) use ($eventUpdatedUser) { + $traceableEventDispatcher->addListener(BeforeUpdateUserTokenEvent::class, function (BeforeUpdateUserTokenEvent $event) use ($eventUpdatedUser) { $event->setUpdatedUser($eventUpdatedUser); }, 10); @@ -878,9 +878,9 @@ public function testReturnUpdateUserTokenResultInBeforeEvents() $this->assertSame($eventUpdatedUser, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateUserTokenEventInterface::class, 10], - [BeforeUpdateUserTokenEventInterface::class, 0], - [UpdateUserTokenEventInterface::class, 0], + [BeforeUpdateUserTokenEvent::class, 10], + [BeforeUpdateUserTokenEvent::class, 0], + [UpdateUserTokenEvent::class, 0], ]); $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } @@ -888,8 +888,8 @@ public function testReturnUpdateUserTokenResultInBeforeEvents() public function testUpdateUserTokenStopPropagationInBeforeEvents() { $traceableEventDispatcher = $this->getEventDispatcher( - BeforeUpdateUserTokenEventInterface::class, - UpdateUserTokenEventInterface::class + BeforeUpdateUserTokenEvent::class, + UpdateUserTokenEvent::class ); $parameters = [ @@ -902,7 +902,7 @@ public function testUpdateUserTokenStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('updateUserToken')->willReturn($updatedUser); - $traceableEventDispatcher->addListener(BeforeUpdateUserTokenEventInterface::class, function (BeforeUpdateUserTokenEventInterface $event) use ($eventUpdatedUser) { + $traceableEventDispatcher->addListener(BeforeUpdateUserTokenEvent::class, function (BeforeUpdateUserTokenEvent $event) use ($eventUpdatedUser) { $event->setUpdatedUser($eventUpdatedUser); $event->stopPropagation(); }, 10); @@ -915,11 +915,11 @@ public function testUpdateUserTokenStopPropagationInBeforeEvents() $this->assertSame($eventUpdatedUser, $result); $this->assertSame($calledListeners, [ - [BeforeUpdateUserTokenEventInterface::class, 10], + [BeforeUpdateUserTokenEvent::class, 10], ]); $this->assertSame($notCalledListeners, [ - [BeforeUpdateUserTokenEventInterface::class, 0], - [UpdateUserTokenEventInterface::class, 0], + [BeforeUpdateUserTokenEvent::class, 0], + [UpdateUserTokenEvent::class, 0], ]); } } diff --git a/eZ/Publish/Core/Event/TrashService.php b/eZ/Publish/Core/Event/TrashService.php index aab6b710c55..85ffd4ad30b 100644 --- a/eZ/Publish/Core/Event/TrashService.php +++ b/eZ/Publish/Core/Event/TrashService.php @@ -8,14 +8,6 @@ namespace eZ\Publish\Core\Event; -use eZ\Publish\API\Repository\Events\Trash\BeforeDeleteTrashItemEvent as BeforeDeleteTrashItemEventInterface; -use eZ\Publish\API\Repository\Events\Trash\BeforeEmptyTrashEvent as BeforeEmptyTrashEventInterface; -use eZ\Publish\API\Repository\Events\Trash\BeforeRecoverEvent as BeforeRecoverEventInterface; -use eZ\Publish\API\Repository\Events\Trash\BeforeTrashEvent as BeforeTrashEventInterface; -use eZ\Publish\API\Repository\Events\Trash\DeleteTrashItemEvent as DeleteTrashItemEventInterface; -use eZ\Publish\API\Repository\Events\Trash\EmptyTrashEvent as EmptyTrashEventInterface; -use eZ\Publish\API\Repository\Events\Trash\RecoverEvent as RecoverEventInterface; -use eZ\Publish\API\Repository\Events\Trash\TrashEvent as TrashEventInterface; use eZ\Publish\API\Repository\TrashService as TrashServiceInterface; use eZ\Publish\API\Repository\Values\Content\Location; use eZ\Publish\API\Repository\Values\Content\TrashItem; @@ -50,7 +42,7 @@ public function trash(Location $location) $beforeEvent = new BeforeTrashEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeTrashEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getResult(); } @@ -60,8 +52,7 @@ public function trash(Location $location) : $this->innerService->trash($location); $this->eventDispatcher->dispatch( - new TrashEvent($trashItem, ...$eventData), - TrashEventInterface::class + new TrashEvent($trashItem, ...$eventData) ); return $trashItem; @@ -78,7 +69,7 @@ public function recover( $beforeEvent = new BeforeRecoverEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeRecoverEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getLocation(); } @@ -88,8 +79,7 @@ public function recover( : $this->innerService->recover($trashItem, $newParentLocation); $this->eventDispatcher->dispatch( - new RecoverEvent($location, ...$eventData), - RecoverEventInterface::class + new RecoverEvent($location, ...$eventData) ); return $location; @@ -99,7 +89,7 @@ public function emptyTrash() { $beforeEvent = new BeforeEmptyTrashEvent(); - $this->eventDispatcher->dispatch($beforeEvent, BeforeEmptyTrashEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getResultList(); } @@ -109,8 +99,7 @@ public function emptyTrash() : $this->innerService->emptyTrash(); $this->eventDispatcher->dispatch( - new EmptyTrashEvent($resultList), - EmptyTrashEventInterface::class + new EmptyTrashEvent($resultList) ); return $resultList; @@ -122,7 +111,7 @@ public function deleteTrashItem(TrashItem $trashItem) $beforeEvent = new BeforeDeleteTrashItemEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteTrashItemEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getResult(); } @@ -132,8 +121,7 @@ public function deleteTrashItem(TrashItem $trashItem) : $this->innerService->deleteTrashItem($trashItem); $this->eventDispatcher->dispatch( - new DeleteTrashItemEvent($result, ...$eventData), - DeleteTrashItemEventInterface::class + new DeleteTrashItemEvent($result, ...$eventData) ); return $result; diff --git a/eZ/Publish/Core/Event/URLAliasService.php b/eZ/Publish/Core/Event/URLAliasService.php index c1834db29f9..82b3df50515 100644 --- a/eZ/Publish/Core/Event/URLAliasService.php +++ b/eZ/Publish/Core/Event/URLAliasService.php @@ -8,14 +8,6 @@ namespace eZ\Publish\Core\Event; -use eZ\Publish\API\Repository\Events\URLAlias\BeforeCreateGlobalUrlAliasEvent as BeforeCreateGlobalUrlAliasEventInterface; -use eZ\Publish\API\Repository\Events\URLAlias\BeforeCreateUrlAliasEvent as BeforeCreateUrlAliasEventInterface; -use eZ\Publish\API\Repository\Events\URLAlias\BeforeRefreshSystemUrlAliasesForLocationEvent as BeforeRefreshSystemUrlAliasesForLocationEventInterface; -use eZ\Publish\API\Repository\Events\URLAlias\BeforeRemoveAliasesEvent as BeforeRemoveAliasesEventInterface; -use eZ\Publish\API\Repository\Events\URLAlias\CreateGlobalUrlAliasEvent as CreateGlobalUrlAliasEventInterface; -use eZ\Publish\API\Repository\Events\URLAlias\CreateUrlAliasEvent as CreateUrlAliasEventInterface; -use eZ\Publish\API\Repository\Events\URLAlias\RefreshSystemUrlAliasesForLocationEvent as RefreshSystemUrlAliasesForLocationEventInterface; -use eZ\Publish\API\Repository\Events\URLAlias\RemoveAliasesEvent as RemoveAliasesEventInterface; use eZ\Publish\API\Repository\URLAliasService as URLAliasServiceInterface; use eZ\Publish\API\Repository\Values\Content\Location; use eZ\Publish\API\Repository\Events\URLAlias\BeforeCreateGlobalUrlAliasEvent; @@ -60,7 +52,7 @@ public function createUrlAlias( $beforeEvent = new BeforeCreateUrlAliasEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateUrlAliasEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUrlAlias(); } @@ -70,8 +62,7 @@ public function createUrlAlias( : $this->innerService->createUrlAlias($location, $path, $languageCode, $forwarding, $alwaysAvailable); $this->eventDispatcher->dispatch( - new CreateUrlAliasEvent($urlAlias, ...$eventData), - CreateUrlAliasEventInterface::class + new CreateUrlAliasEvent($urlAlias, ...$eventData) ); return $urlAlias; @@ -94,7 +85,7 @@ public function createGlobalUrlAlias( $beforeEvent = new BeforeCreateGlobalUrlAliasEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateGlobalUrlAliasEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUrlAlias(); } @@ -104,8 +95,7 @@ public function createGlobalUrlAlias( : $this->innerService->createGlobalUrlAlias($resource, $path, $languageCode, $forwarding, $alwaysAvailable); $this->eventDispatcher->dispatch( - new CreateGlobalUrlAliasEvent($urlAlias, ...$eventData), - CreateGlobalUrlAliasEventInterface::class + new CreateGlobalUrlAliasEvent($urlAlias, ...$eventData) ); return $urlAlias; @@ -117,7 +107,7 @@ public function removeAliases(array $aliasList): void $beforeEvent = new BeforeRemoveAliasesEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeRemoveAliasesEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -125,8 +115,7 @@ public function removeAliases(array $aliasList): void $this->innerService->removeAliases($aliasList); $this->eventDispatcher->dispatch( - new RemoveAliasesEvent(...$eventData), - RemoveAliasesEventInterface::class + new RemoveAliasesEvent(...$eventData) ); } @@ -136,7 +125,7 @@ public function refreshSystemUrlAliasesForLocation(Location $location): void $beforeEvent = new BeforeRefreshSystemUrlAliasesForLocationEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeRefreshSystemUrlAliasesForLocationEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -144,8 +133,7 @@ public function refreshSystemUrlAliasesForLocation(Location $location): void $this->innerService->refreshSystemUrlAliasesForLocation($location); $this->eventDispatcher->dispatch( - new RefreshSystemUrlAliasesForLocationEvent(...$eventData), - RefreshSystemUrlAliasesForLocationEventInterface::class + new RefreshSystemUrlAliasesForLocationEvent(...$eventData) ); } } diff --git a/eZ/Publish/Core/Event/URLService.php b/eZ/Publish/Core/Event/URLService.php index 4c925fe77ec..1972496abfe 100644 --- a/eZ/Publish/Core/Event/URLService.php +++ b/eZ/Publish/Core/Event/URLService.php @@ -8,8 +8,6 @@ namespace eZ\Publish\Core\Event; -use eZ\Publish\API\Repository\Events\URL\BeforeUpdateUrlEvent as BeforeUpdateUrlEventInterface; -use eZ\Publish\API\Repository\Events\URL\UpdateUrlEvent as UpdateUrlEventInterface; use eZ\Publish\API\Repository\URLService as URLServiceInterface; use eZ\Publish\API\Repository\Values\URL\URL; use eZ\Publish\API\Repository\Values\URL\URLUpdateStruct; @@ -43,7 +41,7 @@ public function updateUrl( $beforeEvent = new BeforeUpdateUrlEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateUrlEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedUrl(); } @@ -53,8 +51,7 @@ public function updateUrl( : $this->innerService->updateUrl($url, $struct); $this->eventDispatcher->dispatch( - new UpdateUrlEvent($updatedUrl, ...$eventData), - UpdateUrlEventInterface::class + new UpdateUrlEvent($updatedUrl, ...$eventData) ); return $updatedUrl; diff --git a/eZ/Publish/Core/Event/URLWildcardService.php b/eZ/Publish/Core/Event/URLWildcardService.php index 953513c55c1..05c4c3ec9b2 100644 --- a/eZ/Publish/Core/Event/URLWildcardService.php +++ b/eZ/Publish/Core/Event/URLWildcardService.php @@ -8,12 +8,6 @@ namespace eZ\Publish\Core\Event; -use eZ\Publish\API\Repository\Events\URLWildcard\BeforeCreateEvent as BeforeCreateEventInterface; -use eZ\Publish\API\Repository\Events\URLWildcard\BeforeRemoveEvent as BeforeRemoveEventInterface; -use eZ\Publish\API\Repository\Events\URLWildcard\BeforeTranslateEvent as BeforeTranslateEventInterface; -use eZ\Publish\API\Repository\Events\URLWildcard\CreateEvent as CreateEventInterface; -use eZ\Publish\API\Repository\Events\URLWildcard\RemoveEvent as RemoveEventInterface; -use eZ\Publish\API\Repository\Events\URLWildcard\TranslateEvent as TranslateEventInterface; use eZ\Publish\API\Repository\URLWildcardService as URLWildcardServiceInterface; use eZ\Publish\API\Repository\Values\Content\URLWildcard; use eZ\Publish\API\Repository\Events\URLWildcard\BeforeCreateEvent; @@ -52,7 +46,7 @@ public function create( $beforeEvent = new BeforeCreateEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUrlWildcard(); } @@ -62,8 +56,7 @@ public function create( : $this->innerService->create($sourceUrl, $destinationUrl, $forward); $this->eventDispatcher->dispatch( - new CreateEvent($urlWildcard, ...$eventData), - CreateEventInterface::class + new CreateEvent($urlWildcard, ...$eventData) ); return $urlWildcard; @@ -75,7 +68,7 @@ public function remove(URLWildcard $urlWildcard): void $beforeEvent = new BeforeRemoveEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeRemoveEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -83,8 +76,7 @@ public function remove(URLWildcard $urlWildcard): void $this->innerService->remove($urlWildcard); $this->eventDispatcher->dispatch( - new RemoveEvent(...$eventData), - RemoveEventInterface::class + new RemoveEvent(...$eventData) ); } @@ -94,7 +86,7 @@ public function translate($url) $beforeEvent = new BeforeTranslateEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeTranslateEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getResult(); } @@ -104,8 +96,7 @@ public function translate($url) : $this->innerService->translate($url); $this->eventDispatcher->dispatch( - new TranslateEvent($result, ...$eventData), - TranslateEventInterface::class + new TranslateEvent($result, ...$eventData) ); return $result; diff --git a/eZ/Publish/Core/Event/UserPreferenceService.php b/eZ/Publish/Core/Event/UserPreferenceService.php index 5e22468664d..b54b22f0ba6 100644 --- a/eZ/Publish/Core/Event/UserPreferenceService.php +++ b/eZ/Publish/Core/Event/UserPreferenceService.php @@ -8,8 +8,6 @@ namespace eZ\Publish\Core\Event; -use eZ\Publish\API\Repository\Events\UserPreference\BeforeSetUserPreferenceEvent as BeforeSetUserPreferenceEventInterface; -use eZ\Publish\API\Repository\Events\UserPreference\SetUserPreferenceEvent as SetUserPreferenceEventInterface; use eZ\Publish\API\Repository\UserPreferenceService as UserPreferenceServiceInterface; use eZ\Publish\API\Repository\Events\UserPreference\BeforeSetUserPreferenceEvent; use eZ\Publish\API\Repository\Events\UserPreference\SetUserPreferenceEvent; @@ -36,7 +34,7 @@ public function setUserPreference(array $userPreferenceSetStructs): void $beforeEvent = new BeforeSetUserPreferenceEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeSetUserPreferenceEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -44,8 +42,7 @@ public function setUserPreference(array $userPreferenceSetStructs): void $this->innerService->setUserPreference($userPreferenceSetStructs); $this->eventDispatcher->dispatch( - new SetUserPreferenceEvent(...$eventData), - SetUserPreferenceEventInterface::class + new SetUserPreferenceEvent(...$eventData) ); } } diff --git a/eZ/Publish/Core/Event/UserService.php b/eZ/Publish/Core/Event/UserService.php index 17c0f450972..a9f2d1fbf6b 100644 --- a/eZ/Publish/Core/Event/UserService.php +++ b/eZ/Publish/Core/Event/UserService.php @@ -8,26 +8,6 @@ namespace eZ\Publish\Core\Event; -use eZ\Publish\API\Repository\Events\User\AssignUserToUserGroupEvent as AssignUserToUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeAssignUserToUserGroupEvent as BeforeAssignUserToUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeCreateUserEvent as BeforeCreateUserEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeCreateUserGroupEvent as BeforeCreateUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeDeleteUserEvent as BeforeDeleteUserEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeDeleteUserGroupEvent as BeforeDeleteUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeMoveUserGroupEvent as BeforeMoveUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeUnAssignUserFromUserGroupEvent as BeforeUnAssignUserFromUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeUpdateUserEvent as BeforeUpdateUserEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeUpdateUserGroupEvent as BeforeUpdateUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\BeforeUpdateUserTokenEvent as BeforeUpdateUserTokenEventInterface; -use eZ\Publish\API\Repository\Events\User\CreateUserEvent as CreateUserEventInterface; -use eZ\Publish\API\Repository\Events\User\CreateUserGroupEvent as CreateUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\DeleteUserEvent as DeleteUserEventInterface; -use eZ\Publish\API\Repository\Events\User\DeleteUserGroupEvent as DeleteUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\MoveUserGroupEvent as MoveUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\UnAssignUserFromUserGroupEvent as UnAssignUserFromUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\UpdateUserEvent as UpdateUserEventInterface; -use eZ\Publish\API\Repository\Events\User\UpdateUserGroupEvent as UpdateUserGroupEventInterface; -use eZ\Publish\API\Repository\Events\User\UpdateUserTokenEvent as UpdateUserTokenEventInterface; use eZ\Publish\API\Repository\UserService as UserServiceInterface; use eZ\Publish\API\Repository\Values\User\User; use eZ\Publish\API\Repository\Values\User\UserCreateStruct; @@ -84,7 +64,7 @@ public function createUserGroup( $beforeEvent = new BeforeCreateUserGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateUserGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUserGroup(); } @@ -94,8 +74,7 @@ public function createUserGroup( : $this->innerService->createUserGroup($userGroupCreateStruct, $parentGroup); $this->eventDispatcher->dispatch( - new CreateUserGroupEvent($userGroup, ...$eventData), - CreateUserGroupEventInterface::class + new CreateUserGroupEvent($userGroup, ...$eventData) ); return $userGroup; @@ -107,7 +86,7 @@ public function deleteUserGroup(UserGroup $userGroup) $beforeEvent = new BeforeDeleteUserGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteUserGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getLocations(); } @@ -117,8 +96,7 @@ public function deleteUserGroup(UserGroup $userGroup) : $this->innerService->deleteUserGroup($userGroup); $this->eventDispatcher->dispatch( - new DeleteUserGroupEvent($locations, ...$eventData), - DeleteUserGroupEventInterface::class + new DeleteUserGroupEvent($locations, ...$eventData) ); return $locations; @@ -135,7 +113,7 @@ public function moveUserGroup( $beforeEvent = new BeforeMoveUserGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeMoveUserGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -143,8 +121,7 @@ public function moveUserGroup( $this->innerService->moveUserGroup($userGroup, $newParent); $this->eventDispatcher->dispatch( - new MoveUserGroupEvent(...$eventData), - MoveUserGroupEventInterface::class + new MoveUserGroupEvent(...$eventData) ); } @@ -159,7 +136,7 @@ public function updateUserGroup( $beforeEvent = new BeforeUpdateUserGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateUserGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedUserGroup(); } @@ -169,8 +146,7 @@ public function updateUserGroup( : $this->innerService->updateUserGroup($userGroup, $userGroupUpdateStruct); $this->eventDispatcher->dispatch( - new UpdateUserGroupEvent($updatedUserGroup, ...$eventData), - UpdateUserGroupEventInterface::class + new UpdateUserGroupEvent($updatedUserGroup, ...$eventData) ); return $updatedUserGroup; @@ -187,7 +163,7 @@ public function createUser( $beforeEvent = new BeforeCreateUserEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeCreateUserEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUser(); } @@ -197,8 +173,7 @@ public function createUser( : $this->innerService->createUser($userCreateStruct, $parentGroups); $this->eventDispatcher->dispatch( - new CreateUserEvent($user, ...$eventData), - CreateUserEventInterface::class + new CreateUserEvent($user, ...$eventData) ); return $user; @@ -210,7 +185,7 @@ public function deleteUser(User $user) $beforeEvent = new BeforeDeleteUserEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeDeleteUserEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getLocations(); } @@ -220,8 +195,7 @@ public function deleteUser(User $user) : $this->innerService->deleteUser($user); $this->eventDispatcher->dispatch( - new DeleteUserEvent($locations, ...$eventData), - DeleteUserEventInterface::class + new DeleteUserEvent($locations, ...$eventData) ); return $locations; @@ -238,7 +212,7 @@ public function updateUser( $beforeEvent = new BeforeUpdateUserEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateUserEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedUser(); } @@ -248,8 +222,7 @@ public function updateUser( : $this->innerService->updateUser($user, $userUpdateStruct); $this->eventDispatcher->dispatch( - new UpdateUserEvent($updatedUser, ...$eventData), - UpdateUserEventInterface::class + new UpdateUserEvent($updatedUser, ...$eventData) ); return $updatedUser; @@ -266,7 +239,7 @@ public function updateUserToken( $beforeEvent = new BeforeUpdateUserTokenEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateUserTokenEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return $beforeEvent->getUpdatedUser(); } @@ -276,8 +249,7 @@ public function updateUserToken( : $this->innerService->updateUserToken($user, $userTokenUpdateStruct); $this->eventDispatcher->dispatch( - new UpdateUserTokenEvent($updatedUser, ...$eventData), - UpdateUserTokenEventInterface::class + new UpdateUserTokenEvent($updatedUser, ...$eventData) ); return $updatedUser; @@ -294,7 +266,7 @@ public function assignUserToUserGroup( $beforeEvent = new BeforeAssignUserToUserGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeAssignUserToUserGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -302,8 +274,7 @@ public function assignUserToUserGroup( $this->innerService->assignUserToUserGroup($user, $userGroup); $this->eventDispatcher->dispatch( - new AssignUserToUserGroupEvent(...$eventData), - AssignUserToUserGroupEventInterface::class + new AssignUserToUserGroupEvent(...$eventData) ); } @@ -318,7 +289,7 @@ public function unAssignUserFromUserGroup( $beforeEvent = new BeforeUnAssignUserFromUserGroupEvent(...$eventData); - $this->eventDispatcher->dispatch($beforeEvent, BeforeUnAssignUserFromUserGroupEventInterface::class); + $this->eventDispatcher->dispatch($beforeEvent); if ($beforeEvent->isPropagationStopped()) { return; } @@ -326,8 +297,7 @@ public function unAssignUserFromUserGroup( $this->innerService->unAssignUserFromUserGroup($user, $userGroup); $this->eventDispatcher->dispatch( - new UnAssignUserFromUserGroupEvent(...$eventData), - UnAssignUserFromUserGroupEventInterface::class + new UnAssignUserFromUserGroupEvent(...$eventData) ); } }