Skip to content
Snippets Groups Projects
Commit 12e4bd11 authored by Kristiaan Van den Eynde's avatar Kristiaan Van den Eynde
Browse files

Merge branch '3489243-group-relationship-type' into '3.3.x'

Updated fixture so it also runs on newer versions, added long named content...

See merge request !199
parents 245dd9d3 fcebcd6c
No related branches found
No related tags found
No related merge requests found
Pipeline #361172 passed with warnings
......@@ -27,9 +27,10 @@ function group_update_10300(&$sandbox) {
// Short-circuit the following updates if we are already on version 3.
if (empty($group_content_type_configs)) {
\Drupal::state()->set('group_update_10300_detected_version', 3);
\Drupal::state()->set('group_update_10300_detected_legacy_version', FALSE);
return;
}
\Drupal::state()->set('group_update_10300_detected_legacy_version', TRUE);
$table_mapping = \Drupal::entityTypeManager()->getStorage('group_relationship')->getTableMapping();
assert($table_mapping instanceof DefaultTableMapping);
......@@ -224,7 +225,7 @@ function group_update_10300(&$sandbox) {
*/
function group_update_10301(&$sandbox) {
// Short-circuit the update if we are already on version 3.
if (\Drupal::state()->get('group_update_10300_detected_version', FALSE)) {
if (!\Drupal::state()->get('group_update_10300_detected_legacy_version', FALSE)) {
return;
}
......@@ -242,7 +243,7 @@ function group_update_10301(&$sandbox) {
*/
function group_update_10302(&$sandbox) {
// Short-circuit the update if we are already on version 3.
if (\Drupal::state()->get('group_update_10300_detected_version', FALSE)) {
if (!\Drupal::state()->get('group_update_10300_detected_legacy_version', FALSE)) {
return;
}
......
No preview for this file type
......@@ -17,17 +17,6 @@ use Drupal\field\FieldStorageConfigInterface;
*/
class Group2to3UpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
if (version_compare(\Drupal::VERSION, '11', '>=')) {
$this->markTestSkipped('The fixture for the upgrade path was made for Drupal 10.3, skipping test on later versions.');
}
}
/**
* {@inheritdoc}
*/
......@@ -127,6 +116,8 @@ class Group2to3UpdateTest extends UpdatePathTestBase {
$this->assertEquals([
'group.content_type.class-group_membership',
'group.content_type.class-group_node-page',
'group.content_type.group_content_type_0055e25dd2326',
'group.content_type.group_content_type_8b9eed1f843e7',
], \Drupal::configFactory()->listAll('group.content_type.'));
$this->assertEquals([], \Drupal::configFactory()->listAll('group.relationship_type.'));
......@@ -136,6 +127,8 @@ class Group2to3UpdateTest extends UpdatePathTestBase {
$this->assertEquals([
'group.relationship_type.class-group_membership',
'group.relationship_type.class-group_node-page',
'group.relationship_type.group_content_type_0055e25dd2326',
'group.relationship_type.group_content_type_8b9eed1f843e7',
], \Drupal::configFactory()->listAll('group.relationship_type.'));
}
......@@ -146,6 +139,8 @@ class Group2to3UpdateTest extends UpdatePathTestBase {
$this->assertEquals([
'uuid:000b9028-9efe-4a4f-9552-4ed2343481d5' => ['group.content_type.class-group_node-page'],
'uuid:1891ac47-eae0-4075-b85d-38c7ca8b5122' => ['group.content_type.class-group_membership'],
'uuid:33a8b55e-dd77-40b2-bd7c-6357e3992814' => ['group.content_type.group_content_type_0055e25dd2326'],
'uuid:cbac971a-14af-499a-954c-5b52d6493c01' => ['group.content_type.group_content_type_8b9eed1f843e7'],
], \Drupal::keyValue(QueryFactory::CONFIG_LOOKUP_PREFIX . 'group_content_type')->getAll());
$this->assertEquals([], \Drupal::keyValue(QueryFactory::CONFIG_LOOKUP_PREFIX . 'group_relationship_type')->getAll());
......@@ -155,6 +150,8 @@ class Group2to3UpdateTest extends UpdatePathTestBase {
$this->assertEquals([
'uuid:000b9028-9efe-4a4f-9552-4ed2343481d5' => ['group.relationship_type.class-group_node-page'],
'uuid:1891ac47-eae0-4075-b85d-38c7ca8b5122' => ['group.relationship_type.class-group_membership'],
'uuid:33a8b55e-dd77-40b2-bd7c-6357e3992814' => ['group.relationship_type.group_content_type_0055e25dd2326'],
'uuid:cbac971a-14af-499a-954c-5b52d6493c01' => ['group.relationship_type.group_content_type_8b9eed1f843e7'],
], \Drupal::keyValue(QueryFactory::CONFIG_LOOKUP_PREFIX . 'group_relationship_type')->getAll());
}
......@@ -223,7 +220,10 @@ class Group2to3UpdateTest extends UpdatePathTestBase {
$expected_map = [
'group_roles' => [
'type' => 'entity_reference',
'bundles' => ['class-group_membership' => 'class-group_membership'],
'bundles' => [
'class-group_membership' => 'class-group_membership',
'group_content_type_0055e25dd2326' => 'group_content_type_0055e25dd2326',
],
],
'field_short_field' => [
'type' => 'string',
......@@ -288,6 +288,15 @@ class Group2to3UpdateTest extends UpdatePathTestBase {
}
}
/**
* Tests that a state key is set when the legacy version was detected.
*/
public function testLegacyVersionStateEntry() {
$this->assertNull(\Drupal::state()->get('group_update_10300_detected_legacy_version'));
$this->runUpdates();
$this->assertTrue(\Drupal::state()->get('group_update_10300_detected_legacy_version'));
}
/**
* Gets the entity field manager.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment