From 9baae1bea8044ed4bab1d8e688155283245a2f88 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Tue, 15 Nov 2022 11:10:54 +0000
Subject: [PATCH] Issue #2254175 by smustgrave, pooja saraah, larowlan, sun:
 Fix test performance of Drupal\comment\Tests\CommentPreviewTest

---
 .../src/Functional/CommentPreviewTest.php     | 13 ++++---
 ....entity_form_display.user.user.default.yml | 35 ++++++++++++++++++
 ....entity_view_display.user.user.compact.yml | 28 ++++++++++++++
 ....entity_view_display.user.user.default.yml | 29 +++++++++++++++
 .../field.field.user.user.user_picture.yml    | 37 +++++++++++++++++++
 .../field.storage.user.user_picture.yml       | 31 ++++++++++++++++
 .../test_user_config.info.yml                 |  7 ++++
 7 files changed, 175 insertions(+), 5 deletions(-)
 create mode 100644 core/modules/system/tests/modules/test_user_config/config/install/core.entity_form_display.user.user.default.yml
 create mode 100644 core/modules/system/tests/modules/test_user_config/config/install/core.entity_view_display.user.user.compact.yml
 create mode 100644 core/modules/system/tests/modules/test_user_config/config/install/core.entity_view_display.user.user.default.yml
 create mode 100644 core/modules/system/tests/modules/test_user_config/config/install/field.field.user.user.user_picture.yml
 create mode 100644 core/modules/system/tests/modules/test_user_config/config/install/field.storage.user.user_picture.yml
 create mode 100644 core/modules/system/tests/modules/test_user_config/test_user_config.info.yml

diff --git a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
index 6e24d5ebb0f0..f9043c5342d1 100644
--- a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
@@ -20,13 +20,16 @@ class CommentPreviewTest extends CommentTestBase {
   }
 
   /**
-   * The profile to install as a basis for testing.
+   * Modules to install.
    *
-   * Using the standard profile to test user picture display in comments.
-   *
-   * @var string
+   * @var array
+   */
+  protected static $modules = ['olivero_test', 'test_user_config'];
+
+  /**
+   * {@inheritdoc}
    */
