From e691a1f75c5f0c2e1938fbf45e50419e6f24bb12 Mon Sep 17 00:00:00 2001 From: Alfred Armstrong Date: Thu, 30 Apr 2020 14:03:28 +0100 Subject: [PATCH 1/5] Other Groups field should respect settings such as bundles config from the main entity reference. --- src/Plugin/Field/FieldWidget/OgComplex.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Plugin/Field/FieldWidget/OgComplex.php b/src/Plugin/Field/FieldWidget/OgComplex.php index 4ef69d0d6..2fa5008b3 100644 --- a/src/Plugin/Field/FieldWidget/OgComplex.php +++ b/src/Plugin/Field/FieldWidget/OgComplex.php @@ -288,16 +288,21 @@ protected function otherGroupsWidget(FieldItemListInterface $items, FormStateInt * A single entity reference input. */ public function otherGroupsSingle($delta, EntityInterface $entity = NULL, $weight_delta = 10) { + $selection_settings = [ + 'other_groups' => TRUE, + 'field_mode' => 'admin', + ]; + if ($this->getFieldSetting('handler_settings')) { + $selection_settings += $this->getFieldSetting('handler_settings'); + } + return [ 'target_id' => [ // @todo Allow this to be configurable with a widget setting. '#type' => 'entity_autocomplete', '#target_type' => $this->fieldDefinition->getFieldStorageDefinition()->getSetting('target_type'), '#selection_handler' => 'og:default', - '#selection_settings' => [ - 'other_groups' => TRUE, - 'field_mode' => 'admin', - ], + '#selection_settings' => $selection_settings, '#default_value' => $entity, ], '_weight' => [ From 52b56684cd67d01fe9de678f66ec394cbcfbc1ce Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Thu, 2 Jul 2020 23:28:59 +0300 Subject: [PATCH 2/5] Fix deprecation warning in Drupal 9.1. --- .travis.yml | 1 - og_ui/tests/src/Functional/BundleFormAlterTest.php | 2 +- tests/src/Functional/GroupSubscribeFormatterTest.php | 2 +- tests/src/Functional/GroupSubscribeTest.php | 2 +- tests/src/Functional/GroupTabTest.php | 2 +- tests/src/Functional/GroupUpdateTest.php | 2 +- tests/src/Functional/OgComplexWidgetTest.php | 2 +- tests/src/Kernel/Access/AccessByOgMembershipTest.php | 2 +- tests/src/Kernel/Access/OgAccessHookTest.php | 2 +- tests/src/Kernel/Access/OgEntityAccessTest.php | 2 +- tests/src/Kernel/Access/OgGroupContentOperationAccessTest.php | 2 +- tests/src/Kernel/Action/ActionTestBase.php | 2 +- .../Action/ChangeMultipleOgMembershipRolesActionTestBase.php | 2 +- tests/src/Kernel/Cache/Context/OgRoleCacheContextTest.php | 2 +- tests/src/Kernel/DefaultRoleEventIntegrationTest.php | 2 +- tests/src/Kernel/Entity/CacheInvalidationOnGroupChangeTest.php | 2 +- tests/src/Kernel/Entity/EntityCreateAccessTest.php | 2 +- tests/src/Kernel/Entity/FieldCreateTest.php | 2 +- tests/src/Kernel/Entity/GetBundleByBundleTest.php | 2 +- tests/src/Kernel/Entity/GetGroupContentTest.php | 2 +- tests/src/Kernel/Entity/GetMembershipsTest.php | 2 +- tests/src/Kernel/Entity/GetUserGroupsTest.php | 2 +- tests/src/Kernel/Entity/GroupAudienceTest.php | 2 +- tests/src/Kernel/Entity/GroupMembershipManagerTest.php | 2 +- tests/src/Kernel/Entity/GroupTypeTest.php | 2 +- tests/src/Kernel/Entity/OgMembershipRoleReferenceTest.php | 2 +- tests/src/Kernel/Entity/OgMembershipTest.php | 2 +- tests/src/Kernel/Entity/OgRoleTest.php | 2 +- tests/src/Kernel/Entity/OgStandardReferenceItemTest.php | 2 +- tests/src/Kernel/Entity/ReferenceStringIdTest.php | 2 +- tests/src/Kernel/Entity/SelectionHandlerTest.php | 2 +- .../Views/OgStandardReferenceRelationshipTest.php | 2 +- tests/src/Kernel/Form/GroupSubscribeFormTest.php | 2 +- tests/src/Kernel/GroupManagerSubscriptionTest.php | 2 +- tests/src/Kernel/GroupTypeConditionTest.php | 2 +- tests/src/Kernel/OgDeleteOrphansTest.php | 2 +- tests/src/Kernel/OgRoleManagerTest.php | 2 +- tests/src/Kernel/PermissionEventTest.php | 2 +- tests/src/Kernel/Plugin/Block/MemberCountBlockTest.php | 2 +- tests/src/Unit/Cache/Context/OgContextCacheContextTestBase.php | 2 +- .../Unit/Cache/Context/OgMembershipStateCacheContextTest.php | 2 +- tests/src/Unit/Cache/Context/OgRoleCacheContextTest.php | 2 +- tests/src/Unit/CreateMembershipTest.php | 2 +- tests/src/Unit/DefaultRoleEventTest.php | 2 +- tests/src/Unit/GroupCheckTest.php | 2 +- tests/src/Unit/GroupSubscribeFormatterTest.php | 2 +- tests/src/Unit/GroupTypeManagerTest.php | 2 +- tests/src/Unit/OgAccessEntityTestBase.php | 2 +- tests/src/Unit/OgAccessHookTest.php | 2 +- tests/src/Unit/OgAccessTestBase.php | 2 +- tests/src/Unit/OgAdminRoutesControllerTest.php | 2 +- tests/src/Unit/OgContextTest.php | 2 +- tests/src/Unit/OgLocalTaskTest.php | 2 +- tests/src/Unit/OgResolvedGroupCollectionTest.php | 2 +- tests/src/Unit/OgRoleManagerTest.php | 2 +- .../src/Unit/Plugin/OgGroupResolver/OgGroupResolverTestBase.php | 2 +- .../Plugin/OgGroupResolver/OgRouteGroupResolverTestBase.php | 2 +- .../Plugin/OgGroupResolver/RequestQueryArgumentResolverTest.php | 2 +- tests/src/Unit/SubscriptionControllerTest.php | 2 +- 59 files changed, 58 insertions(+), 59 deletions(-) diff --git a/.travis.yml b/.travis.yml index 54c858524..54b544b77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,6 @@ matrix: env: TEST_SUITE=PHP_CodeSniffer allow_failures: - php: 7.4 - - env: TEST_SUITE=9.1.x mysql: database: og diff --git a/og_ui/tests/src/Functional/BundleFormAlterTest.php b/og_ui/tests/src/Functional/BundleFormAlterTest.php index 6a0887c22..af639e0f1 100644 --- a/og_ui/tests/src/Functional/BundleFormAlterTest.php +++ b/og_ui/tests/src/Functional/BundleFormAlterTest.php @@ -42,7 +42,7 @@ class BundleFormAlterTest extends BrowserTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->entityTypeManager = \Drupal::entityTypeManager(); diff --git a/tests/src/Functional/GroupSubscribeFormatterTest.php b/tests/src/Functional/GroupSubscribeFormatterTest.php index a638bf17a..9855d3e90 100644 --- a/tests/src/Functional/GroupSubscribeFormatterTest.php +++ b/tests/src/Functional/GroupSubscribeFormatterTest.php @@ -57,7 +57,7 @@ class GroupSubscribeFormatterTest extends BrowserTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); // Create bundle. diff --git a/tests/src/Functional/GroupSubscribeTest.php b/tests/src/Functional/GroupSubscribeTest.php index d0547472c..2bc9f3320 100644 --- a/tests/src/Functional/GroupSubscribeTest.php +++ b/tests/src/Functional/GroupSubscribeTest.php @@ -98,7 +98,7 @@ class GroupSubscribeTest extends BrowserTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); // Create bundles. diff --git a/tests/src/Functional/GroupTabTest.php b/tests/src/Functional/GroupTabTest.php index adf0ef5b7..4dcb029a0 100644 --- a/tests/src/Functional/GroupTabTest.php +++ b/tests/src/Functional/GroupTabTest.php @@ -55,7 +55,7 @@ class GroupTabTest extends BrowserTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); // Create bundles. diff --git a/tests/src/Functional/GroupUpdateTest.php b/tests/src/Functional/GroupUpdateTest.php index da2949dd0..e4817efb3 100644 --- a/tests/src/Functional/GroupUpdateTest.php +++ b/tests/src/Functional/GroupUpdateTest.php @@ -71,7 +71,7 @@ class GroupUpdateTest extends BrowserTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); // Create dummy users. diff --git a/tests/src/Functional/OgComplexWidgetTest.php b/tests/src/Functional/OgComplexWidgetTest.php index bf39c0c21..2ab038a8c 100644 --- a/tests/src/Functional/OgComplexWidgetTest.php +++ b/tests/src/Functional/OgComplexWidgetTest.php @@ -34,7 +34,7 @@ class OgComplexWidgetTest extends BrowserTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); // Create a "group" bundle on the Custom Block entity type and turn it into diff --git a/tests/src/Kernel/Access/AccessByOgMembershipTest.php b/tests/src/Kernel/Access/AccessByOgMembershipTest.php index 7c10e3b06..00193d033 100644 --- a/tests/src/Kernel/Access/AccessByOgMembershipTest.php +++ b/tests/src/Kernel/Access/AccessByOgMembershipTest.php @@ -65,7 +65,7 @@ class AccessByOgMembershipTest extends KernelTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->installConfig(['og']); diff --git a/tests/src/Kernel/Access/OgAccessHookTest.php b/tests/src/Kernel/Access/OgAccessHookTest.php index 275770da7..778c08060 100644 --- a/tests/src/Kernel/Access/OgAccessHookTest.php +++ b/tests/src/Kernel/Access/OgAccessHookTest.php @@ -75,7 +75,7 @@ class OgAccessHookTest extends KernelTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->installConfig(['og']); diff --git a/tests/src/Kernel/Access/OgEntityAccessTest.php b/tests/src/Kernel/Access/OgEntityAccessTest.php index b26be94a0..2e7604cbd 100644 --- a/tests/src/Kernel/Access/OgEntityAccessTest.php +++ b/tests/src/Kernel/Access/OgEntityAccessTest.php @@ -136,7 +136,7 @@ class OgEntityAccessTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->installConfig(['og']); diff --git a/tests/src/Kernel/Access/OgGroupContentOperationAccessTest.php b/tests/src/Kernel/Access/OgGroupContentOperationAccessTest.php index 001ec3815..79a5b4e5d 100644 --- a/tests/src/Kernel/Access/OgGroupContentOperationAccessTest.php +++ b/tests/src/Kernel/Access/OgGroupContentOperationAccessTest.php @@ -83,7 +83,7 @@ class OgGroupContentOperationAccessTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->installConfig(['og']); diff --git a/tests/src/Kernel/Action/ActionTestBase.php b/tests/src/Kernel/Action/ActionTestBase.php index e80092572..450f49a65 100644 --- a/tests/src/Kernel/Action/ActionTestBase.php +++ b/tests/src/Kernel/Action/ActionTestBase.php @@ -78,7 +78,7 @@ abstract class ActionTestBase extends KernelTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->installEntitySchema('og_membership'); diff --git a/tests/src/Kernel/Action/ChangeMultipleOgMembershipRolesActionTestBase.php b/tests/src/Kernel/Action/ChangeMultipleOgMembershipRolesActionTestBase.php index e067a8875..956ec3fe2 100644 --- a/tests/src/Kernel/Action/ChangeMultipleOgMembershipRolesActionTestBase.php +++ b/tests/src/Kernel/Action/ChangeMultipleOgMembershipRolesActionTestBase.php @@ -24,7 +24,7 @@ class ChangeMultipleOgMembershipRolesActionTestBase extends ChangeOgMembershipAc /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->installSchema('system', ['key_value_expire']); diff --git a/tests/src/Kernel/Cache/Context/OgRoleCacheContextTest.php b/tests/src/Kernel/Cache/Context/OgRoleCacheContextTest.php index 7b4e26f5e..eb458a82a 100644 --- a/tests/src/Kernel/Cache/Context/OgRoleCacheContextTest.php +++ b/tests/src/Kernel/Cache/Context/OgRoleCacheContextTest.php @@ -79,7 +79,7 @@ class OgRoleCacheContextTest extends KernelTestBase { /** * {@inheritdoc} */ - public function setUp(): void { + protected function setUp(): void: void { parent::setUp(); // Add membership and config schema. diff --git a/tests/src/Kernel/DefaultRoleEventIntegrationTest.php b/tests/src/Kernel/DefaultRoleEventIntegrationTest.php index 5f316e0e8..b8b18dca4 100644 --- a/tests/src/Kernel/DefaultRoleEventIntegrationTest.php +++ b/tests/src/Kernel/DefaultRoleEventIntegrationTest.php @@ -44,7 +44,7 @@ class DefaultRoleEventIntegrationTest extends KernelTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->eventDispatcher = $this->container->get('event_dispatcher'); diff --git a/tests/src/Kernel/Entity/CacheInvalidationOnGroupChangeTest.php b/tests/src/Kernel/Entity/CacheInvalidationOnGroupChangeTest.php index eff8ecf86..31bdc866a 100644 --- a/tests/src/Kernel/Entity/CacheInvalidationOnGroupChangeTest.php +++ b/tests/src/Kernel/Entity/CacheInvalidationOnGroupChangeTest.php @@ -39,7 +39,7 @@ class CacheInvalidationOnGroupChangeTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->installEntitySchema('entity_test'); diff --git a/tests/src/Kernel/Entity/EntityCreateAccessTest.php b/tests/src/Kernel/Entity/EntityCreateAccessTest.php index f04920b86..7e8a931d4 100644 --- a/tests/src/Kernel/Entity/EntityCreateAccessTest.php +++ b/tests/src/Kernel/Entity/EntityCreateAccessTest.php @@ -52,7 +52,7 @@ class EntityCreateAccessTest extends KernelTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->installConfig(['og']); diff --git a/tests/src/Kernel/Entity/FieldCreateTest.php b/tests/src/Kernel/Entity/FieldCreateTest.php index df13e12e1..cdb5d2c9d 100644 --- a/tests/src/Kernel/Entity/FieldCreateTest.php +++ b/tests/src/Kernel/Entity/FieldCreateTest.php @@ -40,7 +40,7 @@ class FieldCreateTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); // Add membership and config schema. diff --git a/tests/src/Kernel/Entity/GetBundleByBundleTest.php b/tests/src/Kernel/Entity/GetBundleByBundleTest.php index 1167dba6b..d9c4d9d92 100644 --- a/tests/src/Kernel/Entity/GetBundleByBundleTest.php +++ b/tests/src/Kernel/Entity/GetBundleByBundleTest.php @@ -60,7 +60,7 @@ class GetBundleByBundleTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->installConfig(['og']); diff --git a/tests/src/Kernel/Entity/GetGroupContentTest.php b/tests/src/Kernel/Entity/GetGroupContentTest.php index c360b7440..8e8fc0128 100644 --- a/tests/src/Kernel/Entity/GetGroupContentTest.php +++ b/tests/src/Kernel/Entity/GetGroupContentTest.php @@ -47,7 +47,7 @@ class GetGroupContentTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->installConfig(['og']); diff --git a/tests/src/Kernel/Entity/GetMembershipsTest.php b/tests/src/Kernel/Entity/GetMembershipsTest.php index b8e813337..bbd479334 100644 --- a/tests/src/Kernel/Entity/GetMembershipsTest.php +++ b/tests/src/Kernel/Entity/GetMembershipsTest.php @@ -56,7 +56,7 @@ class GetMembershipsTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->installConfig(['og']); diff --git a/tests/src/Kernel/Entity/GetUserGroupsTest.php b/tests/src/Kernel/Entity/GetUserGroupsTest.php index ff628af19..c019bd05a 100644 --- a/tests/src/Kernel/Entity/GetUserGroupsTest.php +++ b/tests/src/Kernel/Entity/GetUserGroupsTest.php @@ -84,7 +84,7 @@ class GetUserGroupsTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->installConfig(['og']); diff --git a/tests/src/Kernel/Entity/GroupAudienceTest.php b/tests/src/Kernel/Entity/GroupAudienceTest.php index 12ab8a209..3a1f4493c 100644 --- a/tests/src/Kernel/Entity/GroupAudienceTest.php +++ b/tests/src/Kernel/Entity/GroupAudienceTest.php @@ -43,7 +43,7 @@ class GroupAudienceTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); // Add membership and config schema. diff --git a/tests/src/Kernel/Entity/GroupMembershipManagerTest.php b/tests/src/Kernel/Entity/GroupMembershipManagerTest.php index 42859160e..2eb079fb7 100644 --- a/tests/src/Kernel/Entity/GroupMembershipManagerTest.php +++ b/tests/src/Kernel/Entity/GroupMembershipManagerTest.php @@ -77,7 +77,7 @@ class GroupMembershipManagerTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->installConfig(['og']); diff --git a/tests/src/Kernel/Entity/GroupTypeTest.php b/tests/src/Kernel/Entity/GroupTypeTest.php index c3f16144e..f9c8003db 100644 --- a/tests/src/Kernel/Entity/GroupTypeTest.php +++ b/tests/src/Kernel/Entity/GroupTypeTest.php @@ -27,7 +27,7 @@ class GroupTypeTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->installConfig(['og']); diff --git a/tests/src/Kernel/Entity/OgMembershipRoleReferenceTest.php b/tests/src/Kernel/Entity/OgMembershipRoleReferenceTest.php index 98a669fc0..64b4dcab1 100644 --- a/tests/src/Kernel/Entity/OgMembershipRoleReferenceTest.php +++ b/tests/src/Kernel/Entity/OgMembershipRoleReferenceTest.php @@ -51,7 +51,7 @@ class OgMembershipRoleReferenceTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); // Installing needed schema. diff --git a/tests/src/Kernel/Entity/OgMembershipTest.php b/tests/src/Kernel/Entity/OgMembershipTest.php index a9c792e6a..bda96a4fc 100644 --- a/tests/src/Kernel/Entity/OgMembershipTest.php +++ b/tests/src/Kernel/Entity/OgMembershipTest.php @@ -74,7 +74,7 @@ class OgMembershipTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->installConfig(['og']); diff --git a/tests/src/Kernel/Entity/OgRoleTest.php b/tests/src/Kernel/Entity/OgRoleTest.php index 728e90444..247420971 100644 --- a/tests/src/Kernel/Entity/OgRoleTest.php +++ b/tests/src/Kernel/Entity/OgRoleTest.php @@ -59,7 +59,7 @@ class OgRoleTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); // Installing needed schema. diff --git a/tests/src/Kernel/Entity/OgStandardReferenceItemTest.php b/tests/src/Kernel/Entity/OgStandardReferenceItemTest.php index ca61ca91d..04df8bd1d 100644 --- a/tests/src/Kernel/Entity/OgStandardReferenceItemTest.php +++ b/tests/src/Kernel/Entity/OgStandardReferenceItemTest.php @@ -44,7 +44,7 @@ class OgStandardReferenceItemTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); // Add membership and config schema. diff --git a/tests/src/Kernel/Entity/ReferenceStringIdTest.php b/tests/src/Kernel/Entity/ReferenceStringIdTest.php index d7575dd0e..c4d056f96 100644 --- a/tests/src/Kernel/Entity/ReferenceStringIdTest.php +++ b/tests/src/Kernel/Entity/ReferenceStringIdTest.php @@ -43,7 +43,7 @@ class ReferenceStringIdTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); // Add membership and config schema. diff --git a/tests/src/Kernel/Entity/SelectionHandlerTest.php b/tests/src/Kernel/Entity/SelectionHandlerTest.php index 75c360a7f..27501e21c 100644 --- a/tests/src/Kernel/Entity/SelectionHandlerTest.php +++ b/tests/src/Kernel/Entity/SelectionHandlerTest.php @@ -81,7 +81,7 @@ class SelectionHandlerTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); // Add membership and config schema. diff --git a/tests/src/Kernel/EntityReference/Views/OgStandardReferenceRelationshipTest.php b/tests/src/Kernel/EntityReference/Views/OgStandardReferenceRelationshipTest.php index 03beeacfa..efa3b211a 100644 --- a/tests/src/Kernel/EntityReference/Views/OgStandardReferenceRelationshipTest.php +++ b/tests/src/Kernel/EntityReference/Views/OgStandardReferenceRelationshipTest.php @@ -55,7 +55,7 @@ class OgStandardReferenceRelationshipTest extends ViewsKernelTestBase { /** * {@inheritdoc} */ - protected function setUp($import_test_views = TRUE) { + protected function setUp($import_test_views = TRUE): void { parent::setUp(); $this->installEntitySchema('user'); diff --git a/tests/src/Kernel/Form/GroupSubscribeFormTest.php b/tests/src/Kernel/Form/GroupSubscribeFormTest.php index a7e3cb0e6..0a8280623 100644 --- a/tests/src/Kernel/Form/GroupSubscribeFormTest.php +++ b/tests/src/Kernel/Form/GroupSubscribeFormTest.php @@ -63,7 +63,7 @@ class GroupSubscribeFormTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->installConfig(['og']); diff --git a/tests/src/Kernel/GroupManagerSubscriptionTest.php b/tests/src/Kernel/GroupManagerSubscriptionTest.php index b2d777c0c..8b2507bee 100644 --- a/tests/src/Kernel/GroupManagerSubscriptionTest.php +++ b/tests/src/Kernel/GroupManagerSubscriptionTest.php @@ -52,7 +52,7 @@ class GroupManagerSubscriptionTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->groupTypeManager = $this->container->get('og.group_type_manager'); diff --git a/tests/src/Kernel/GroupTypeConditionTest.php b/tests/src/Kernel/GroupTypeConditionTest.php index bd610108a..fcf80f508 100644 --- a/tests/src/Kernel/GroupTypeConditionTest.php +++ b/tests/src/Kernel/GroupTypeConditionTest.php @@ -50,7 +50,7 @@ class GroupTypeConditionTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->conditionManager = $this->container->get('plugin.manager.condition'); diff --git a/tests/src/Kernel/OgDeleteOrphansTest.php b/tests/src/Kernel/OgDeleteOrphansTest.php index 0afe7dc24..11090b677 100644 --- a/tests/src/Kernel/OgDeleteOrphansTest.php +++ b/tests/src/Kernel/OgDeleteOrphansTest.php @@ -52,7 +52,7 @@ class OgDeleteOrphansTest extends KernelTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); // Add membership and config schema. diff --git a/tests/src/Kernel/OgRoleManagerTest.php b/tests/src/Kernel/OgRoleManagerTest.php index 56882db70..e777fdc0f 100644 --- a/tests/src/Kernel/OgRoleManagerTest.php +++ b/tests/src/Kernel/OgRoleManagerTest.php @@ -51,7 +51,7 @@ class OgRoleManagerTest extends KernelTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); // Add membership and config schema. diff --git a/tests/src/Kernel/PermissionEventTest.php b/tests/src/Kernel/PermissionEventTest.php index fa7a73bf4..134d48deb 100644 --- a/tests/src/Kernel/PermissionEventTest.php +++ b/tests/src/Kernel/PermissionEventTest.php @@ -47,7 +47,7 @@ class PermissionEventTest extends KernelTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->eventDispatcher = $this->container->get('event_dispatcher'); diff --git a/tests/src/Kernel/Plugin/Block/MemberCountBlockTest.php b/tests/src/Kernel/Plugin/Block/MemberCountBlockTest.php index 093e81d5c..e4b57876c 100644 --- a/tests/src/Kernel/Plugin/Block/MemberCountBlockTest.php +++ b/tests/src/Kernel/Plugin/Block/MemberCountBlockTest.php @@ -110,7 +110,7 @@ class MemberCountBlockTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->installEntitySchema('entity_test'); diff --git a/tests/src/Unit/Cache/Context/OgContextCacheContextTestBase.php b/tests/src/Unit/Cache/Context/OgContextCacheContextTestBase.php index 8c8cf2e67..14e81f649 100644 --- a/tests/src/Unit/Cache/Context/OgContextCacheContextTestBase.php +++ b/tests/src/Unit/Cache/Context/OgContextCacheContextTestBase.php @@ -32,7 +32,7 @@ abstract class OgContextCacheContextTestBase extends OgCacheContextTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->ogContext = $this->prophesize(OgContextInterface::class); diff --git a/tests/src/Unit/Cache/Context/OgMembershipStateCacheContextTest.php b/tests/src/Unit/Cache/Context/OgMembershipStateCacheContextTest.php index f9fda4d71..391118b7e 100644 --- a/tests/src/Unit/Cache/Context/OgMembershipStateCacheContextTest.php +++ b/tests/src/Unit/Cache/Context/OgMembershipStateCacheContextTest.php @@ -39,7 +39,7 @@ class OgMembershipStateCacheContextTest extends OgContextCacheContextTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->user = $this->prophesize(AccountInterface::class); diff --git a/tests/src/Unit/Cache/Context/OgRoleCacheContextTest.php b/tests/src/Unit/Cache/Context/OgRoleCacheContextTest.php index 73615ded2..3c6dd6388 100644 --- a/tests/src/Unit/Cache/Context/OgRoleCacheContextTest.php +++ b/tests/src/Unit/Cache/Context/OgRoleCacheContextTest.php @@ -56,7 +56,7 @@ class OgRoleCacheContextTest extends OgCacheContextTestBase { /** * {@inheritdoc} */ - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class); diff --git a/tests/src/Unit/CreateMembershipTest.php b/tests/src/Unit/CreateMembershipTest.php index 61927359f..e8903a414 100644 --- a/tests/src/Unit/CreateMembershipTest.php +++ b/tests/src/Unit/CreateMembershipTest.php @@ -96,7 +96,7 @@ class CreateMembershipTest extends UnitTestCase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->entityTypeId = $this->randomMachineName(); diff --git a/tests/src/Unit/DefaultRoleEventTest.php b/tests/src/Unit/DefaultRoleEventTest.php index 52f881971..2d46b6f69 100644 --- a/tests/src/Unit/DefaultRoleEventTest.php +++ b/tests/src/Unit/DefaultRoleEventTest.php @@ -34,7 +34,7 @@ class DefaultRoleEventTest extends UnitTestCase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class); diff --git a/tests/src/Unit/GroupCheckTest.php b/tests/src/Unit/GroupCheckTest.php index f96b90315..06877a31e 100644 --- a/tests/src/Unit/GroupCheckTest.php +++ b/tests/src/Unit/GroupCheckTest.php @@ -117,7 +117,7 @@ class GroupCheckTest extends UnitTestCase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { $this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class); $this->entityType = $this->prophesize(EntityTypeInterface::class); $this->entityStorage = $this->prophesize(EntityStorageInterface::class); diff --git a/tests/src/Unit/GroupSubscribeFormatterTest.php b/tests/src/Unit/GroupSubscribeFormatterTest.php index e16ab29d4..207ce1820 100644 --- a/tests/src/Unit/GroupSubscribeFormatterTest.php +++ b/tests/src/Unit/GroupSubscribeFormatterTest.php @@ -150,7 +150,7 @@ class GroupSubscribeFormatterTest extends UnitTestCase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->accessResult = $this->prophesize(AccessResultInterface::class); diff --git a/tests/src/Unit/GroupTypeManagerTest.php b/tests/src/Unit/GroupTypeManagerTest.php index c7e003045..7b005492e 100644 --- a/tests/src/Unit/GroupTypeManagerTest.php +++ b/tests/src/Unit/GroupTypeManagerTest.php @@ -124,7 +124,7 @@ class GroupTypeManagerTest extends UnitTestCase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { $this->config = $this->prophesize(Config::class); $this->configFactory = $this->prophesize(ConfigFactoryInterface::class); $this->entityTypeBundleInfo = $this->prophesize(EntityTypeBundleInfoInterface::class); diff --git a/tests/src/Unit/OgAccessEntityTestBase.php b/tests/src/Unit/OgAccessEntityTestBase.php index 88513bd16..4baf2dd78 100644 --- a/tests/src/Unit/OgAccessEntityTestBase.php +++ b/tests/src/Unit/OgAccessEntityTestBase.php @@ -27,7 +27,7 @@ abstract class OgAccessEntityTestBase extends OgAccessTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); // Mock a group content entity. diff --git a/tests/src/Unit/OgAccessHookTest.php b/tests/src/Unit/OgAccessHookTest.php index 062b720ea..b9a99346f 100644 --- a/tests/src/Unit/OgAccessHookTest.php +++ b/tests/src/Unit/OgAccessHookTest.php @@ -15,7 +15,7 @@ class OgAccessHookTest extends OgAccessEntityTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); // Since this is a unit test, we don't enable the module. However, we test // a hook implementation inside the module so include the module manually. diff --git a/tests/src/Unit/OgAccessTestBase.php b/tests/src/Unit/OgAccessTestBase.php index 580ddb455..d5d5c3c72 100644 --- a/tests/src/Unit/OgAccessTestBase.php +++ b/tests/src/Unit/OgAccessTestBase.php @@ -129,7 +129,7 @@ class OgAccessTestBase extends UnitTestCase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { $this->groupId = $this->randomMachineName(); $this->entityTypeId = $this->randomMachineName(); $this->bundle = $this->randomMachineName(); diff --git a/tests/src/Unit/OgAdminRoutesControllerTest.php b/tests/src/Unit/OgAdminRoutesControllerTest.php index ddd303058..25cd9706f 100644 --- a/tests/src/Unit/OgAdminRoutesControllerTest.php +++ b/tests/src/Unit/OgAdminRoutesControllerTest.php @@ -103,7 +103,7 @@ class OgAdminRoutesControllerTest extends UnitTestCase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { $this->accessManager = $this->prophesize(AccessManagerInterface::class); $this->routeMatch = $this->prophesize(RouteMatchInterface::class); diff --git a/tests/src/Unit/OgContextTest.php b/tests/src/Unit/OgContextTest.php index 87d55e4c2..b01402662 100644 --- a/tests/src/Unit/OgContextTest.php +++ b/tests/src/Unit/OgContextTest.php @@ -69,7 +69,7 @@ class OgContextTest extends UnitTestCase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->pluginManager = $this->prophesize(PluginManagerInterface::class); diff --git a/tests/src/Unit/OgLocalTaskTest.php b/tests/src/Unit/OgLocalTaskTest.php index e7dd53142..080b07140 100644 --- a/tests/src/Unit/OgLocalTaskTest.php +++ b/tests/src/Unit/OgLocalTaskTest.php @@ -43,7 +43,7 @@ class OgLocalTaskTest extends UnitTestCase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { $this->groupTypeManager = $this->prophesize(GroupTypeManagerInterface::class); $this->routeProvider = $this->prophesize(RouteProvider::class); $this->route = $this->prophesize(Route::class); diff --git a/tests/src/Unit/OgResolvedGroupCollectionTest.php b/tests/src/Unit/OgResolvedGroupCollectionTest.php index 40a8c20ea..5b5807479 100644 --- a/tests/src/Unit/OgResolvedGroupCollectionTest.php +++ b/tests/src/Unit/OgResolvedGroupCollectionTest.php @@ -24,7 +24,7 @@ class OgResolvedGroupCollectionTest extends UnitTestCase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); // Mock some test groups. diff --git a/tests/src/Unit/OgRoleManagerTest.php b/tests/src/Unit/OgRoleManagerTest.php index ccf5276d4..c20a83c5e 100644 --- a/tests/src/Unit/OgRoleManagerTest.php +++ b/tests/src/Unit/OgRoleManagerTest.php @@ -78,7 +78,7 @@ class OgRoleManagerTest extends UnitTestCase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->entityTypeId = $this->randomMachineName(); diff --git a/tests/src/Unit/Plugin/OgGroupResolver/OgGroupResolverTestBase.php b/tests/src/Unit/Plugin/OgGroupResolver/OgGroupResolverTestBase.php index 181b38515..9ae8b18cf 100644 --- a/tests/src/Unit/Plugin/OgGroupResolver/OgGroupResolverTestBase.php +++ b/tests/src/Unit/Plugin/OgGroupResolver/OgGroupResolverTestBase.php @@ -68,7 +68,7 @@ abstract class OgGroupResolverTestBase extends UnitTestCase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); // Instantiate mocks of the classes that the plugins rely on. diff --git a/tests/src/Unit/Plugin/OgGroupResolver/OgRouteGroupResolverTestBase.php b/tests/src/Unit/Plugin/OgGroupResolver/OgRouteGroupResolverTestBase.php index 43fba51a9..e63703663 100644 --- a/tests/src/Unit/Plugin/OgGroupResolver/OgRouteGroupResolverTestBase.php +++ b/tests/src/Unit/Plugin/OgGroupResolver/OgRouteGroupResolverTestBase.php @@ -54,7 +54,7 @@ abstract class OgRouteGroupResolverTestBase extends OgGroupResolverTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); // Instantiate mocks of the classes that the plugins rely on. diff --git a/tests/src/Unit/Plugin/OgGroupResolver/RequestQueryArgumentResolverTest.php b/tests/src/Unit/Plugin/OgGroupResolver/RequestQueryArgumentResolverTest.php index c578b4d72..26d9cbb3a 100644 --- a/tests/src/Unit/Plugin/OgGroupResolver/RequestQueryArgumentResolverTest.php +++ b/tests/src/Unit/Plugin/OgGroupResolver/RequestQueryArgumentResolverTest.php @@ -37,7 +37,7 @@ class RequestQueryArgumentResolverTest extends OgGroupResolverTestBase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { parent::setUp(); // Instantiate mocks of the classes that the plugins rely on. diff --git a/tests/src/Unit/SubscriptionControllerTest.php b/tests/src/Unit/SubscriptionControllerTest.php index 274ba36df..38ccd9a30 100644 --- a/tests/src/Unit/SubscriptionControllerTest.php +++ b/tests/src/Unit/SubscriptionControllerTest.php @@ -98,7 +98,7 @@ class SubscriptionControllerTest extends UnitTestCase { /** * {@inheritdoc} */ - public function setUp() { + protected function setUp(): void { $this->entityFormBuilder = $this->prophesize(EntityFormBuilderInterface::class); $this->group = $this->prophesize(ContentEntityInterface::class); $this->membershipManager = $this->prophesize(MembershipManagerInterface::class); From 396387c17f2b13851ad4855b4d7ca124f744dcc5 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Thu, 2 Jul 2020 23:13:42 +0300 Subject: [PATCH 3/5] Drupal 8.7.x is EOL. Specify 8.8.x as the new minimum version. --- .travis.yml | 5 ----- composer.json | 4 ++-- og.info.yml | 3 +-- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 54c858524..815816b2c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,6 @@ env: global: - COMPOSER_MEMORY_LIMIT=2G matrix: - - TEST_SUITE=8.7.x - TEST_SUITE=8.8.x - TEST_SUITE=8.9.x - TEST_SUITE=9.0.x @@ -73,10 +72,6 @@ before_script: # Install Composer dependencies for core. Skip this for the coding standards test. - test ${TEST_SUITE} == "PHP_CodeSniffer" || composer install --working-dir=$DRUPAL_DIR - # Drupal 8.7.x still uses the legacy PHPUnit 4.x which is not compatible with - # PHP 7. Update it to 6.x. - - test ${TEST_SUITE} == "8.7.x" && composer require --dev phpunit/phpunit:~6 --update-with-dependencies --working-dir=$DRUPAL_DIR || true - # Start a web server on port 8888 in the background. - test ${TEST_SUITE} == "PHP_CodeSniffer" || nohup php -S localhost:8888 --docroot $DRUPAL_DIR > /dev/null 2>&1 & diff --git a/composer.json b/composer.json index ae36ddf5a..f69a4d13c 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,8 @@ "source": "https://git.drupalcode.org/project/og" }, "require": { - "php": ">=7.1.0", - "drupal/core": "~8.7 || ^9.0" + "php": "^7.1.0", + "drupal/core": "^8.8 || ^9.0" }, "require-dev": { "drupal/coder": "^8.2" diff --git a/og.info.yml b/og.info.yml index f85477537..df47738ae 100644 --- a/og.info.yml +++ b/og.info.yml @@ -2,8 +2,7 @@ name: Organic Groups description: API to allow associating content with groups. package: Organic Groups -core: 8.x -core_version_requirement: ^8 || ^9 +core_version_requirement: ^8.8 || ^9 type: module php: 7.1 From c4fb79e1dda59a105ddebf3d130874eb14f7bb1f Mon Sep 17 00:00:00 2001 From: Maarten Segers Date: Fri, 3 Jul 2020 13:32:05 +0200 Subject: [PATCH 4/5] Fix syntax error, unexpected ':' --- tests/src/Kernel/Cache/Context/OgRoleCacheContextTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/Kernel/Cache/Context/OgRoleCacheContextTest.php b/tests/src/Kernel/Cache/Context/OgRoleCacheContextTest.php index eb458a82a..5efe0139e 100644 --- a/tests/src/Kernel/Cache/Context/OgRoleCacheContextTest.php +++ b/tests/src/Kernel/Cache/Context/OgRoleCacheContextTest.php @@ -79,7 +79,7 @@ class OgRoleCacheContextTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp(): void: void { + protected function setUp(): void { parent::setUp(); // Add membership and config schema. From 40bdda86253c942327991e2fb953eee1a77b698a Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Fri, 3 Jul 2020 16:38:19 +0300 Subject: [PATCH 5/5] AssertLegacyTrait::assertResponse() is deprecated in drupal:8.2.0. --- tests/src/Functional/GroupTabTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/src/Functional/GroupTabTest.php b/tests/src/Functional/GroupTabTest.php index 4dcb029a0..462d8eee8 100644 --- a/tests/src/Functional/GroupTabTest.php +++ b/tests/src/Functional/GroupTabTest.php @@ -99,10 +99,10 @@ protected function setUp(): void { public function testGroupTab() { $this->drupalLogin($this->user1); $this->drupalGet('group/node/' . $this->group->id() . '/admin'); - $this->assertResponse(200); + $this->assertSession()->statusCodeEquals(200); $this->drupalGet('group/node/' . $this->nonGroup->id() . '/admin'); - $this->assertResponse(403); + $this->assertSession()->statusCodeEquals(403); } }