From be1a87824a25368b70a801144f10c3d8163991a6 Mon Sep 17 00:00:00 2001 From: Claudiu Cristea <clau.cristea@gmail.com> Date: Mon, 3 Mar 2025 13:37:41 +0200 Subject: [PATCH] ISAICP-9536: QA remarks --- .../group.delete_with_content.feature | 34 ------------------- tests/src/Context/DebugContext.php | 14 ++++---- .../custom/joinup_core/joinup_core.deploy.php | 17 ++++------ 3 files changed, 14 insertions(+), 51 deletions(-) delete mode 100644 tests/features/joinup_group/group.delete_with_content.feature diff --git a/tests/features/joinup_group/group.delete_with_content.feature b/tests/features/joinup_group/group.delete_with_content.feature deleted file mode 100644 index 063429b11e..0000000000 --- a/tests/features/joinup_group/group.delete_with_content.feature +++ /dev/null @@ -1,34 +0,0 @@ -@api @group-e -Feature: - In order to not leave orphaned entities - As a collection owner - I need to be unable to delete groups that have group content. - - Scenario Outline: Delete a group with group content - Given <group type> content: - | title | state | - | <group label> with children | <state> | - And news content: - | title | state | - | News | published | - And event content: - | title | state | - | Event | published | - And document content: - | title | state | - | Document | published | - And discussion content: - | title | state | - | Discussion | published | - - When I am logged in as a moderator - And I go to the delete form of the "<group label> with children" <group type> - And I press "Delete" - Then I should see the text "The <group label> <group label> with children has been deleted." - When I go to the "Discussion" discussion - Then I should not see the heading "Discussion" - - Examples: - | group label | group type | - | Collection | collection | - | Solution | solution | diff --git a/tests/src/Context/DebugContext.php b/tests/src/Context/DebugContext.php index cc1c071a94..1e0c628991 100644 --- a/tests/src/Context/DebugContext.php +++ b/tests/src/Context/DebugContext.php @@ -31,13 +31,13 @@ public function printMessages(): void { */ public function noOprhanedContentShouldExistInTheWebsite(): void { $query = <<<SQL -SELECT n1.nid, n1.type, n1.title, n2.type, n2.title -FROM node_field_data n1 - LEFT JOIN node__og_audience oa ON n1.nid = oa.entity_id - LEFT JOIN node_field_data n2 ON oa.og_audience_target_id = n2.nid -WHERE n1.type IN('news', 'discussion', 'document', 'event', 'solution', 'distribution', 'release') - AND n2.nid IS NULL -SQL; + SELECT n1.nid, n1.type, n1.title, n2.type, n2.title + FROM node_field_data n1 + LEFT JOIN node__og_audience oa ON n1.nid = oa.entity_id + LEFT JOIN node_field_data n2 ON oa.og_audience_target_id = n2.nid + WHERE n1.type IN('news', 'discussion', 'document', 'event', 'solution', 'distribution', 'release') + AND n2.nid IS NULL + SQL; $nids = \Drupal::database()->query($query)->fetchCol(); if (!empty($nids)) { diff --git a/web/modules/custom/joinup_core/joinup_core.deploy.php b/web/modules/custom/joinup_core/joinup_core.deploy.php index f7429ad7f8..19b32e7fb3 100644 --- a/web/modules/custom/joinup_core/joinup_core.deploy.php +++ b/web/modules/custom/joinup_core/joinup_core.deploy.php @@ -190,18 +190,15 @@ function joinup_core_deploy_200304(): string { function joinup_core_deploy_200305(array &$sandbox): string { if (empty($sandbox['nids'])) { $query = <<<SQL -SELECT n1.nid, n1.type, n1.title, n2.type, n2.title -FROM node_field_data n1 - LEFT JOIN node__og_audience oa ON n1.nid = oa.entity_id - LEFT JOIN node_field_data n2 ON oa.og_audience_target_id = n2.nid -WHERE n1.type IN('news', 'discussion', 'document', 'event', 'solution', 'distribution', 'release') - AND n2.nid IS NULL -SQL; + SELECT n1.nid, n1.type, n1.title, n2.type, n2.title + FROM node_field_data n1 + LEFT JOIN node__og_audience oa ON n1.nid = oa.entity_id + LEFT JOIN node_field_data n2 ON oa.og_audience_target_id = n2.nid + WHERE n1.type IN('news', 'discussion', 'document', 'event', 'solution', 'distribution', 'release') + AND n2.nid IS NULL + SQL; $sandbox['nids'] = \Drupal::database()->query($query)->fetchCol(); - if (empty($sandbox['nids'])) { - return 'No orphaned content found.'; - } $sandbox['total'] = count($sandbox['nids']); $sandbox['progress'] = 0; -- GitLab