From 0f488cf18fcec74a198dc17dde77d572d74796df Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Mon, 22 Apr 2019 12:13:18 +0200 Subject: [PATCH 1/7] Require tests to pass on Drupal 8.7. Add experimental testing on Drupal 8.8. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0b8c19376..bce5b36f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ env: matrix: - TEST_SUITE=8.6.x - TEST_SUITE=8.7.x + - TEST_SUITE=8.8.x - TEST_SUITE=PHP_CodeSniffer # Only run the coding standards check once. @@ -22,7 +23,7 @@ matrix: - php: 7.2 env: TEST_SUITE=PHP_CodeSniffer allow_failures: - - env: TEST_SUITE=8.7.x + - env: TEST_SUITE=8.8.x mysql: database: og From 2e74eddfa641eacfac8cf73611d4f821266fbad8 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Mon, 22 Apr 2019 12:46:10 +0200 Subject: [PATCH 2/7] Drupal 8.7 requires a field name to be present when creating a comment. --- tests/src/Kernel/Access/OgGroupContentOperationAccessTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/src/Kernel/Access/OgGroupContentOperationAccessTest.php b/tests/src/Kernel/Access/OgGroupContentOperationAccessTest.php index 782013b04..001ec3815 100644 --- a/tests/src/Kernel/Access/OgGroupContentOperationAccessTest.php +++ b/tests/src/Kernel/Access/OgGroupContentOperationAccessTest.php @@ -235,6 +235,7 @@ protected function setUp() { 'comment_type' => $bundle_id, 'entity_id' => $this->group->id(), 'entity_type' => 'entity_test', + 'field_name' => 'an_imaginary_field', OgGroupAudienceHelperInterface::DEFAULT_FIELD => [['target_id' => $this->group->id()]], ]; break; From 68cc7095294852689a5fecc99641a867b0f0ea86 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Mon, 22 Apr 2019 13:40:18 +0200 Subject: [PATCH 3/7] Declare which properties are intended to be exported for membership types. This is required starting with Drupal 8.7. Ref. https://www.drupal.org/node/2949023 --- src/Entity/OgMembershipType.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Entity/OgMembershipType.php b/src/Entity/OgMembershipType.php index 821b29966..c1719c5fe 100644 --- a/src/Entity/OgMembershipType.php +++ b/src/Entity/OgMembershipType.php @@ -25,6 +25,11 @@ * entity_keys = { * "id" = "type", * "label" = "name" + * }, + * config_export = { + * "type", + * "name", + * "description" * } * ) */ From 9d76e0c1fadb83d73bfceb812868d980c072ca6f Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Mon, 22 Apr 2019 14:46:02 +0200 Subject: [PATCH 4/7] Trying to install invalid schemas for the System module has been deprecated in Drupal 8.7. Ref. https://www.drupal.org/node/3003360 --- tests/src/Kernel/Action/ActionTestBase.php | 2 +- tests/src/Kernel/GroupManagerSubscriptionTest.php | 2 +- tests/src/Kernel/GroupTypeConditionTest.php | 2 +- tests/src/Kernel/OgDeleteOrphansTest.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/src/Kernel/Action/ActionTestBase.php b/tests/src/Kernel/Action/ActionTestBase.php index adc59c38a..cb6c1a309 100644 --- a/tests/src/Kernel/Action/ActionTestBase.php +++ b/tests/src/Kernel/Action/ActionTestBase.php @@ -84,7 +84,7 @@ public function setUp() { $this->installEntitySchema('og_membership'); $this->installEntitySchema('user'); $this->installEntitySchema('node'); - $this->installSchema('system', ['queue', 'sequences']); + $this->installSchema('system', ['sequences']); $this->membershipManager = $this->container->get('og.membership_manager'); $this->groupTypeManager = $this->container->get('og.group_type_manager'); diff --git a/tests/src/Kernel/GroupManagerSubscriptionTest.php b/tests/src/Kernel/GroupManagerSubscriptionTest.php index aa932451d..a6e185dfe 100644 --- a/tests/src/Kernel/GroupManagerSubscriptionTest.php +++ b/tests/src/Kernel/GroupManagerSubscriptionTest.php @@ -63,7 +63,7 @@ protected function setUp() { $this->installEntitySchema('node'); $this->installEntitySchema('og_membership'); $this->installEntitySchema('user'); - $this->installSchema('system', ['queue', 'sequences']); + $this->installSchema('system', ['sequences']); // Create a group type. NodeType::create([ diff --git a/tests/src/Kernel/GroupTypeConditionTest.php b/tests/src/Kernel/GroupTypeConditionTest.php index ff2c52320..bd610108a 100644 --- a/tests/src/Kernel/GroupTypeConditionTest.php +++ b/tests/src/Kernel/GroupTypeConditionTest.php @@ -61,7 +61,7 @@ protected function setUp() { $this->installEntitySchema('entity_test'); $this->installEntitySchema('node'); $this->installEntitySchema('user'); - $this->installSchema('system', ['queue', 'sequences']); + $this->installSchema('system', ['sequences']); // Create three test groups of different types. for ($i = 0; $i < 2; $i++) { diff --git a/tests/src/Kernel/OgDeleteOrphansTest.php b/tests/src/Kernel/OgDeleteOrphansTest.php index 17fa75f3c..0afe7dc24 100644 --- a/tests/src/Kernel/OgDeleteOrphansTest.php +++ b/tests/src/Kernel/OgDeleteOrphansTest.php @@ -61,7 +61,7 @@ public function setUp() { $this->installEntitySchema('user'); $this->installEntitySchema('node'); $this->installSchema('node', 'node_access'); - $this->installSchema('system', ['queue', 'sequences']); + $this->installSchema('system', ['sequences']); /** @var \Drupal\og\OgDeleteOrphansPluginManager $plugin_manager */ $plugin_manager = \Drupal::service('plugin.manager.og.delete_orphans'); From 5d4278d55b80b89b04bcfec7eb7e43bc3a023ec4 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Mon, 22 Apr 2019 14:59:58 +0200 Subject: [PATCH 5/7] The `context` annotation has been deprecated in favor of `context_definitions` in Drupal 8.7. Ref. https://www.drupal.org/node/3016699 This breaks backwards compatibility with Drupal 8.6 which does not yet support the `context_definitions` annotation. --- .travis.yml | 1 - composer.json | 2 +- src/Plugin/Condition/GroupType.php | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index bce5b36f0..c9a113c28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,6 @@ env: global: - COMPOSER_MEMORY_LIMIT=2G matrix: - - TEST_SUITE=8.6.x - TEST_SUITE=8.7.x - TEST_SUITE=8.8.x - TEST_SUITE=PHP_CodeSniffer diff --git a/composer.json b/composer.json index 22da708b0..1adee5f32 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "source": "https://cgit.drupalcode.org/og" }, "require": { - "drupal/core": "~8.6" + "drupal/core": "~8.7" }, "require-dev": { "drupal/coder": "~8.2" diff --git a/src/Plugin/Condition/GroupType.php b/src/Plugin/Condition/GroupType.php index f6a3b64bd..a80f9a982 100644 --- a/src/Plugin/Condition/GroupType.php +++ b/src/Plugin/Condition/GroupType.php @@ -16,7 +16,7 @@ * @Condition( * id = "og_group_type", * label = @Translation("Group type"), - * context = { + * context_definitions = { * "og" = @ContextDefinition("entity", label = @Translation("Group")) * } * ) From 4ca9ec70db8007a184d3048e3a764f365a67ad23 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Mon, 22 Apr 2019 15:09:32 +0200 Subject: [PATCH 6/7] Use newer versions of deprecated classes and traits. --- tests/src/Functional/OgComplexWidgetTest.php | 9 ++++----- tests/src/Kernel/Entity/EntityCreateAccessTest.php | 4 ++-- tests/src/Kernel/Views/OgAdminMembersViewTest.php | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/src/Functional/OgComplexWidgetTest.php b/tests/src/Functional/OgComplexWidgetTest.php index 1d54bc9d8..c8b565f15 100644 --- a/tests/src/Functional/OgComplexWidgetTest.php +++ b/tests/src/Functional/OgComplexWidgetTest.php @@ -7,9 +7,9 @@ use Drupal\node\Entity\Node; use Drupal\og\Og; use Drupal\og\OgGroupAudienceHelperInterface; -use Drupal\simpletest\BrowserTestBase; -use Drupal\simpletest\ContentTypeCreationTrait; -use Drupal\simpletest\NodeCreationTrait; +use Drupal\Tests\BrowserTestBase; +use Drupal\Tests\node\Traits\ContentTypeCreationTrait; +use Drupal\Tests\node\Traits\NodeCreationTrait; /** * Tests the complex widget. @@ -88,7 +88,6 @@ public function testFields($field, $field_name) { $this->assertSession()->statusCodeEquals(200); // Retrieve the post that was created from the database. - /** @var QueryInterface $query */ $query = $this->container->get('entity_type.manager')->getStorage('node')->getQuery(); $result = $query ->condition('type', 'post') @@ -97,7 +96,7 @@ public function testFields($field, $field_name) { ->execute(); $post_nid = reset($result); - /** @var \Drupal\node\Entity\NodeInterface $post */ + /** @var \Drupal\node\NodeInterface $post */ $post = Node::load($post_nid); // Check that the post references the group correctly. diff --git a/tests/src/Kernel/Entity/EntityCreateAccessTest.php b/tests/src/Kernel/Entity/EntityCreateAccessTest.php index 0c919b11a..c135319fc 100644 --- a/tests/src/Kernel/Entity/EntityCreateAccessTest.php +++ b/tests/src/Kernel/Entity/EntityCreateAccessTest.php @@ -7,8 +7,8 @@ use Drupal\node\Entity\NodeType; use Drupal\og\Og; use Drupal\og\OgGroupAudienceHelperInterface; -use Drupal\simpletest\ContentTypeCreationTrait; -use Drupal\simpletest\NodeCreationTrait; +use Drupal\Tests\node\Traits\ContentTypeCreationTrait; +use Drupal\Tests\node\Traits\NodeCreationTrait; use Drupal\user\Entity\Role; use Drupal\user\Entity\User; diff --git a/tests/src/Kernel/Views/OgAdminMembersViewTest.php b/tests/src/Kernel/Views/OgAdminMembersViewTest.php index 277848675..5565b070b 100644 --- a/tests/src/Kernel/Views/OgAdminMembersViewTest.php +++ b/tests/src/Kernel/Views/OgAdminMembersViewTest.php @@ -5,7 +5,7 @@ use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; use Drupal\og\Og; -use Drupal\simpletest\UserCreationTrait; +use Drupal\Tests\user\Traits\UserCreationTrait; use Drupal\Tests\views\Kernel\ViewsKernelTestBase; use Drupal\views\Views; From 67cdc1112088942f1da634a5730ae17a6e84a7c3 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Mon, 22 Apr 2019 15:46:08 +0200 Subject: [PATCH 7/7] Allow to use release candidates for testing. --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1adee5f32..2719c766d 100644 --- a/composer.json +++ b/composer.json @@ -14,5 +14,6 @@ }, "require-dev": { "drupal/coder": "~8.2" - } + }, + "minimum-stability": "RC" }