From 41341436d4dea174ece8672b24667dd55ec8ac50 Mon Sep 17 00:00:00 2001
From: Lee Rowlands <lee.rowlands@previousnext.com.au>
Date: Tue, 26 Jul 2022 06:20:59 +1000
Subject: [PATCH] Issue #3243121 by Spokje, alexpott, longwave, yogeshmpawar,
 skipper-vp, andregp, Rinku Jacob 13, catch, andypost, quietone, lauriii:
 Remove RDF module from the Standard profile

---
 .../tests/src/Functional/d6/Upgrade6Test.php  |  1 +
 .../d7/MultilingualReviewPageTest.php         |  1 +
 .../d7/NoMultilingualReviewPageTest.php       |  1 +
 .../tests/src/Functional/d7/Upgrade7Test.php  |  1 +
 .../optional}/rdf.mapping.comment.comment.yml |  3 ++
 .../optional}/rdf.mapping.node.article.yml    |  3 ++
 .../optional}/rdf.mapping.node.page.yml       |  3 ++
 .../rdf.mapping.taxonomy_term.tags.yml        |  3 ++
 .../src/Functional/StandardProfileTest.php    | 48 +++++++++++++++++--
 core/profiles/standard/standard.info.yml      |  1 -
 .../KernelTests/Config/DefaultConfigTest.php  | 12 ++++-
 11 files changed, 70 insertions(+), 7 deletions(-)
 rename core/{profiles/standard/config/install => modules/rdf/config/optional}/rdf.mapping.comment.comment.yml (94%)
 rename core/{profiles/standard/config/install => modules/rdf/config/optional}/rdf.mapping.node.article.yml (96%)
 rename core/{profiles/standard/config/install => modules/rdf/config/optional}/rdf.mapping.node.page.yml (95%)
 rename core/{profiles/standard/config/install => modules/rdf/config/optional}/rdf.mapping.taxonomy_term.tags.yml (88%)

diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php
index d14d64ca564b..6a1dfc721430 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php
@@ -25,6 +25,7 @@ class Upgrade6Test extends MigrateUpgradeExecuteTestBase {
     'forum',
     'language',
     'migrate_drupal_ui',
+    'rdf',
     'statistics',
     'telephone',
     'update',
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MultilingualReviewPageTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MultilingualReviewPageTest.php
index 7f057cadea83..46c6d3c165fb 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MultilingualReviewPageTest.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MultilingualReviewPageTest.php
@@ -26,6 +26,7 @@ class MultilingualReviewPageTest extends MultilingualReviewPageTestBase {
     'telephone',
     'book',
     'forum',
+    'rdf',
     'statistics',
     'syslog',
     'update',
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/NoMultilingualReviewPageTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/NoMultilingualReviewPageTest.php
index 1736abedbf6b..1cca66cc21bb 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/NoMultilingualReviewPageTest.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/NoMultilingualReviewPageTest.php
@@ -27,6 +27,7 @@ class NoMultilingualReviewPageTest extends NoMultilingualReviewPageTestBase {
     'forum',
     'language',
     'migrate_drupal_ui',
+    'rdf',
     'statistics',
     'telephone',
   ];
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php
index d4f52fdf5b7e..a71a50bf161d 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php
@@ -28,6 +28,7 @@ class Upgrade7Test extends MigrateUpgradeExecuteTestBase {
     'forum',
     'language',
     'migrate_drupal_ui',
+    'rdf',
     'statistics',
     'telephone',
   ];
diff --git a/core/profiles/standard/config/install/rdf.mapping.comment.comment.yml b/core/modules/rdf/config/optional/rdf.mapping.comment.comment.yml
similarity index 94%
rename from core/profiles/standard/config/install/rdf.mapping.comment.comment.yml
rename to core/modules/rdf/config/optional/rdf.mapping.comment.comment.yml
index f0d587a6677f..1bad0e40852d 100644
--- a/core/profiles/standard/config/install/rdf.mapping.comment.comment.yml
+++ b/core/modules/rdf/config/optional/rdf.mapping.comment.comment.yml
@@ -5,6 +5,9 @@ dependencies:
     - comment.type.comment
   module:
     - comment
+  enforced:
+    module:
+      - standard
 id: comment.comment
 targetEntityType: comment
 bundle: comment
diff --git a/core/profiles/standard/config/install/rdf.mapping.node.article.yml b/core/modules/rdf/config/optional/rdf.mapping.node.article.yml
similarity index 96%
rename from core/profiles/standard/config/install/rdf.mapping.node.article.yml
rename to core/modules/rdf/config/optional/rdf.mapping.node.article.yml
index 72427598111d..ade26bd7c205 100644
--- a/core/profiles/standard/config/install/rdf.mapping.node.article.yml
+++ b/core/modules/rdf/config/optional/rdf.mapping.node.article.yml
@@ -5,6 +5,9 @@ dependencies:
     - node.type.article
   module:
     - node
+  enforced:
+    module:
+      - standard
 id: node.article
 targetEntityType: node
 bundle: article
diff --git a/core/profiles/standard/config/install/rdf.mapping.node.page.yml b/core/modules/rdf/config/optional/rdf.mapping.node.page.yml
similarity index 95%
rename from core/profiles/standard/config/install/rdf.mapping.node.page.yml
rename to core/modules/rdf/config/optional/rdf.mapping.node.page.yml
index dd6535c30446..d8e9faf4b2e0 100644
--- a/core/profiles/standard/config/install/rdf.mapping.node.page.yml
+++ b/core/modules/rdf/config/optional/rdf.mapping.node.page.yml
@@ -5,6 +5,9 @@ dependencies:
     - node.type.page
   module:
     - node
+  enforced:
+    module:
+      - standard
 id: node.page
 targetEntityType: node
 bundle: page
diff --git a/core/profiles/standard/config/install/rdf.mapping.taxonomy_term.tags.yml b/core/modules/rdf/config/optional/rdf.mapping.taxonomy_term.tags.yml
similarity index 88%
rename from core/profiles/standard/config/install/rdf.mapping.taxonomy_term.tags.yml
rename to core/modules/rdf/config/optional/rdf.mapping.taxonomy_term.tags.yml
index 46b43f15f3da..c884a3354531 100644
--- a/core/profiles/standard/config/install/rdf.mapping.taxonomy_term.tags.yml
+++ b/core/modules/rdf/config/optional/rdf.mapping.taxonomy_term.tags.yml
@@ -5,6 +5,9 @@ dependencies:
     - taxonomy.vocabulary.tags
   module:
     - taxonomy
+  enforced:
+    module:
+      - standard
 id: taxonomy_term.tags
 targetEntityType: taxonomy_term
 bundle: tags
diff --git a/core/modules/rdf/tests/src/Functional/StandardProfileTest.php b/core/modules/rdf/tests/src/Functional/StandardProfileTest.php
index efe1f847da7c..53ec0bc2f7b9 100644
--- a/core/modules/rdf/tests/src/Functional/StandardProfileTest.php
+++ b/core/modules/rdf/tests/src/Functional/StandardProfileTest.php
@@ -13,7 +13,7 @@
 use Drupal\Tests\rdf\Traits\RdfParsingTrait;
 
 /**
- * Tests the RDF mappings and RDFa markup of the standard profile.
+ * Tests the RDF mappings and RDFa markup on top of the standard profile.
  *
  * @group rdf
  */
@@ -36,80 +36,118 @@ class StandardProfileTest extends BrowserTestBase {
   public $profile = 'standard';
 
   /**
+   * {@inheritdoc}
+   */
+  protected static $modules = ['rdf'];
+
+  /**
+   * The base URI.
+   *
    * @var string
    */
   protected $baseUri;
 
   /**
+   * The admin user.
+   *
    * @var \Drupal\user\UserInterface
    */
   protected $adminUser;
 
   /**
+   * The web user.
+   *
    * @var \Drupal\user\UserInterface
    */
   protected $webUser;
 
   /**
+   * The term to test.
+   *
    * @var \Drupal\taxonomy\TermInterface
    */
   protected $term;
 
   /**
+   * The image to test.
+   *
    * @var \Drupal\file\FileInterface
    */
   protected $image;
 
   /**
+   * The article to test.
+   *
    * @var \Drupal\node\NodeInterface
    */
   protected $article;
 
   /**
+   * The comment on the article to test.
+   *
    * @var \Drupal\comment\CommentInterface
    */
   protected $articleComment;
 
   /**
+   * The page to test.
+   *
    * @var \Drupal\node\NodeInterface
    */
   protected $page;
 
   /**
+   * The URI of the image to test.
+   *
    * @var string
    */
   protected $imageUri;
 
   /**
+   * The URI of the term to test.
+   *
    * @var string
    */
   protected $termUri;
 
   /**
+   * The URI of the article to test.
+   *
    * @var string
    */
   protected $articleUri;
 
   /**
+   * The URI of the page to test.
+   *
    * @var string
    */
   protected $pageUri;
 
   /**
+   * The URI of the author of the article to test.
+   *
    * @var string
    */
   protected $authorUri;
 
   /**
+   * The URI of the comment on the article to test.
+   *
    * @var string
    */
   protected $articleCommentUri;
 
   /**
+   * The URI of the author of the comment to test.
+   *
    * @var string
    */
   protected $commenterUri;
 
+  /**
+   * {@inheritdoc}
+   */
   protected function setUp(): void {
     parent::setUp();
 
@@ -161,7 +199,10 @@ protected function setUp(): void {
     ];
     $this->article = $this->drupalCreateNode($article_settings);
     // Create second article to test teaser list.
-    $this->drupalCreateNode(['type' => 'article', 'promote' => NodeInterface::PROMOTED]);
+    $this->drupalCreateNode([
+      'type' => 'article',
+      'promote' => NodeInterface::PROMOTED,
+    ]);
 
     // Create article comment.
     $this->articleComment = $this->saveComment($this->article->id(), $this->webUser->id(), NULL, 0);
@@ -212,7 +253,6 @@ protected function doFrontPageRdfaTests() {
     $this->drupalGet(Url::fromRoute('<front>'));
 
     // Ensure that both articles are listed.
-    // $this->assertCount(2, $this->getRdfGraph(Url::fromRoute('<front>'), $this->baseUri)->allOfType('http://schema.org/Article'), 'Two articles found on front page.');
     $this->assertEquals(2, $this->getElementByRdfTypeCount(Url::fromRoute('<front>'), $this->baseUri, 'http://schema.org/Article'), 'Two articles found on front page.');
 
     // Test interaction count.
@@ -455,7 +495,7 @@ protected function assertRdfaNodeCommentProperties(): void {
     $text = $this->articleComment->get('comment_body')->value;
     $expected_value = [
       'type' => 'literal',
-      // There is an extra carriage return in the when parsing comments as
+      // There is an extra carriage return in the value when parsing comments as
       // output by Bartik, so it must be added to the expected value.
       'value' => "$text
 ",
diff --git a/core/profiles/standard/standard.info.yml b/core/profiles/standard/standard.info.yml
index e6af5c213a84..e91c758a09cd 100644
--- a/core/profiles/standard/standard.info.yml
+++ b/core/profiles/standard/standard.info.yml
@@ -31,7 +31,6 @@ install:
   - toolbar
   - field_ui
   - file
-  - rdf
   - views
   - views_ui
   - tour
diff --git a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
index 5d27fd0a9a87..16fc5277d79a 100644
--- a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
+++ b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
@@ -124,8 +124,8 @@ protected function assertExtensionConfig(string $name, string $type): void {
       $modules_to_install = array_merge($modules_to_install, $dependency->getDependencies('module'));
       $themes_to_install = array_merge($themes_to_install, $dependency->getDependencies('theme'));
     }
-    // Remove core because that cannot be installed.
-    $modules_to_install = array_diff(array_unique($modules_to_install), ['core']);
+    // Remove core and standard because they cannot be installed.
+    $modules_to_install = array_diff(array_unique($modules_to_install), ['core', 'standard']);
     $this->container->get('module_installer')->install($modules_to_install);
     $this->container->get('theme_installer')->install(array_unique($themes_to_install));
 
@@ -224,6 +224,14 @@ protected function doTestsOnConfigStorage(StorageInterface $default_config_stora
         $this->assertNull($this->assertConfigDiff($result, $config_name, static::$skippedConfig));
       }
       else {
+        $data = $default_config_storage->read($config_name);
+        $dependency = new ConfigEntityDependency($config_name, $data);
+        if ($dependency->hasDependency('module', 'standard')) {
+          // Skip configuration with a dependency on the standard profile. Such
+          // configuration has probably been removed from the standard profile
+          // and needs its own test.
+          continue;
+        }
         $info = $this->container->get('extension.list.module')->getExtensionInfo($module);
         if (!isset($info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER]) || $info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] !== ExtensionLifecycle::EXPERIMENTAL) {
           $this->fail("$config_name provided by $module does not exist after installing all dependencies");
-- 
GitLab