| @@ 381-412 (lines=32) @@ | ||
| 378 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 379 | } |
|
| 380 | ||
| 381 | public function testDeleteRelationStopPropagationInBeforeEvents() |
|
| 382 | { |
|
| 383 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 384 | BeforeDeleteRelationEventInterface::class, |
|
| 385 | DeleteRelationEventInterface::class |
|
| 386 | ); |
|
| 387 | ||
| 388 | $parameters = [ |
|
| 389 | $this->createMock(VersionInfo::class), |
|
| 390 | $this->createMock(ContentInfo::class), |
|
| 391 | ]; |
|
| 392 | ||
| 393 | $innerServiceMock = $this->createMock(ContentServiceInterface::class); |
|
| 394 | ||
| 395 | $traceableEventDispatcher->addListener(BeforeDeleteRelationEventInterface::class, function (BeforeDeleteRelationEventInterface $event) { |
|
| 396 | $event->stopPropagation(); |
|
| 397 | }, 10); |
|
| 398 | ||
| 399 | $service = new ContentService($innerServiceMock, $traceableEventDispatcher); |
|
| 400 | $service->deleteRelation(...$parameters); |
|
| 401 | ||
| 402 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 403 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 404 | ||
| 405 | $this->assertSame($calledListeners, [ |
|
| 406 | [BeforeDeleteRelationEventInterface::class, 10], |
|
| 407 | ]); |
|
| 408 | $this->assertSame($notCalledListeners, [ |
|
| 409 | [BeforeDeleteRelationEventInterface::class, 0], |
|
| 410 | [DeleteRelationEventInterface::class, 0], |
|
| 411 | ]); |
|
| 412 | } |
|
| 413 | ||
| 414 | public function testCreateContentEvents() |
|
| 415 | { |
|
| @@ 81-112 (lines=32) @@ | ||
| 78 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 79 | } |
|
| 80 | ||
| 81 | public function testAddFieldDefinitionStopPropagationInBeforeEvents() |
|
| 82 | { |
|
| 83 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 84 | BeforeAddFieldDefinitionEventInterface::class, |
|
| 85 | AddFieldDefinitionEventInterface::class |
|
| 86 | ); |
|
| 87 | ||
| 88 | $parameters = [ |
|
| 89 | $this->createMock(ContentTypeDraft::class), |
|
| 90 | $this->createMock(FieldDefinitionCreateStruct::class), |
|
| 91 | ]; |
|
| 92 | ||
| 93 | $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); |
|
| 94 | ||
| 95 | $traceableEventDispatcher->addListener(BeforeAddFieldDefinitionEventInterface::class, function (BeforeAddFieldDefinitionEventInterface $event) { |
|
| 96 | $event->stopPropagation(); |
|
| 97 | }, 10); |
|
| 98 | ||
| 99 | $service = new ContentTypeService($innerServiceMock, $traceableEventDispatcher); |
|
| 100 | $service->addFieldDefinition(...$parameters); |
|
| 101 | ||
| 102 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 103 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 104 | ||
| 105 | $this->assertSame($calledListeners, [ |
|
| 106 | [BeforeAddFieldDefinitionEventInterface::class, 10], |
|
| 107 | ]); |
|
| 108 | $this->assertSame($notCalledListeners, [ |
|
| 109 | [AddFieldDefinitionEventInterface::class, 0], |
|
| 110 | [BeforeAddFieldDefinitionEventInterface::class, 0], |
|
| 111 | ]); |
|
| 112 | } |
|
| 113 | ||
| 114 | public function testDeleteContentTypeGroupEvents() |
|
| 115 | { |
|
| @@ 395-426 (lines=32) @@ | ||
| 392 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 393 | } |
|
| 394 | ||
| 395 | public function testUpdateContentTypeGroupStopPropagationInBeforeEvents() |
|
| 396 | { |
|
| 397 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 398 | BeforeUpdateContentTypeGroupEventInterface::class, |
|
| 399 | UpdateContentTypeGroupEventInterface::class |
|
| 400 | ); |
|
| 401 | ||
| 402 | $parameters = [ |
|
| 403 | $this->createMock(ContentTypeGroup::class), |
|
| 404 | $this->createMock(ContentTypeGroupUpdateStruct::class), |
|
| 405 | ]; |
|
| 406 | ||
| 407 | $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); |
|
| 408 | ||
| 409 | $traceableEventDispatcher->addListener(BeforeUpdateContentTypeGroupEventInterface::class, function (BeforeUpdateContentTypeGroupEventInterface $event) { |
|
| 410 | $event->stopPropagation(); |
|
| 411 | }, 10); |
|
| 412 | ||
| 413 | $service = new ContentTypeService($innerServiceMock, $traceableEventDispatcher); |
|
| 414 | $service->updateContentTypeGroup(...$parameters); |
|
| 415 | ||
| 416 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 417 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 418 | ||
| 419 | $this->assertSame($calledListeners, [ |
|
| 420 | [BeforeUpdateContentTypeGroupEventInterface::class, 10], |
|
| 421 | ]); |
|
| 422 | $this->assertSame($notCalledListeners, [ |
|
| 423 | [BeforeUpdateContentTypeGroupEventInterface::class, 0], |
|
| 424 | [UpdateContentTypeGroupEventInterface::class, 0], |
|
| 425 | ]); |
|
| 426 | } |
|
| 427 | ||
| 428 | public function testCreateContentTypeEvents() |
|
| 429 | { |
|
| @@ 658-689 (lines=32) @@ | ||
| 655 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 656 | } |
|
| 657 | ||
| 658 | public function testUnassignContentTypeGroupStopPropagationInBeforeEvents() |
|
| 659 | { |
|
| 660 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 661 | BeforeUnassignContentTypeGroupEventInterface::class, |
|
| 662 | UnassignContentTypeGroupEventInterface::class |
|
| 663 | ); |
|
| 664 | ||
| 665 | $parameters = [ |
|
| 666 | $this->createMock(ContentType::class), |
|
| 667 | $this->createMock(ContentTypeGroup::class), |
|
| 668 | ]; |
|
| 669 | ||
| 670 | $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); |
|
| 671 | ||
| 672 | $traceableEventDispatcher->addListener(BeforeUnassignContentTypeGroupEventInterface::class, function (BeforeUnassignContentTypeGroupEventInterface $event) { |
|
| 673 | $event->stopPropagation(); |
|
| 674 | }, 10); |
|
| 675 | ||
| 676 | $service = new ContentTypeService($innerServiceMock, $traceableEventDispatcher); |
|
| 677 | $service->unassignContentTypeGroup(...$parameters); |
|
| 678 | ||
| 679 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 680 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 681 | ||
| 682 | $this->assertSame($calledListeners, [ |
|
| 683 | [BeforeUnassignContentTypeGroupEventInterface::class, 10], |
|
| 684 | ]); |
|
| 685 | $this->assertSame($notCalledListeners, [ |
|
| 686 | [BeforeUnassignContentTypeGroupEventInterface::class, 0], |
|
| 687 | [UnassignContentTypeGroupEventInterface::class, 0], |
|
| 688 | ]); |
|
| 689 | } |
|
| 690 | ||
| 691 | public function testPublishContentTypeDraftEvents() |
|
| 692 | { |
|
| @@ 775-807 (lines=33) @@ | ||
| 772 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 773 | } |
|
| 774 | ||
| 775 | public function testUpdateFieldDefinitionStopPropagationInBeforeEvents() |
|
| 776 | { |
|
| 777 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 778 | BeforeUpdateFieldDefinitionEventInterface::class, |
|
| 779 | UpdateFieldDefinitionEventInterface::class |
|
| 780 | ); |
|
| 781 | ||
| 782 | $parameters = [ |
|
| 783 | $this->createMock(ContentTypeDraft::class), |
|
| 784 | $this->createMock(FieldDefinition::class), |
|
| 785 | $this->createMock(FieldDefinitionUpdateStruct::class), |
|
| 786 | ]; |
|
| 787 | ||
| 788 | $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); |
|
| 789 | ||
| 790 | $traceableEventDispatcher->addListener(BeforeUpdateFieldDefinitionEventInterface::class, function (BeforeUpdateFieldDefinitionEventInterface $event) { |
|
| 791 | $event->stopPropagation(); |
|
| 792 | }, 10); |
|
| 793 | ||
| 794 | $service = new ContentTypeService($innerServiceMock, $traceableEventDispatcher); |
|
| 795 | $service->updateFieldDefinition(...$parameters); |
|
| 796 | ||
| 797 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 798 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 799 | ||
| 800 | $this->assertSame($calledListeners, [ |
|
| 801 | [BeforeUpdateFieldDefinitionEventInterface::class, 10], |
|
| 802 | ]); |
|
| 803 | $this->assertSame($notCalledListeners, [ |
|
| 804 | [BeforeUpdateFieldDefinitionEventInterface::class, 0], |
|
| 805 | [UpdateFieldDefinitionEventInterface::class, 0], |
|
| 806 | ]); |
|
| 807 | } |
|
| 808 | ||
| 809 | public function testRemoveFieldDefinitionEvents() |
|
| 810 | { |
|
| @@ 835-866 (lines=32) @@ | ||
| 832 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 833 | } |
|
| 834 | ||
| 835 | public function testRemoveFieldDefinitionStopPropagationInBeforeEvents() |
|
| 836 | { |
|
| 837 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 838 | BeforeRemoveFieldDefinitionEventInterface::class, |
|
| 839 | RemoveFieldDefinitionEventInterface::class |
|
| 840 | ); |
|
| 841 | ||
| 842 | $parameters = [ |
|
| 843 | $this->createMock(ContentTypeDraft::class), |
|
| 844 | $this->createMock(FieldDefinition::class), |
|
| 845 | ]; |
|
| 846 | ||
| 847 | $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); |
|
| 848 | ||
| 849 | $traceableEventDispatcher->addListener(BeforeRemoveFieldDefinitionEventInterface::class, function (BeforeRemoveFieldDefinitionEventInterface $event) { |
|
| 850 | $event->stopPropagation(); |
|
| 851 | }, 10); |
|
| 852 | ||
| 853 | $service = new ContentTypeService($innerServiceMock, $traceableEventDispatcher); |
|
| 854 | $service->removeFieldDefinition(...$parameters); |
|
| 855 | ||
| 856 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 857 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 858 | ||
| 859 | $this->assertSame($calledListeners, [ |
|
| 860 | [BeforeRemoveFieldDefinitionEventInterface::class, 10], |
|
| 861 | ]); |
|
| 862 | $this->assertSame($notCalledListeners, [ |
|
| 863 | [BeforeRemoveFieldDefinitionEventInterface::class, 0], |
|
| 864 | [RemoveFieldDefinitionEventInterface::class, 0], |
|
| 865 | ]); |
|
| 866 | } |
|
| 867 | ||
| 868 | public function testAssignContentTypeGroupEvents() |
|
| 869 | { |
|
| @@ 894-925 (lines=32) @@ | ||
| 891 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 892 | } |
|
| 893 | ||
| 894 | public function testAssignContentTypeGroupStopPropagationInBeforeEvents() |
|
| 895 | { |
|
| 896 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 897 | BeforeAssignContentTypeGroupEventInterface::class, |
|
| 898 | AssignContentTypeGroupEventInterface::class |
|
| 899 | ); |
|
| 900 | ||
| 901 | $parameters = [ |
|
| 902 | $this->createMock(ContentType::class), |
|
| 903 | $this->createMock(ContentTypeGroup::class), |
|
| 904 | ]; |
|
| 905 | ||
| 906 | $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); |
|
| 907 | ||
| 908 | $traceableEventDispatcher->addListener(BeforeAssignContentTypeGroupEventInterface::class, function (BeforeAssignContentTypeGroupEventInterface $event) { |
|
| 909 | $event->stopPropagation(); |
|
| 910 | }, 10); |
|
| 911 | ||
| 912 | $service = new ContentTypeService($innerServiceMock, $traceableEventDispatcher); |
|
| 913 | $service->assignContentTypeGroup(...$parameters); |
|
| 914 | ||
| 915 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 916 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 917 | ||
| 918 | $this->assertSame($calledListeners, [ |
|
| 919 | [BeforeAssignContentTypeGroupEventInterface::class, 10], |
|
| 920 | ]); |
|
| 921 | $this->assertSame($notCalledListeners, [ |
|
| 922 | [AssignContentTypeGroupEventInterface::class, 0], |
|
| 923 | [BeforeAssignContentTypeGroupEventInterface::class, 0], |
|
| 924 | ]); |
|
| 925 | } |
|
| 926 | ||
| 927 | public function testUpdateContentTypeDraftEvents() |
|
| 928 | { |
|
| @@ 953-984 (lines=32) @@ | ||
| 950 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 951 | } |
|
| 952 | ||
| 953 | public function testUpdateContentTypeDraftStopPropagationInBeforeEvents() |
|
| 954 | { |
|
| 955 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 956 | BeforeUpdateContentTypeDraftEventInterface::class, |
|
| 957 | UpdateContentTypeDraftEventInterface::class |
|
| 958 | ); |
|
| 959 | ||
| 960 | $parameters = [ |
|
| 961 | $this->createMock(ContentTypeDraft::class), |
|
| 962 | $this->createMock(ContentTypeUpdateStruct::class), |
|
| 963 | ]; |
|
| 964 | ||
| 965 | $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); |
|
| 966 | ||
| 967 | $traceableEventDispatcher->addListener(BeforeUpdateContentTypeDraftEventInterface::class, function (BeforeUpdateContentTypeDraftEventInterface $event) { |
|
| 968 | $event->stopPropagation(); |
|
| 969 | }, 10); |
|
| 970 | ||
| 971 | $service = new ContentTypeService($innerServiceMock, $traceableEventDispatcher); |
|
| 972 | $service->updateContentTypeDraft(...$parameters); |
|
| 973 | ||
| 974 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 975 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 976 | ||
| 977 | $this->assertSame($calledListeners, [ |
|
| 978 | [BeforeUpdateContentTypeDraftEventInterface::class, 10], |
|
| 979 | ]); |
|
| 980 | $this->assertSame($notCalledListeners, [ |
|
| 981 | [BeforeUpdateContentTypeDraftEventInterface::class, 0], |
|
| 982 | [UpdateContentTypeDraftEventInterface::class, 0], |
|
| 983 | ]); |
|
| 984 | } |
|
| 985 | ||
| 986 | public function testDeleteContentTypeEvents() |
|
| 987 | { |
|
| @@ 417-448 (lines=32) @@ | ||
| 414 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 415 | } |
|
| 416 | ||
| 417 | public function testSwapLocationStopPropagationInBeforeEvents() |
|
| 418 | { |
|
| 419 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 420 | BeforeSwapLocationEventInterface::class, |
|
| 421 | SwapLocationEventInterface::class |
|
| 422 | ); |
|
| 423 | ||
| 424 | $parameters = [ |
|
| 425 | $this->createMock(Location::class), |
|
| 426 | $this->createMock(Location::class), |
|
| 427 | ]; |
|
| 428 | ||
| 429 | $innerServiceMock = $this->createMock(LocationServiceInterface::class); |
|
| 430 | ||
| 431 | $traceableEventDispatcher->addListener(BeforeSwapLocationEventInterface::class, function (BeforeSwapLocationEventInterface $event) { |
|
| 432 | $event->stopPropagation(); |
|
| 433 | }, 10); |
|
| 434 | ||
| 435 | $service = new LocationService($innerServiceMock, $traceableEventDispatcher); |
|
| 436 | $service->swapLocation(...$parameters); |
|
| 437 | ||
| 438 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 439 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 440 | ||
| 441 | $this->assertSame($calledListeners, [ |
|
| 442 | [BeforeSwapLocationEventInterface::class, 10], |
|
| 443 | ]); |
|
| 444 | $this->assertSame($notCalledListeners, [ |
|
| 445 | [BeforeSwapLocationEventInterface::class, 0], |
|
| 446 | [SwapLocationEventInterface::class, 0], |
|
| 447 | ]); |
|
| 448 | } |
|
| 449 | ||
| 450 | public function testMoveSubtreeEvents() |
|
| 451 | { |
|
| @@ 476-507 (lines=32) @@ | ||
| 473 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 474 | } |
|
| 475 | ||
| 476 | public function testMoveSubtreeStopPropagationInBeforeEvents() |
|
| 477 | { |
|
| 478 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 479 | BeforeMoveSubtreeEventInterface::class, |
|
| 480 | MoveSubtreeEventInterface::class |
|
| 481 | ); |
|
| 482 | ||
| 483 | $parameters = [ |
|
| 484 | $this->createMock(Location::class), |
|
| 485 | $this->createMock(Location::class), |
|
| 486 | ]; |
|
| 487 | ||
| 488 | $innerServiceMock = $this->createMock(LocationServiceInterface::class); |
|
| 489 | ||
| 490 | $traceableEventDispatcher->addListener(BeforeMoveSubtreeEventInterface::class, function (BeforeMoveSubtreeEventInterface $event) { |
|
| 491 | $event->stopPropagation(); |
|
| 492 | }, 10); |
|
| 493 | ||
| 494 | $service = new LocationService($innerServiceMock, $traceableEventDispatcher); |
|
| 495 | $service->moveSubtree(...$parameters); |
|
| 496 | ||
| 497 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 498 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 499 | ||
| 500 | $this->assertSame($calledListeners, [ |
|
| 501 | [BeforeMoveSubtreeEventInterface::class, 10], |
|
| 502 | ]); |
|
| 503 | $this->assertSame($notCalledListeners, [ |
|
| 504 | [BeforeMoveSubtreeEventInterface::class, 0], |
|
| 505 | [MoveSubtreeEventInterface::class, 0], |
|
| 506 | ]); |
|
| 507 | } |
|
| 508 | ||
| 509 | public function testUpdateLocationEvents() |
|
| 510 | { |
|
| @@ 64-96 (lines=33) @@ | ||
| 61 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 62 | } |
|
| 63 | ||
| 64 | public function testSetContentStateStopPropagationInBeforeEvents() |
|
| 65 | { |
|
| 66 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 67 | BeforeSetContentStateEventInterface::class, |
|
| 68 | SetContentStateEventInterface::class |
|
| 69 | ); |
|
| 70 | ||
| 71 | $parameters = [ |
|
| 72 | $this->createMock(ContentInfo::class), |
|
| 73 | $this->createMock(ObjectStateGroup::class), |
|
| 74 | $this->createMock(ObjectState::class), |
|
| 75 | ]; |
|
| 76 | ||
| 77 | $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); |
|
| 78 | ||
| 79 | $traceableEventDispatcher->addListener(BeforeSetContentStateEventInterface::class, function (BeforeSetContentStateEventInterface $event) { |
|
| 80 | $event->stopPropagation(); |
|
| 81 | }, 10); |
|
| 82 | ||
| 83 | $service = new ObjectStateService($innerServiceMock, $traceableEventDispatcher); |
|
| 84 | $service->setContentState(...$parameters); |
|
| 85 | ||
| 86 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 87 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 88 | ||
| 89 | $this->assertSame($calledListeners, [ |
|
| 90 | [BeforeSetContentStateEventInterface::class, 10], |
|
| 91 | ]); |
|
| 92 | $this->assertSame($notCalledListeners, [ |
|
| 93 | [BeforeSetContentStateEventInterface::class, 0], |
|
| 94 | [SetContentStateEventInterface::class, 0], |
|
| 95 | ]); |
|
| 96 | } |
|
| 97 | ||
| 98 | public function testCreateObjectStateGroupEvents() |
|
| 99 | { |
|
| @@ 305-337 (lines=33) @@ | ||
| 302 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 303 | } |
|
| 304 | ||
| 305 | public function testAssignRoleToUserStopPropagationInBeforeEvents() |
|
| 306 | { |
|
| 307 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 308 | BeforeAssignRoleToUserEventInterface::class, |
|
| 309 | AssignRoleToUserEventInterface::class |
|
| 310 | ); |
|
| 311 | ||
| 312 | $parameters = [ |
|
| 313 | $this->createMock(Role::class), |
|
| 314 | $this->createMock(User::class), |
|
| 315 | $this->createMock(RoleLimitation::class), |
|
| 316 | ]; |
|
| 317 | ||
| 318 | $innerServiceMock = $this->createMock(RoleServiceInterface::class); |
|
| 319 | ||
| 320 | $traceableEventDispatcher->addListener(BeforeAssignRoleToUserEventInterface::class, function (BeforeAssignRoleToUserEventInterface $event) { |
|
| 321 | $event->stopPropagation(); |
|
| 322 | }, 10); |
|
| 323 | ||
| 324 | $service = new RoleService($innerServiceMock, $traceableEventDispatcher); |
|
| 325 | $service->assignRoleToUser(...$parameters); |
|
| 326 | ||
| 327 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 328 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 329 | ||
| 330 | $this->assertSame($calledListeners, [ |
|
| 331 | [BeforeAssignRoleToUserEventInterface::class, 10], |
|
| 332 | ]); |
|
| 333 | $this->assertSame($notCalledListeners, [ |
|
| 334 | [AssignRoleToUserEventInterface::class, 0], |
|
| 335 | [BeforeAssignRoleToUserEventInterface::class, 0], |
|
| 336 | ]); |
|
| 337 | } |
|
| 338 | ||
| 339 | public function testAddPolicyEvents() |
|
| 340 | { |
|
| @@ 570-602 (lines=33) @@ | ||
| 567 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 568 | } |
|
| 569 | ||
| 570 | public function testAssignRoleToUserGroupStopPropagationInBeforeEvents() |
|
| 571 | { |
|
| 572 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 573 | BeforeAssignRoleToUserGroupEventInterface::class, |
|
| 574 | AssignRoleToUserGroupEventInterface::class |
|
| 575 | ); |
|
| 576 | ||
| 577 | $parameters = [ |
|
| 578 | $this->createMock(Role::class), |
|
| 579 | $this->createMock(UserGroup::class), |
|
| 580 | $this->createMock(RoleLimitation::class), |
|
| 581 | ]; |
|
| 582 | ||
| 583 | $innerServiceMock = $this->createMock(RoleServiceInterface::class); |
|
| 584 | ||
| 585 | $traceableEventDispatcher->addListener(BeforeAssignRoleToUserGroupEventInterface::class, function (BeforeAssignRoleToUserGroupEventInterface $event) { |
|
| 586 | $event->stopPropagation(); |
|
| 587 | }, 10); |
|
| 588 | ||
| 589 | $service = new RoleService($innerServiceMock, $traceableEventDispatcher); |
|
| 590 | $service->assignRoleToUserGroup(...$parameters); |
|
| 591 | ||
| 592 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 593 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 594 | ||
| 595 | $this->assertSame($calledListeners, [ |
|
| 596 | [BeforeAssignRoleToUserGroupEventInterface::class, 10], |
|
| 597 | ]); |
|
| 598 | $this->assertSame($notCalledListeners, [ |
|
| 599 | [AssignRoleToUserGroupEventInterface::class, 0], |
|
| 600 | [BeforeAssignRoleToUserGroupEventInterface::class, 0], |
|
| 601 | ]); |
|
| 602 | } |
|
| 603 | ||
| 604 | public function testUnassignRoleFromUserEvents() |
|
| 605 | { |
|
| @@ 630-661 (lines=32) @@ | ||
| 627 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 628 | } |
|
| 629 | ||
| 630 | public function testUnassignRoleFromUserStopPropagationInBeforeEvents() |
|
| 631 | { |
|
| 632 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 633 | BeforeUnassignRoleFromUserEventInterface::class, |
|
| 634 | UnassignRoleFromUserEventInterface::class |
|
| 635 | ); |
|
| 636 | ||
| 637 | $parameters = [ |
|
| 638 | $this->createMock(Role::class), |
|
| 639 | $this->createMock(User::class), |
|
| 640 | ]; |
|
| 641 | ||
| 642 | $innerServiceMock = $this->createMock(RoleServiceInterface::class); |
|
| 643 | ||
| 644 | $traceableEventDispatcher->addListener(BeforeUnassignRoleFromUserEventInterface::class, function (BeforeUnassignRoleFromUserEventInterface $event) { |
|
| 645 | $event->stopPropagation(); |
|
| 646 | }, 10); |
|
| 647 | ||
| 648 | $service = new RoleService($innerServiceMock, $traceableEventDispatcher); |
|
| 649 | $service->unassignRoleFromUser(...$parameters); |
|
| 650 | ||
| 651 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 652 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 653 | ||
| 654 | $this->assertSame($calledListeners, [ |
|
| 655 | [BeforeUnassignRoleFromUserEventInterface::class, 10], |
|
| 656 | ]); |
|
| 657 | $this->assertSame($notCalledListeners, [ |
|
| 658 | [BeforeUnassignRoleFromUserEventInterface::class, 0], |
|
| 659 | [UnassignRoleFromUserEventInterface::class, 0], |
|
| 660 | ]); |
|
| 661 | } |
|
| 662 | ||
| 663 | public function testUpdatePolicyByRoleDraftEvents() |
|
| 664 | { |
|
| @@ 1469-1500 (lines=32) @@ | ||
| 1466 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 1467 | } |
|
| 1468 | ||
| 1469 | public function testUnassignRoleFromUserGroupStopPropagationInBeforeEvents() |
|
| 1470 | { |
|
| 1471 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 1472 | BeforeUnassignRoleFromUserGroupEventInterface::class, |
|
| 1473 | UnassignRoleFromUserGroupEventInterface::class |
|
| 1474 | ); |
|
| 1475 | ||
| 1476 | $parameters = [ |
|
| 1477 | $this->createMock(Role::class), |
|
| 1478 | $this->createMock(UserGroup::class), |
|
| 1479 | ]; |
|
| 1480 | ||
| 1481 | $innerServiceMock = $this->createMock(RoleServiceInterface::class); |
|
| 1482 | ||
| 1483 | $traceableEventDispatcher->addListener(BeforeUnassignRoleFromUserGroupEventInterface::class, function (BeforeUnassignRoleFromUserGroupEventInterface $event) { |
|
| 1484 | $event->stopPropagation(); |
|
| 1485 | }, 10); |
|
| 1486 | ||
| 1487 | $service = new RoleService($innerServiceMock, $traceableEventDispatcher); |
|
| 1488 | $service->unassignRoleFromUserGroup(...$parameters); |
|
| 1489 | ||
| 1490 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 1491 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 1492 | ||
| 1493 | $this->assertSame($calledListeners, [ |
|
| 1494 | [BeforeUnassignRoleFromUserGroupEventInterface::class, 10], |
|
| 1495 | ]); |
|
| 1496 | $this->assertSame($notCalledListeners, [ |
|
| 1497 | [BeforeUnassignRoleFromUserGroupEventInterface::class, 0], |
|
| 1498 | [UnassignRoleFromUserGroupEventInterface::class, 0], |
|
| 1499 | ]); |
|
| 1500 | } |
|
| 1501 | } |
|
| 1502 | ||
| @@ 55-86 (lines=32) @@ | ||
| 52 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 53 | } |
|
| 54 | ||
| 55 | public function testAssignSectionStopPropagationInBeforeEvents() |
|
| 56 | { |
|
| 57 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 58 | BeforeAssignSectionEventInterface::class, |
|
| 59 | AssignSectionEventInterface::class |
|
| 60 | ); |
|
| 61 | ||
| 62 | $parameters = [ |
|
| 63 | $this->createMock(ContentInfo::class), |
|
| 64 | $this->createMock(Section::class), |
|
| 65 | ]; |
|
| 66 | ||
| 67 | $innerServiceMock = $this->createMock(SectionServiceInterface::class); |
|
| 68 | ||
| 69 | $traceableEventDispatcher->addListener(BeforeAssignSectionEventInterface::class, function (BeforeAssignSectionEventInterface $event) { |
|
| 70 | $event->stopPropagation(); |
|
| 71 | }, 10); |
|
| 72 | ||
| 73 | $service = new SectionService($innerServiceMock, $traceableEventDispatcher); |
|
| 74 | $service->assignSection(...$parameters); |
|
| 75 | ||
| 76 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 77 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 78 | ||
| 79 | $this->assertSame($calledListeners, [ |
|
| 80 | [BeforeAssignSectionEventInterface::class, 10], |
|
| 81 | ]); |
|
| 82 | $this->assertSame($notCalledListeners, [ |
|
| 83 | [AssignSectionEventInterface::class, 0], |
|
| 84 | [BeforeAssignSectionEventInterface::class, 0], |
|
| 85 | ]); |
|
| 86 | } |
|
| 87 | ||
| 88 | public function testUpdateSectionEvents() |
|
| 89 | { |
|
| @@ 216-247 (lines=32) @@ | ||
| 213 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 214 | } |
|
| 215 | ||
| 216 | public function testAssignSectionToSubtreeStopPropagationInBeforeEvents() |
|
| 217 | { |
|
| 218 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 219 | BeforeAssignSectionToSubtreeEventInterface::class, |
|
| 220 | AssignSectionToSubtreeEventInterface::class |
|
| 221 | ); |
|
| 222 | ||
| 223 | $parameters = [ |
|
| 224 | $this->createMock(Location::class), |
|
| 225 | $this->createMock(Section::class), |
|
| 226 | ]; |
|
| 227 | ||
| 228 | $innerServiceMock = $this->createMock(SectionServiceInterface::class); |
|
| 229 | ||
| 230 | $traceableEventDispatcher->addListener(BeforeAssignSectionToSubtreeEventInterface::class, function (BeforeAssignSectionToSubtreeEventInterface $event) { |
|
| 231 | $event->stopPropagation(); |
|
| 232 | }, 10); |
|
| 233 | ||
| 234 | $service = new SectionService($innerServiceMock, $traceableEventDispatcher); |
|
| 235 | $service->assignSectionToSubtree(...$parameters); |
|
| 236 | ||
| 237 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 238 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 239 | ||
| 240 | $this->assertSame($calledListeners, [ |
|
| 241 | [BeforeAssignSectionToSubtreeEventInterface::class, 10], |
|
| 242 | ]); |
|
| 243 | $this->assertSame($notCalledListeners, [ |
|
| 244 | [AssignSectionToSubtreeEventInterface::class, 0], |
|
| 245 | [BeforeAssignSectionToSubtreeEventInterface::class, 0], |
|
| 246 | ]); |
|
| 247 | } |
|
| 248 | ||
| 249 | public function testDeleteSectionEvents() |
|
| 250 | { |
|
| @@ 271-302 (lines=32) @@ | ||
| 268 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 269 | } |
|
| 270 | ||
| 271 | public function testUnAssignUserFromUserGroupStopPropagationInBeforeEvents() |
|
| 272 | { |
|
| 273 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 274 | BeforeUnAssignUserFromUserGroupEventInterface::class, |
|
| 275 | UnAssignUserFromUserGroupEventInterface::class |
|
| 276 | ); |
|
| 277 | ||
| 278 | $parameters = [ |
|
| 279 | $this->createMock(User::class), |
|
| 280 | $this->createMock(UserGroup::class), |
|
| 281 | ]; |
|
| 282 | ||
| 283 | $innerServiceMock = $this->createMock(UserServiceInterface::class); |
|
| 284 | ||
| 285 | $traceableEventDispatcher->addListener(BeforeUnAssignUserFromUserGroupEventInterface::class, function (BeforeUnAssignUserFromUserGroupEventInterface $event) { |
|
| 286 | $event->stopPropagation(); |
|
| 287 | }, 10); |
|
| 288 | ||
| 289 | $service = new UserService($innerServiceMock, $traceableEventDispatcher); |
|
| 290 | $service->unAssignUserFromUserGroup(...$parameters); |
|
| 291 | ||
| 292 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 293 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 294 | ||
| 295 | $this->assertSame($calledListeners, [ |
|
| 296 | [BeforeUnAssignUserFromUserGroupEventInterface::class, 10], |
|
| 297 | ]); |
|
| 298 | $this->assertSame($notCalledListeners, [ |
|
| 299 | [BeforeUnAssignUserFromUserGroupEventInterface::class, 0], |
|
| 300 | [UnAssignUserFromUserGroupEventInterface::class, 0], |
|
| 301 | ]); |
|
| 302 | } |
|
| 303 | ||
| 304 | public function testDeleteUserGroupEvents() |
|
| 305 | { |
|
| @@ 429-460 (lines=32) @@ | ||
| 426 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 427 | } |
|
| 428 | ||
| 429 | public function testAssignUserToUserGroupStopPropagationInBeforeEvents() |
|
| 430 | { |
|
| 431 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 432 | BeforeAssignUserToUserGroupEventInterface::class, |
|
| 433 | AssignUserToUserGroupEventInterface::class |
|
| 434 | ); |
|
| 435 | ||
| 436 | $parameters = [ |
|
| 437 | $this->createMock(User::class), |
|
| 438 | $this->createMock(UserGroup::class), |
|
| 439 | ]; |
|
| 440 | ||
| 441 | $innerServiceMock = $this->createMock(UserServiceInterface::class); |
|
| 442 | ||
| 443 | $traceableEventDispatcher->addListener(BeforeAssignUserToUserGroupEventInterface::class, function (BeforeAssignUserToUserGroupEventInterface $event) { |
|
| 444 | $event->stopPropagation(); |
|
| 445 | }, 10); |
|
| 446 | ||
| 447 | $service = new UserService($innerServiceMock, $traceableEventDispatcher); |
|
| 448 | $service->assignUserToUserGroup(...$parameters); |
|
| 449 | ||
| 450 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 451 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 452 | ||
| 453 | $this->assertSame($calledListeners, [ |
|
| 454 | [BeforeAssignUserToUserGroupEventInterface::class, 10], |
|
| 455 | ]); |
|
| 456 | $this->assertSame($notCalledListeners, [ |
|
| 457 | [AssignUserToUserGroupEventInterface::class, 0], |
|
| 458 | [BeforeAssignUserToUserGroupEventInterface::class, 0], |
|
| 459 | ]); |
|
| 460 | } |
|
| 461 | ||
| 462 | public function testDeleteUserEvents() |
|
| 463 | { |
|
| @@ 587-618 (lines=32) @@ | ||
| 584 | $this->assertSame([], $traceableEventDispatcher->getNotCalledListeners()); |
|
| 585 | } |
|
| 586 | ||
| 587 | public function testMoveUserGroupStopPropagationInBeforeEvents() |
|
| 588 | { |
|
| 589 | $traceableEventDispatcher = $this->getEventDispatcher( |
|
| 590 | BeforeMoveUserGroupEventInterface::class, |
|
| 591 | MoveUserGroupEventInterface::class |
|
| 592 | ); |
|
| 593 | ||
| 594 | $parameters = [ |
|
| 595 | $this->createMock(UserGroup::class), |
|
| 596 | $this->createMock(UserGroup::class), |
|
| 597 | ]; |
|
| 598 | ||
| 599 | $innerServiceMock = $this->createMock(UserServiceInterface::class); |
|
| 600 | ||
| 601 | $traceableEventDispatcher->addListener(BeforeMoveUserGroupEventInterface::class, function (BeforeMoveUserGroupEventInterface $event) { |
|
| 602 | $event->stopPropagation(); |
|
| 603 | }, 10); |
|
| 604 | ||
| 605 | $service = new UserService($innerServiceMock, $traceableEventDispatcher); |
|
| 606 | $service->moveUserGroup(...$parameters); |
|
| 607 | ||
| 608 | $calledListeners = $this->getListenersStack($traceableEventDispatcher->getCalledListeners()); |
|
| 609 | $notCalledListeners = $this->getListenersStack($traceableEventDispatcher->getNotCalledListeners()); |
|
| 610 | ||
| 611 | $this->assertSame($calledListeners, [ |
|
| 612 | [BeforeMoveUserGroupEventInterface::class, 10], |
|
| 613 | ]); |
|
| 614 | $this->assertSame($notCalledListeners, [ |
|
| 615 | [BeforeMoveUserGroupEventInterface::class, 0], |
|
| 616 | [MoveUserGroupEventInterface::class, 0], |
|
| 617 | ]); |
|
| 618 | } |
|
| 619 | ||
| 620 | public function testCreateUserEvents() |
|
| 621 | { |
|