From 3f63fd12707f8d4f2f981f0d61b13b56c91375e4 Mon Sep 17 00:00:00 2001
From: Claudiu Cristea <clau.cristea@gmail.com>
Date: Thu, 24 Nov 2022 18:30:26 +0200
Subject: [PATCH] ISAICP-7466: Fix the URL alias for IOPE news page.

---
 tests/features/update/deploy_108900.feature       | 15 +++++++++++++++
 .../custom/joinup_core/joinup_core.deploy.php     | 14 ++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 tests/features/update/deploy_108900.feature

diff --git a/tests/features/update/deploy_108900.feature b/tests/features/update/deploy_108900.feature
new file mode 100644
index 0000000000..bc43364b28
--- /dev/null
+++ b/tests/features/update/deploy_108900.feature
@@ -0,0 +1,15 @@
+@api @group-clone
+Feature: Covers \joinup_core_deploy_108900().
+
+  Scenario: Test that news creation works.
+
+    Given I am logged in as a moderator
+    And I am on the homepage
+    When I click "Interoperable Europe"
+    And I click "News"
+    Then the url should match "/interoperable-europe/latest-news"
+
+    When I click "Add news" in the plus button menu
+    Then the response status code should be 200
+    And the url should match "/interoperable-europe/news/add"
+    And I should see the heading "Add news"
diff --git a/web/modules/custom/joinup_core/joinup_core.deploy.php b/web/modules/custom/joinup_core/joinup_core.deploy.php
index d23968e722..6de171874d 100644
--- a/web/modules/custom/joinup_core/joinup_core.deploy.php
+++ b/web/modules/custom/joinup_core/joinup_core.deploy.php
@@ -13,3 +13,17 @@
  */
 
 declare(strict_types = 1);
+
+use Drupal\pathauto\PathautoState;
+
+/**
+ * Fix Interoperable Europe news creation link.
+ */
+function joinup_core_deploy_108900(): void {
+  $entityTypeManager = \Drupal::entityTypeManager();
+  $entityTypeManager->getStorage('node')->load(704825)->set('path', [
+    'pathauto' => PathautoState::SKIP,
+    'alias' => '/interoperable-europe/latest-news',
+  ])->save();
+  $entityTypeManager->getStorage('path_alias')->load(84170)->delete();
+}
-- 
GitLab