-  protected $profile = 'standard';
+  protected $defaultTheme = 'olivero';
 
   /**
    * Tests comment preview.
diff --git a/core/modules/system/tests/modules/test_user_config/config/install/core.entity_form_display.user.user.default.yml b/core/modules/system/tests/modules/test_user_config/config/install/core.entity_form_display.user.user.default.yml
new file mode 100644
index 000000000000..8098d4688a6d
--- /dev/null
+++ b/core/modules/system/tests/modules/test_user_config/config/install/core.entity_form_display.user.user.default.yml
@@ -0,0 +1,35 @@
+langcode: en
+status: true
+dependencies:
+  config:
+    - field.field.user.user.user_picture
+    - image.style.thumbnail
+  module:
+    - image
+    - user
+id: user.user.default
+targetEntityType: user
+bundle: user
+mode: default
+content:
+  account:
+    weight: -10
+    region: content
+  contact:
+    weight: 5
+    region: content
+  language:
+    weight: 0
+    region: content
+  timezone:
+    weight: 6
+    region: content
+  user_picture:
+    type: image_image
+    weight: -1
+    region: content
+    settings:
+      progress_indicator: throbber
+      preview_image_style: thumbnail
+    third_party_settings: {  }
+hidden: {  }
diff --git a/core/modules/system/tests/modules/test_user_config/config/install/core.entity_view_display.user.user.compact.yml b/core/modules/system/tests/modules/test_user_config/config/install/core.entity_view_display.user.user.compact.yml
new file mode 100644
index 000000000000..1e0ea7c9f7e2
--- /dev/null
+++ b/core/modules/system/tests/modules/test_user_config/config/install/core.entity_view_display.user.user.compact.yml
@@ -0,0 +1,28 @@
+langcode: en
+status: true
+dependencies:
+  config:
+    - core.entity_view_mode.user.compact
+    - field.field.user.user.user_picture
+    - image.style.thumbnail
+  module:
+    - image
+    - user
+id: user.user.compact
+targetEntityType: user
+bundle: user
+mode: compact
+content:
+  user_picture:
+    type: image
+    label: hidden
+    settings:
+      image_style: thumbnail
+      image_link: content
+      image_loading:
+        attribute: lazy
+    third_party_settings: {  }
+    weight: 0
+    region: content
+hidden:
+  member_for: true
diff --git a/core/modules/system/tests/modules/test_user_config/config/install/core.entity_view_display.user.user.default.yml b/core/modules/system/tests/modules/test_user_config/config/install/core.entity_view_display.user.user.default.yml
new file mode 100644
index 000000000000..9bc86dc8906a
--- /dev/null
+++ b/core/modules/system/tests/modules/test_user_config/config/install/core.entity_view_display.user.user.default.yml
@@ -0,0 +1,29 @@
+langcode: en
+status: true
+dependencies:
+  config:
+    - field.field.user.user.user_picture
+    - image.style.thumbnail
+  module:
+    - image
+    - user
+id: user.user.default
+targetEntityType: user
+bundle: user
+mode: default
+content:
+  member_for:
+    weight: 5
+    region: content
+  user_picture:
+    type: image
+    label: hidden
+    settings:
+      image_style: thumbnail
+      image_link: content
+      image_loading:
+        attribute: lazy
+    third_party_settings: {  }
+    weight: 0
+    region: content
+hidden: {  }
diff --git a/core/modules/system/tests/modules/test_user_config/config/install/field.field.user.user.user_picture.yml b/core/modules/system/tests/modules/test_user_config/config/install/field.field.user.user.user_picture.yml
new file mode 100644
index 000000000000..1038af3419e8
--- /dev/null
+++ b/core/modules/system/tests/modules/test_user_config/config/install/field.field.user.user.user_picture.yml
@@ -0,0 +1,37 @@
+langcode: en
+status: true
+dependencies:
+  config:
+    - field.storage.user.user_picture
+  module:
+    - image
+    - user
+id: user.user.user_picture
+field_name: user_picture
+entity_type: user
+bundle: user
+label: Picture
+description: 'Your virtual face or picture.'
+required: false
+translatable: true
+default_value: {  }
+default_value_callback: ''
+settings:
+  handler: 'default:file'
+  handler_settings: {  }
+  file_directory: 'pictures/[date:custom:Y]-[date:custom:m]'
+  file_extensions: 'png gif jpg jpeg'
+  max_filesize: ''
+  max_resolution: ''
+  min_resolution: ''
+  alt_field: false
+  alt_field_required: false
+  title_field: false
+  title_field_required: false
+  default_image:
+    uuid: null
+    alt: ''
+    title: ''
+    width: null
+    height: null
+field_type: image
diff --git a/core/modules/system/tests/modules/test_user_config/config/install/field.storage.user.user_picture.yml b/core/modules/system/tests/modules/test_user_config/config/install/field.storage.user.user_picture.yml
new file mode 100644
index 000000000000..6d0476df6c20
--- /dev/null
+++ b/core/modules/system/tests/modules/test_user_config/config/install/field.storage.user.user_picture.yml
@@ -0,0 +1,31 @@
+langcode: en
+status: true
+dependencies:
+  module:
+    - file
+    - image
+    - user
+id: user.user_picture
+field_name: user_picture
+entity_type: user
+type: image
+settings:
+  target_type: file
+  display_field: false
+  display_default: false
+  uri_scheme: public
+  default_image:
+    uuid: null
+    alt: ''
+    title: ''
+    width: null
+    height: null
+module: image
+locked: false
+cardinality: 1
+translatable: true
+indexes:
+  target_id:
+    - target_id
+persist_with_no_fields: false
+custom_storage: false
diff --git a/core/modules/system/tests/modules/test_user_config/test_user_config.info.yml b/core/modules/system/tests/modules/test_user_config/test_user_config.info.yml
new file mode 100644
index 000000000000..d7df7fc0a23e
--- /dev/null
+++ b/core/modules/system/tests/modules/test_user_config/test_user_config.info.yml
@@ -0,0 +1,7 @@
+name: 'Test User Config'
+type: module
+description: 'Provides a test user config.'
+package: Testing
+version: VERSION
+dependencies:
+  - drupal:user
-- 
GitLab