diff --git a/.gitignore b/.gitignore index 94b97bb37a6..b0d79b906ed 100644 --- a/.gitignore +++ b/.gitignore @@ -99,3 +99,7 @@ datadog-setup.php # Key files *.key + +*.sql +*.tar.gz + diff --git a/.tugboat/config.yml b/.tugboat/config.yml index e1774544436..794dd839195 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -129,9 +129,9 @@ services: - composer va:theme:compile - composer va:web:install - - curl --remote-name https://dsva-vagov-prod-cms-backup-sanitized.s3-us-gov-west-1.amazonaws.com/files/cms-prod-files-latest.tgz - - tar --extract --gunzip --file cms-prod-files-latest.tgz --directory "${DOCROOT}/sites/default/files/" - - rm cms-prod-files-latest.tgz + # - curl --remote-name https://dsva-vagov-prod-cms-backup-sanitized.s3-us-gov-west-1.amazonaws.com/files/cms-prod-files-latest.tgz + # - tar --extract --gunzip --file cms-prod-files-latest.tgz --directory "${DOCROOT}/sites/default/files/" + # - rm cms-prod-files-latest.tgz # Set file permissions such that Drupal will not complain - chgrp -R www-data "${DOCROOT}/sites/default/files" diff --git a/composer.json b/composer.json index 85a06b473a8..c62ae77c492 100644 --- a/composer.json +++ b/composer.json @@ -132,7 +132,7 @@ "drupal/simplesamlphp_auth": "^3.2", "drupal/site_alert": "1.2", "drupal/slack": "^1.2", - "drupal/smart_date": "3.4.3", + "drupal/smart_date": "^3.5.1", "drupal/social_media_links": "^2.8", "drupal/string_field_formatter": "^2.0", "drupal/styleguide": "^2.0@beta", @@ -355,7 +355,8 @@ }, "drupal/cer": { "3197953-5 - Make d9 compatible": "https://www.drupal.org/files/issues/2021-03-19/cer-3197953-5.patch", - "3200122 - Remove delete hook": "https://www.drupal.org/files/issues/2021-02-24/delete-hook-added-in-dev-causes-test-failures.patch" + "3200122 - Remove delete hook": "https://www.drupal.org/files/issues/2021-02-24/delete-hook-added-in-dev-causes-test-failures.patch", + "3159702 - Drupal 9 missing 'config_export' definition": "https://www.drupal.org/files/issues/2020-07-16/3159702-2.patch" }, "drupal/content_lock": { "Content lock causes redirect response preventing migration rollback.": "https://www.drupal.org/files/issues/2018-08-28/2951652-4.patch" @@ -381,6 +382,7 @@ "Internal Claro tweaks": "patches/claro-css-tweaks.patch", "3176625 - Install from existing config with a theme that declares module dependencies fails": "https://www.drupal.org/files/issues/2021-05-18/fix_ConfigImportSubscriber_validateThemes-3176625-29.patch", "3099026 - Claro's preprocessing of field multiple value form's table header cell removes potential changes by others": "https://www.drupal.org/files/issues/2020-02-20/3099026-9.patch" + }, "drupal/decoupled_router": { "Unable to resolve path on node in other language than default": "https://www.drupal.org/files/issues/2021-05-05/3111456-34.patch" diff --git a/composer.lock b/composer.lock index 2ef35ba2d3a..544af45295f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cb85d5d456ff23311083599fb6c9ea0b", + "content-hash": "885493dfb19571429522e11aacc5e34f", "packages": [ { "name": "acquia/drupal-spec-tool", @@ -10060,17 +10060,17 @@ }, { "name": "drupal/smart_date", - "version": "3.4.3", + "version": "3.5.1", "source": { "type": "git", "url": "https://git.drupalcode.org/project/smart_date.git", - "reference": "3.4.3" + "reference": "3.5.1" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/smart_date-3.4.3.zip", - "reference": "3.4.3", - "shasum": "802f21abc5c1848b04b88169cd63e0980ed5ec85" + "url": "https://ftp.drupal.org/files/projects/smart_date-3.5.1.zip", + "reference": "3.5.1", + "shasum": "bebf090fee43ce53469146a07676b0a844bbcd8d" }, "require": { "drupal/core": "^8 || ^9", @@ -10083,8 +10083,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "3.4.3", - "datestamp": "1634467244", + "version": "3.5.1", + "datestamp": "1646337034", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -26174,5 +26174,5 @@ "platform-overrides": { "php": "7.4" }, - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.1.0" } diff --git a/config/dev/raven.settings.yml b/config/dev/raven.settings.yml new file mode 100644 index 00000000000..3f2a9cc041e --- /dev/null +++ b/config/dev/raven.settings.yml @@ -0,0 +1,35 @@ +environment: cms-prod +release: '' +log_levels: + 1: 1 + 2: 2 + 3: 3 + 4: 4 + 5: 5 + 6: 0 + 7: 0 + 8: 0 +stack: true +timeout: !!float 2 +message_limit: 2048 +trace: false +fatal_error_handler: true +fatal_error_handler_memory: 2560 +javascript_error_handler: true +drush_error_handler: true +public_dsn: '' +ssl: verify_ssl +ca_cert: '' +ignored_channels: + - 'access denied' + - 'page not found' +send_user_data: true +rate_limit: 0 +send_request_body: true +request_tracing: true +traces_sample_rate: !!float 0 +browser_traces_sample_rate: null +database_tracing: true +twig_tracing: true +auto_session_tracking: false +max_request_body_size: always diff --git a/config/dev/simplesamlphp_auth.settings.yml b/config/dev/simplesamlphp_auth.settings.yml deleted file mode 100644 index e9c1f6802ba..00000000000 --- a/config/dev/simplesamlphp_auth.settings.yml +++ /dev/null @@ -1,35 +0,0 @@ -activate: true -auth_source: default-sp -login_link_display_name: 'Login with PIV or other Smartcard.' -debug: true -secure: true -httponly: false -register_users: true -header_no_cache: false -allow: - default_login: true - set_drupal_pwd: true - default_login_roles: - authenticated: authenticated - content_api_consumer: content_api_consumer - documentation_editor: documentation_editor - content_editor: content_editor - content_reviewer: content_reviewer - content_publisher: content_publisher - content_admin: content_admin - redirect_administrator: redirect_administrator - admnistrator_users: admnistrator_users - administrator: administrator - default_login_users: '1,16' -logout_goto_url: '' -unique_id: VAUID -user_name: adUPN -sync: - user_name: true - mail: true -mail_attr: adUPN -role: - population: '' - eval_every_time: false -autoenablesaml: true -login_link_show: true diff --git a/config/sync/block.block.olivero_account_menu.yml b/config/sync/block.block.olivero_account_menu.yml new file mode 100644 index 00000000000..8862c9fe21c --- /dev/null +++ b/config/sync/block.block.olivero_account_menu.yml @@ -0,0 +1,27 @@ +uuid: a325cd0d-1f48-404e-8c63-6b01ab63ce13 +langcode: en +status: true +dependencies: + config: + - system.menu.account + module: + - system + theme: + - olivero +_core: + default_config_hash: gmxYWWHmgbe0Pnv8y48ZLSLH5mEHejOjAP6RLxUfdzU +id: olivero_account_menu +theme: olivero +region: secondary_menu +weight: -4 +provider: null +plugin: 'system_menu_block:account' +settings: + id: 'system_menu_block:account' + label: 'User account menu' + label_display: '0' + provider: system + level: 1 + depth: 1 + expand_all_items: false +visibility: { } diff --git a/config/sync/block.block.olivero_breadcrumbs.yml b/config/sync/block.block.olivero_breadcrumbs.yml new file mode 100644 index 00000000000..7539952a8e9 --- /dev/null +++ b/config/sync/block.block.olivero_breadcrumbs.yml @@ -0,0 +1,22 @@ +uuid: fc96d3a6-0c8c-4156-9dde-8bc616c4c9e8 +langcode: en +status: true +dependencies: + module: + - system + theme: + - olivero +_core: + default_config_hash: VhBzWb7lMRtIOg9G7VSw_0uopi-7zXeHq4vXqqV1HFE +id: olivero_breadcrumbs +theme: olivero +region: breadcrumb +weight: 0 +provider: null +plugin: system_breadcrumb_block +settings: + id: system_breadcrumb_block + label: Breadcrumbs + label_display: '0' + provider: system +visibility: { } diff --git a/config/sync/block.block.olivero_content.yml b/config/sync/block.block.olivero_content.yml new file mode 100644 index 00000000000..98e26e3d3a5 --- /dev/null +++ b/config/sync/block.block.olivero_content.yml @@ -0,0 +1,22 @@ +uuid: aed79885-3265-43cd-9cd5-3cd43d5dfa52 +langcode: en +status: true +dependencies: + module: + - system + theme: + - olivero +_core: + default_config_hash: erQSEZF2XUjNmgTl0uNRBzmg18ZGXwUcw2FhApoeuHk +id: olivero_content +theme: olivero +region: content +weight: 0 +provider: null +plugin: system_main_block +settings: + id: system_main_block + label: 'Main page content' + label_display: '0' + provider: system +visibility: { } diff --git a/config/sync/block.block.olivero_help.yml b/config/sync/block.block.olivero_help.yml new file mode 100644 index 00000000000..3e6608efbb6 --- /dev/null +++ b/config/sync/block.block.olivero_help.yml @@ -0,0 +1,22 @@ +uuid: dac6959c-9d85-4e46-a91c-445ccebcbedb +langcode: en +status: true +dependencies: + module: + - help + theme: + - olivero +_core: + default_config_hash: VfPFqqxfkomud5CO8DUijw85QIl9GIxh_nIxLOYESxg +id: olivero_help +theme: olivero +region: content_above +weight: 0 +provider: null +plugin: help_block +settings: + id: help_block + label: Help + label_display: '0' + provider: help +visibility: { } diff --git a/config/sync/block.block.olivero_main_menu.yml b/config/sync/block.block.olivero_main_menu.yml new file mode 100644 index 00000000000..c0b21748840 --- /dev/null +++ b/config/sync/block.block.olivero_main_menu.yml @@ -0,0 +1,27 @@ +uuid: bc3c71f0-86c7-4f83-a248-402d451f4120 +langcode: en +status: true +dependencies: + config: + - system.menu.main + module: + - system + theme: + - olivero +_core: + default_config_hash: KWAiziL39uEzmOJEql_wbUP2RtqGceL3WM2CfxhMelE +id: olivero_main_menu +theme: olivero +region: primary_menu +weight: 0 +provider: null +plugin: 'system_menu_block:main' +settings: + id: 'system_menu_block:main' + label: 'Main navigation' + label_display: '0' + provider: system + level: 1 + depth: 2 + expand_all_items: true +visibility: { } diff --git a/config/sync/block.block.olivero_messages.yml b/config/sync/block.block.olivero_messages.yml new file mode 100644 index 00000000000..d8966224364 --- /dev/null +++ b/config/sync/block.block.olivero_messages.yml @@ -0,0 +1,22 @@ +uuid: 3c6db102-553a-49c2-bf54-7dd18b6b1b71 +langcode: en +status: true +dependencies: + module: + - system + theme: + - olivero +_core: + default_config_hash: BZ5tpW7H8X4PVGRm3MImTIHd2tN0eF7zOtp4SpRYUA0 +id: olivero_messages +theme: olivero +region: highlighted +weight: -5 +provider: null +plugin: system_messages_block +settings: + id: system_messages_block + label: 'Status messages' + label_display: '0' + provider: system +visibility: { } diff --git a/config/sync/block.block.olivero_page_title.yml b/config/sync/block.block.olivero_page_title.yml new file mode 100644 index 00000000000..6031d9f1f28 --- /dev/null +++ b/config/sync/block.block.olivero_page_title.yml @@ -0,0 +1,20 @@ +uuid: 72012f30-1cab-4b6a-9923-680649a0209d +langcode: en +status: true +dependencies: + theme: + - olivero +_core: + default_config_hash: 6aOgWsNTXjqrDm98TXSAjP6qd2nCijD1xw45MrnbK-Y +id: olivero_page_title +theme: olivero +region: content_above +weight: -5 +provider: null +plugin: page_title_block +settings: + id: page_title_block + label: 'Page title' + label_display: '0' + provider: core +visibility: { } diff --git a/config/sync/block.block.olivero_powered.yml b/config/sync/block.block.olivero_powered.yml new file mode 100644 index 00000000000..2ba67233a6d --- /dev/null +++ b/config/sync/block.block.olivero_powered.yml @@ -0,0 +1,22 @@ +uuid: 70f4a8d5-e139-4218-87f5-c357181372cd +langcode: en +status: true +dependencies: + module: + - system + theme: + - olivero +_core: + default_config_hash: eYL19CLDyinGTWYQfBD1DswWzglEotE_kHnHx3AxTXM +id: olivero_powered +theme: olivero +region: footer_bottom +weight: 0 +provider: null +plugin: system_powered_by_block +settings: + id: system_powered_by_block + label: 'Powered by Drupal' + label_display: '0' + provider: system +visibility: { } diff --git a/config/sync/block.block.olivero_primary_local_tasks.yml b/config/sync/block.block.olivero_primary_local_tasks.yml new file mode 100644 index 00000000000..d9b15429a3e --- /dev/null +++ b/config/sync/block.block.olivero_primary_local_tasks.yml @@ -0,0 +1,22 @@ +uuid: e084af4f-5d0f-47c6-87b6-14cb07ee1180 +langcode: en +status: true +dependencies: + theme: + - olivero +_core: + default_config_hash: nGE3EoPQQaQCuqTUtZgw0-KIzmrqdKDzdNQf2JyPUt4 +id: olivero_primary_local_tasks +theme: olivero +region: highlighted +weight: -4 +provider: null +plugin: local_tasks_block +settings: + id: local_tasks_block + label: 'Primary tabs' + label_display: '0' + provider: core + primary: true + secondary: false +visibility: { } diff --git a/config/sync/block.block.olivero_secondary_local_tasks.yml b/config/sync/block.block.olivero_secondary_local_tasks.yml new file mode 100644 index 00000000000..dfad6dacbfd --- /dev/null +++ b/config/sync/block.block.olivero_secondary_local_tasks.yml @@ -0,0 +1,22 @@ +uuid: 80ed4d30-501b-4226-8a79-7003d7ee358b +langcode: en +status: true +dependencies: + theme: + - olivero +_core: + default_config_hash: ydSxdq7R66I8UMC460rOzlfzvlUL4VRbdwc6z9DWaUI +id: olivero_secondary_local_tasks +theme: olivero +region: highlighted +weight: -2 +provider: null +plugin: local_tasks_block +settings: + id: local_tasks_block + label: 'Secondary tabs' + label_display: '0' + provider: core + primary: false + secondary: true +visibility: { } diff --git a/config/sync/block.block.olivero_site_branding.yml b/config/sync/block.block.olivero_site_branding.yml new file mode 100644 index 00000000000..dd23a4453b4 --- /dev/null +++ b/config/sync/block.block.olivero_site_branding.yml @@ -0,0 +1,25 @@ +uuid: d758e76b-5a2e-48bd-87f8-c7bbbff8b6e8 +langcode: en +status: true +dependencies: + module: + - system + theme: + - olivero +_core: + default_config_hash: n_nlgjggHVfQt2H__zvLOKB2YtjPDbQ5tHijF9LE1aM +id: olivero_site_branding +theme: olivero +region: header +weight: 0 +provider: null +plugin: system_branding_block +settings: + id: system_branding_block + label: 'Site branding' + label_display: '0' + provider: system + use_site_logo: true + use_site_name: true + use_site_slogan: false +visibility: { } diff --git a/config/sync/block.block.olivero_syndicate.yml b/config/sync/block.block.olivero_syndicate.yml new file mode 100644 index 00000000000..2be830d1ae6 --- /dev/null +++ b/config/sync/block.block.olivero_syndicate.yml @@ -0,0 +1,23 @@ +uuid: 3b5d9f48-75e0-4691-8526-72890f9a9e89 +langcode: en +status: true +dependencies: + module: + - node + theme: + - olivero +_core: + default_config_hash: 0gq3VPg-_UM69FCCWurLFIrrnIjC2HLKhwo9iQNtcUo +id: olivero_syndicate +theme: olivero +region: social +weight: 0 +provider: null +plugin: node_syndicate_block +settings: + id: node_syndicate_block + label: 'RSS feed' + label_display: '0' + provider: node + block_count: 10 +visibility: { } diff --git a/config/sync/block.block.primary_admin_actions.yml b/config/sync/block.block.primary_admin_actions.yml new file mode 100644 index 00000000000..633628f9a27 --- /dev/null +++ b/config/sync/block.block.primary_admin_actions.yml @@ -0,0 +1,20 @@ +uuid: 3c8002b1-dff1-49e0-a7ea-d1946fa99351 +langcode: en +status: true +dependencies: + theme: + - olivero +_core: + default_config_hash: sDmKoL9ejxB_fvD_qmgOHa8HN3X9AIsbud2xK8brMiI +id: primary_admin_actions +theme: olivero +region: highlighted +weight: -5 +provider: null +plugin: local_actions_block +settings: + id: local_actions_block + label: 'Primary admin actions' + label_display: '0' + provider: core +visibility: { } diff --git a/config/sync/core.date_format.olivero_medium.yml b/config/sync/core.date_format.olivero_medium.yml new file mode 100644 index 00000000000..5e4150b2621 --- /dev/null +++ b/config/sync/core.date_format.olivero_medium.yml @@ -0,0 +1,13 @@ +uuid: f5e2a32c-7f47-4ede-950f-2232435dcdca +langcode: en +status: true +dependencies: + enforced: + theme: + - olivero +_core: + default_config_hash: Mt6cmxUbDZ9XxD6p25WQ8tj3_JcX8ylfcddwZc8gcAE +id: olivero_medium +label: 'Olivero Medium' +locked: false +pattern: 'j F, Y' diff --git a/config/sync/core.entity_view_display.node.landing_page.default.yml b/config/sync/core.entity_view_display.node.landing_page.default.yml index 9f73a472628..93da61fc231 100644 --- a/config/sync/core.entity_view_display.node.landing_page.default.yml +++ b/config/sync/core.entity_view_display.node.landing_page.default.yml @@ -175,13 +175,13 @@ content: weight: 7 region: content field_related_office: + type: entity_reference_entity_view label: above settings: view_mode: connect_with_us link: false third_party_settings: { } weight: 16 - type: entity_reference_entity_view region: content field_spokes: type: entity_reference_revisions_entity_view diff --git a/config/sync/core.extension.yml b/config/sync/core.extension.yml index 223b95a794d..acc098ff37b 100644 --- a/config/sync/core.extension.yml +++ b/config/sync/core.extension.yml @@ -146,6 +146,7 @@ module: pfm: 0 post_api: 0 prometheus_exporter: 0 + raven: 0 rdf: 0 redirect: 0 redirect_options: 0 @@ -159,7 +160,6 @@ module: seckit: 0 serialization: 0 simple_oauth: 0 - simplesamlphp_auth: 0 site_alert: 0 slack: 0 smart_date: 0 @@ -168,6 +168,7 @@ module: string_field_formatter: 0 styleguide: 0 subrequests: 0 + syslog: 0 system: 0 tablefield: 0 taxonomy: 0 @@ -196,7 +197,6 @@ module: va_gov_govdelivery: 0 va_gov_graphql: 0 va_gov_help_center: 0 - va_gov_login: 0 va_gov_media: 0 va_gov_menu_access: 0 va_gov_migrate: 0 @@ -232,4 +232,5 @@ theme: vagovadmin: 0 claro: 0 vagovclaro: 0 + olivero: 0 profile: minimal diff --git a/config/sync/node_link_report.settings.yml b/config/sync/node_link_report.settings.yml index bab28df35e4..c8f462c1702 100644 --- a/config/sync/node_link_report.settings.yml +++ b/config/sync/node_link_report.settings.yml @@ -14,6 +14,7 @@ domains_to_skip: |- ez-rider.org federalregister.gov hamptoninn3.hilton.com + help.id.me hiltongardeninn3.hilton.com imablefoundation.org loyola.donorscreen.org @@ -21,6 +22,7 @@ domains_to_skip: |- milvets.nc.gov music4veterans.org patriots-path.org + provisions4patriots.com ridelats.com teampossabilities.org tinyurl.com @@ -28,6 +30,7 @@ domains_to_skip: |- uvbh.org vaww.va.gov veteranscornerok.org + veteransofchathamcountyga.org visitutah.com webex.com woundedwarriorsmammoth.org @@ -47,6 +50,7 @@ domains_to_skip: |- www.milvets.nc.gov www.music4veterans.org www.portauthority.org + www.provisions4patriots.com www.qualityinn.com www.redroof.com www.ridelats.com diff --git a/config/sync/olivero.settings.yml b/config/sync/olivero.settings.yml new file mode 100644 index 00000000000..13703a6ea55 --- /dev/null +++ b/config/sync/olivero.settings.yml @@ -0,0 +1,16 @@ +_core: + default_config_hash: Ylohp6sdrL1dU4v-KcXzXTP-U8BAMgh4NWJA9eGHtO4 +favicon: + use_default: true +features: + comment_user_picture: true + comment_user_verification: true + favicon: true + node_user_picture: false +logo: + use_default: false +third_party_settings: + shortcut: + module_link: true +mobile_menu_all_widths: 0 +site_branding_bg_color: default diff --git a/config/sync/password_policy.password_policy.va_gov_cms.yml b/config/sync/password_policy.password_policy.va_gov_cms.yml index e83a97d7d43..cdf79145340 100644 --- a/config/sync/password_policy.password_policy.va_gov_cms.yml +++ b/config/sync/password_policy.password_policy.va_gov_cms.yml @@ -5,11 +5,9 @@ dependencies: { } id: va_gov_cms label: va_gov_cms password_reset: 0 -send_reset_email: false -send_pending_email: - - 0 policy_constraints: - id: password_strength_constraint strength_score: 3 -roles: { } +roles: + authenticated: authenticated diff --git a/config/sync/syslog.settings.yml b/config/sync/syslog.settings.yml new file mode 100644 index 00000000000..eb169d17151 --- /dev/null +++ b/config/sync/syslog.settings.yml @@ -0,0 +1,5 @@ +_core: + default_config_hash: vdXLRPZRg35PBykBRRXr6RTql5EJR_fUi2kxyZ8c5m0 +identity: drupal +facility: 176 +format: '!base_url|!timestamp|!type|!ip|!request_uri|!referer|!uid|!link|!message' diff --git a/config/sync/system.rss.yml b/config/sync/system.rss.yml index 18b255d20ff..1519c540efe 100644 --- a/config/sync/system.rss.yml +++ b/config/sync/system.rss.yml @@ -2,7 +2,7 @@ _core: default_config_hash: TlH7NNk46phfxu1mSUfwg1C0YqaGsUCeD4l9JQnQlDU langcode: en items: - view_mode: rss + view_mode: title limit: 10 channel: description: '' diff --git a/config/sync/system.theme.yml b/config/sync/system.theme.yml index 7fc95f366bc..d5bd4b79543 100644 --- a/config/sync/system.theme.yml +++ b/config/sync/system.theme.yml @@ -1,4 +1,4 @@ _core: default_config_hash: 6lQ55NXM9ysybMQ6NzJj4dtiQ1dAkOYxdDompa-r_kk admin: vagovclaro -default: vagovclaro +default: olivero diff --git a/config/sync/user.settings.yml b/config/sync/user.settings.yml index 6db2424b290..3e6626d8ab9 100644 --- a/config/sync/user.settings.yml +++ b/config/sync/user.settings.yml @@ -12,7 +12,7 @@ notify: register_admin_created: true register_no_approval_required: true register_pending_approval: true -register: admin_only +register: null cancel_method: user_cancel_block password_reset_timeout: 86400 password_strength: true diff --git a/docroot/.htaccess b/docroot/.htaccess index 5f2d1f8fdbc..2a4cc6988ee 100644 --- a/docroot/.htaccess +++ b/docroot/.htaccess @@ -13,15 +13,19 @@ Require all denied +#### Gung: not working on Ubuntu Apache. #### # If requested file or directory exists, skip the next rule. -RewriteCond %{DOCUMENT_ROOT}/$1 -f [OR] -RewriteCond %{DOCUMENT_ROOT}/$1 -d -RewriteRule (.*) - [S=1] +# RewriteCond %{DOCUMENT_ROOT}/$1 -f [OR] +# RewriteCond %{DOCUMENT_ROOT}/$1 -d +# RewriteRule (.*) - [S=1] + +#### Gung: not working on Ubuntu Apache. #### # If requested file exists in /static, rewrite to /static # Using only files here ensures the paths still resolve to Drupal and not to the index.html files. -RewriteCond %{DOCUMENT_ROOT}/static/$1 -f -RewriteRule (.*) /static/$1 [L] +# RewriteCond %{DOCUMENT_ROOT}/static/$1 -f +# RewriteRule (.*) /static/$1 [L] + # Protect files and directories from prying eyes. diff --git a/docroot/modules/custom/va_gov_backend/src/Plugin/Field/FieldWidget/TooltipTextFieldFormatter.php b/docroot/modules/custom/va_gov_backend/src/Plugin/Field/FieldWidget/TooltipTextFieldFormatter.php index 62e2444aaab..f411e98c348 100644 --- a/docroot/modules/custom/va_gov_backend/src/Plugin/Field/FieldWidget/TooltipTextFieldFormatter.php +++ b/docroot/modules/custom/va_gov_backend/src/Plugin/Field/FieldWidget/TooltipTextFieldFormatter.php @@ -101,7 +101,7 @@ class="css-tooltip-toggle" '), '#type' => 'textfield', - '#default_value' => isset($items[$delta]->value) ? $items[$delta]->value : NULL, + '#default_value' => isset($items[$delta]->value) ?: $items[$delta]->value, '#size' => $this->getSetting('size'), '#placeholder' => $this->getSetting('placeholder'), '#maxlength' => $this->getFieldSetting('max_length'), diff --git a/docroot/modules/custom/va_gov_backend/src/Service/VaGovUrl.php b/docroot/modules/custom/va_gov_backend/src/Service/VaGovUrl.php index 851d64fc192..58b68691306 100644 --- a/docroot/modules/custom/va_gov_backend/src/Service/VaGovUrl.php +++ b/docroot/modules/custom/va_gov_backend/src/Service/VaGovUrl.php @@ -5,7 +5,6 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Site\Settings; use Drupal\va_gov_build_trigger\Environment\EnvironmentDiscovery; -use Exception; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\RequestException; diff --git a/docroot/modules/custom/va_gov_backend/va_gov_backend.module b/docroot/modules/custom/va_gov_backend/va_gov_backend.module index 99844a77ef0..2d0d3fec766 100644 --- a/docroot/modules/custom/va_gov_backend/va_gov_backend.module +++ b/docroot/modules/custom/va_gov_backend/va_gov_backend.module @@ -1517,6 +1517,12 @@ function _va_gov_backend_gtm_settings() { if ($uid > 0) { $sections['userId'] = Crypt::hashBase64((string) $uid); $section_scheme = \Drupal::entityTypeManager()->getStorage('access_scheme')->load('section'); + + // Gung: fix the fatal error of TypeError: getUserSections(). + if (!$section_scheme instanceof AccessSchemeInterface) { + return $sections; + } + $user_sections = \Drupal::service('workbench_access.user_section_storage')->getUserSections($section_scheme, $user); if (in_array('administration', $user_sections)) { $sections['userSections'] = 'all'; diff --git a/docroot/modules/custom/va_gov_build_trigger/src/Command/CommandRunner.php b/docroot/modules/custom/va_gov_build_trigger/src/Command/CommandRunner.php index ae3f534496a..09de1abaa42 100644 --- a/docroot/modules/custom/va_gov_build_trigger/src/Command/CommandRunner.php +++ b/docroot/modules/custom/va_gov_build_trigger/src/Command/CommandRunner.php @@ -18,13 +18,13 @@ trait CommandRunner { * The number of concurrent processes to execute. * @param int $retry_count * The number of times to retry a failed command. - * @param callable $callback + * @param string[] $callback * (optional) A callback to invoke for each completed callback. * * @return array * An array of errors encountered when running commands. */ - protected function runCommands(array $commands, $concurrency = 1, $retry_count = 0, $callback = NULL) : array { + protected function runCommands(array $commands, $concurrency = 1, $retry_count = 0, array $callback = NULL) : array { $current_processes = []; $collected_errors = []; diff --git a/docroot/modules/custom/va_gov_build_trigger/va_gov_build_trigger.module b/docroot/modules/custom/va_gov_build_trigger/va_gov_build_trigger.module index 11b08131dd9..93468da4017 100644 --- a/docroot/modules/custom/va_gov_build_trigger/va_gov_build_trigger.module +++ b/docroot/modules/custom/va_gov_build_trigger/va_gov_build_trigger.module @@ -9,7 +9,11 @@ use Drupal\va_gov_build_trigger\GraphQLEntityQuery; /** * Implements hook_graphql_fields_alter(). - * + */ + +// phpcs:disable +/* function va_gov_build_trigger_graphql_fields_alter(array &$config) { $config['entity_query:node']['class'] = GraphQLEntityQuery::class; -}*/ +} +*/ diff --git a/docroot/modules/custom/va_gov_build_trigger/va_gov_build_trigger.services.yml b/docroot/modules/custom/va_gov_build_trigger/va_gov_build_trigger.services.yml index 3d0d242751b..aae635b1da2 100644 --- a/docroot/modules/custom/va_gov_build_trigger/va_gov_build_trigger.services.yml +++ b/docroot/modules/custom/va_gov_build_trigger/va_gov_build_trigger.services.yml @@ -21,6 +21,9 @@ services: class: GuzzleHttp\HandlerStack factory: ['Drupal\va_gov_build_trigger\Service\MiddlewareFactory', 'createHandlerStack'] arguments: ['@logger.channel.va_gov_build_trigger'] + va_gov.build_trigger.environment_discovery: + class: Drupal\va_gov_build_trigger\Environment\EnvironmentDiscovery + arguments: [ '@plugin.manager.va_gov.environment' ] va_gov_build_trigger.build_frontend: class: Drupal\va_gov_build_trigger\Service\BuildFrontend arguments: ['@messenger', '@logger.factory', '@va_gov.build_trigger.web_build_status', '@va_gov.build_trigger.environment_discovery', '@current_user'] @@ -35,9 +38,6 @@ services: arguments: ['@state'] va_gov.build_trigger.web_build_link_checker: class: Drupal\va_gov_build_trigger\WebBuildBrokenLinkChecker - va_gov.build_trigger.environment_discovery: - class: Drupal\va_gov_build_trigger\Environment\EnvironmentDiscovery - arguments: [ '@plugin.manager.va_gov.environment' ] plugin.manager.va_gov.environment: class: Drupal\va_gov_build_trigger\Environment\EnvironmentManager parent: default_plugin_manager diff --git a/docroot/modules/custom/va_gov_migrate/src/Paragraph/Base/QABase.php b/docroot/modules/custom/va_gov_migrate/src/Paragraph/Base/QABase.php index 24642a947b0..70510016a5c 100644 --- a/docroot/modules/custom/va_gov_migrate/src/Paragraph/Base/QABase.php +++ b/docroot/modules/custom/va_gov_migrate/src/Paragraph/Base/QABase.php @@ -67,7 +67,7 @@ protected function getParagraphField() { * {@inheritdoc} */ public static function attachParagraph(Paragraph $paragraph, EntityInterface &$entity, $parent_field, DOMQuery $query_path = NULL) { - list('allowed' => $allowed_paragraphs) = ParagraphMigrator::getAllowedParagraphs($entity, $parent_field); + ['allowed' => $allowed_paragraphs] = ParagraphMigrator::getAllowedParagraphs($entity, $parent_field); // If this field allows Q&As just add it normally. if (in_array('q_a', $allowed_paragraphs)) { ParagraphType::attachParagraph($paragraph, $entity, $parent_field); diff --git a/docroot/modules/custom/va_gov_migrate/src/Paragraph/CollapsiblePanelItem.php b/docroot/modules/custom/va_gov_migrate/src/Paragraph/CollapsiblePanelItem.php index 57e5f3d0344..868f23b4c09 100644 --- a/docroot/modules/custom/va_gov_migrate/src/Paragraph/CollapsiblePanelItem.php +++ b/docroot/modules/custom/va_gov_migrate/src/Paragraph/CollapsiblePanelItem.php @@ -19,7 +19,7 @@ class CollapsiblePanelItem extends ParagraphType { * * @var \QueryPath\DOMQuery */ - protected $tables; + protected $tables; /** * {@inheritdoc} diff --git a/docroot/modules/custom/va_gov_migrate/src/ParagraphMigrator.php b/docroot/modules/custom/va_gov_migrate/src/ParagraphMigrator.php index e29ea030c6d..3742f7ef756 100644 --- a/docroot/modules/custom/va_gov_migrate/src/ParagraphMigrator.php +++ b/docroot/modules/custom/va_gov_migrate/src/ParagraphMigrator.php @@ -322,7 +322,7 @@ public function addParagraphs(DOMQuery $query_path, EntityInterface &$parent_ent public function addWysiwyg(EntityInterface &$entity, $parent_field) { if (self::hasContent($this->wysiwyg)) { try { - list('allowed' => $allowed_paragraphs) = self::getAllowedParagraphs($entity, $parent_field); + ['allowed' => $allowed_paragraphs] = self::getAllowedParagraphs($entity, $parent_field); } catch (MigrateException $e) { Message::make('Could not add paragraphs to @field. ' . $e->getMessage(), ['@field' => $parent_field], Message::ERROR); diff --git a/docroot/modules/custom/va_gov_migrate/src/Plugin/migrate/source/SupportService.php b/docroot/modules/custom/va_gov_migrate/src/Plugin/migrate/source/SupportService.php index 3748ecb70a0..1bb7ebba339 100644 --- a/docroot/modules/custom/va_gov_migrate/src/Plugin/migrate/source/SupportService.php +++ b/docroot/modules/custom/va_gov_migrate/src/Plugin/migrate/source/SupportService.php @@ -35,12 +35,14 @@ protected function validateRows() { foreach ($row['social'][0]['subsections'] as $subsection) { foreach ($subsection['links'] as $service) { + // phpcs:disable. $this->serviceRows[] = [ 'service_name' => isset($service['label']) ? $service['label'] : $service['title'], 'service_url' => $service['url'], - 'service_number' => isset($service['number']) ? $service['number'] : '', + 'service_number' => isset($service['number']) ?: $service['number'], 'url' => $row['url'], ]; + // phpcs:enable. } } } diff --git a/docroot/modules/custom/va_gov_migrate/va_gov_migrate.install b/docroot/modules/custom/va_gov_migrate/va_gov_migrate.install index bacee4bc195..ca18087b776 100644 --- a/docroot/modules/custom/va_gov_migrate/va_gov_migrate.install +++ b/docroot/modules/custom/va_gov_migrate/va_gov_migrate.install @@ -141,10 +141,14 @@ function _va_gov_migrate_add_nodes_to_migrate_map(string $migration_name, array // Table does not exist yet so make it. $migration = \Drupal::getContainer()->get('plugin.manager.migration')->createInstance($migration_name); // Migrate just 1 item so the migrate map gets built. - $executable = new MigrateExecutable($migration, new MigrateMessage(), ['limit' => 1]); - $executable->import(); - // Roll it back so it does not exist. - $executable->rollback(); + + if ($migration instanceof MigrationInterface) { + + $executable = new MigrateExecutable($migration, new MigrateMessage(), ['limit' => 1]); + $executable->import(); + // Roll it back so it does not exist. + $executable->rollback(); + } } foreach ($nodes_to_be_migratized as $values) { diff --git a/docroot/modules/custom/va_gov_preview/src/StaticServiceProvider.php b/docroot/modules/custom/va_gov_preview/src/StaticServiceProvider.php index cf10519c242..30e50e8df46 100644 --- a/docroot/modules/custom/va_gov_preview/src/StaticServiceProvider.php +++ b/docroot/modules/custom/va_gov_preview/src/StaticServiceProvider.php @@ -29,7 +29,12 @@ class StaticServiceProvider implements ServiceModifierInterface { */ public function alter(ContainerBuilder $container) { if ($container->has('http_middleware.negotiation') && is_a($container->getDefinition('http_middleware.negotiation')->getClass(), '\Drupal\Core\StackMiddleware\NegotiationMiddleware', TRUE)) { - $container->getDefinition('http_middleware.negotiation')->addMethodCall('registerFormat', ['html', ['application/static+html']]); + $container + ->getDefinition('http_middleware.negotiation') + ->addMethodCall( + 'registerFormat', + ['html', ['application/static+html']] + ); } } diff --git a/docroot/modules/custom/va_gov_workflow/va_gov_workflow.services.yml b/docroot/modules/custom/va_gov_workflow/va_gov_workflow.services.yml index 35c452bb496..61f6c0865ad 100644 --- a/docroot/modules/custom/va_gov_workflow/va_gov_workflow.services.yml +++ b/docroot/modules/custom/va_gov_workflow/va_gov_workflow.services.yml @@ -1,12 +1,12 @@ services: + va_gov_workflow.flagger: + class: Drupal\va_gov_workflow\Service\Flagger + arguments: ['@flag', '@entity_type.manager'] va_gov_workflow.entity_event_subscriber: class: Drupal\va_gov_workflow\EventSubscriber\EntityEventSubscriber arguments: [ '@va_gov_user.user_perms', '@va_gov_workflow.workflow_content_control', '@va_gov_workflow.flagger'] tags: - { name: event_subscriber } - va_gov_workflow.flagger: - class: Drupal\va_gov_workflow\Service\Flagger - arguments: ['@flag', '@entity_type.manager'] va_gov_workflow.workflow_content_control: class: Drupal\va_gov_workflow\Service\WorkflowContentControl arguments: ['@va_gov_user.user_perms'] diff --git a/docroot/sites/default/settings.php b/docroot/sites/default/settings.php index b33662c69f3..ce2136c5142 100755 --- a/docroot/sites/default/settings.php +++ b/docroot/sites/default/settings.php @@ -19,7 +19,7 @@ 'password' => getenv('CMS_MARIADB_PASSWORD') ?: 'drupal8', 'prefix' => '', // 'database' is the default DB container for Lando (local). - 'host' => getenv('CMS_MARIADB_HOST') ?: 'database', + 'host' => getenv('CMS_MARIADB_HOST') ?: 'localhost', 'port' => 3306, 'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', ); @@ -248,3 +248,10 @@ $settings['container_yamls'][] = $app_root . '/' . $site_path . '/../default/services/services.memcache.yml'; $settings['memcache']['persistent'] = 'drupal'; } + +$settings['trusted_host_patterns'] = [ + '^loalhost$', + '^drupal-react\.test$', +]; + +ini_set('memory_limit', '1024M'); diff --git a/hooks/git/pre-commit b/hooks/git/pre-commit index 881fd6cbd8d..0a74fdf652c 100755 --- a/hooks/git/pre-commit +++ b/hooks/git/pre-commit @@ -6,7 +6,9 @@ error_msg="Aborting commit. Your branch name must be prefixed with a VAGOV-TEAM- no_match_vagov=1; [[ $branch_name =~ VAGOV-TEAM-[0-9]+ ]] && no_match_vagov=0 no_match_vacms=1; [[ $branch_name =~ VACMS-[0-9]+ ]] && no_match_vacms=0 -if [ $no_match_vagov == 1 ] && [ $no_match_vacms == 1 ]; then +no_match_dr=1; [[ $branch_name =~ DR-[0-9]+ ]] && no_match_vacms=0 + +if [ $no_match_vagov == 1 ] && [ $no_match_vacms == 1 && [ $no_match_dr == 1 ]; then echo "${error_msg}" >&2 exit 1 fi diff --git a/tests/behat/Drupal/FeatureContext.php b/tests/behat/Drupal/FeatureContext.php index f17c5d5780b..2afe8542b7f 100644 --- a/tests/behat/Drupal/FeatureContext.php +++ b/tests/behat/Drupal/FeatureContext.php @@ -11,8 +11,8 @@ /** * FeatureContext class defines custom step definitions for Behat. */ -class FeatureContext extends RawDrupalContext { - +class FeatureContext extends RawDrupalContext +{ use \Traits\FieldTrait; use \Traits\UserEntityTrait; use \Traits\ContentTrait; @@ -46,7 +46,8 @@ class FeatureContext extends RawDrupalContext { * You can also pass arbitrary arguments to the * context constructor through behat.yml. */ - public function __construct() { + public function __construct() + { $this->timestamp = time(); } @@ -55,7 +56,8 @@ public function __construct() { * * @AfterScenario */ - public function cleanUp() { + public function cleanUp() + { if (!empty($this->privateStorage)) { foreach ($this->privateStorage as $deletable) { $deletable->delete(); @@ -73,12 +75,12 @@ public function cleanUp() { * * @Then I visit the :arg1 page for a node with the title :arg2 */ - public function iViewNode($page, $title) { + public function iViewNode($page, $title) + { $nid = $this->getTestContentNidByTitle($title); if ($nid) { $this->visitPath("node/$nid/$page"); - } - else { + } else { throw new \Exception("Cannot locate a valid node with the title '$title'"); } } @@ -93,12 +95,12 @@ public function iViewNode($page, $title) { * * @Then I visit the :arg1 page for a term with the title :arg2 */ - public function iViewTerm($page, $title) { + public function iViewTerm($page, $title) + { $tid = $this->getTestContentTidByTitle($title); if ($tid) { $this->visitPath("taxonomy/term/$tid/$page"); - } - else { + } else { throw new \Exception("Cannot locate a valid term with the title '$title'"); } } @@ -111,7 +113,8 @@ public function iViewTerm($page, $title) { * * @Then I should see exactly :string */ - public function iShouldSeeExactly($string) { + public function iShouldSeeExactly($string) + { $session = $this->getSession(); $element = $session->getPage()->findAll('xpath', "//*[contains(text(), '$string')]"); @@ -128,7 +131,8 @@ public function iShouldSeeExactly($string) { * * @Then I should not see exactly :string */ - public function iShouldNotSeeExactly($string) { + public function iShouldNotSeeExactly($string) + { $session = $this->getSession(); $element = $session->getPage()->findAll('xpath', "//*[contains(text(), '$string')]"); @@ -145,7 +149,8 @@ public function iShouldNotSeeExactly($string) { * * @Then the :element element should not exist */ - public function theElementShouldNotExist($element) { + public function theElementShouldNotExist($element) + { $session = $this->getSession(); $element = $session->getPage()->find('css', $element); @@ -162,11 +167,12 @@ public function theElementShouldNotExist($element) { * * @Then the :selector element should exist */ - public function theElementShouldExist($selector) { + public function theElementShouldExist($selector) + { $session = $this->getSession(); $element = $session->getPage()->find('css', $selector); - if (NULL === $element) { + if (null === $element) { throw new \InvalidArgumentException(sprintf('Could not evaluate XPath: "%s"', $selector)); } } @@ -179,7 +185,8 @@ public function theElementShouldExist($selector) { * * @Then the xpath :expression should have no matches */ - public function theXpathExpressionShouldHaveNoMatches($expression) { + public function theXpathExpressionShouldHaveNoMatches($expression) + { $session = $this->getSession(); $element = $session->getPage()->find( 'xpath', @@ -200,10 +207,11 @@ public function theXpathExpressionShouldHaveNoMatches($expression) { * * @Then :element should have the attribute :attribute */ - public function theElementShouldHaveAttribute($element, $attribute) { + public function theElementShouldHaveAttribute($element, $attribute) + { $session = $this->getSession(); $element = $session->getPage()->find('css', $element); - if (NULL === $element) { + if (null === $element) { throw new \InvalidArgumentException(sprintf('This element is not available: "%s"', $element)); } $attribute_val = $element->getAttribute($attribute); @@ -224,7 +232,8 @@ public function theElementShouldHaveAttribute($element, $attribute) { * * @Then :element should have the attribute :attribute with value :value */ - public function theElementShouldHaveAttributeValue($element, $attribute, $value) { + public function theElementShouldHaveAttributeValue($element, $attribute, $value) + { $this->theElementShouldHaveAttribute($element, $attribute); $session = $this->getSession(); $element = $session->getPage()->find('css', $element); @@ -246,12 +255,13 @@ public function theElementShouldHaveAttributeValue($element, $attribute, $value) * * @Then :element should have the attribute :attribute containing value :value */ - public function theElementShouldHaveAttributeContainingValue($element, $attribute, $value) { + public function theElementShouldHaveAttributeContainingValue($element, $attribute, $value) + { $this->theElementShouldHaveAttribute($element, $attribute); $session = $this->getSession(); $element = $session->getPage()->find('css', $element); $attribute_val = $element->getAttribute($attribute); - if (strpos($attribute_val, $value) === FALSE) { + if (strpos($attribute_val, $value) === false) { throw new \InvalidArgumentException(sprintf('This attribute value "%s" does not contain value "%s"', $attribute_val, $value)); } } @@ -268,7 +278,8 @@ public function theElementShouldHaveAttributeContainingValue($element, $attribut * * @Then :element should have the attribute :attribute matching pattern :pattern */ - public function theElementShouldHaveAttributeMatchingPattern($element, $attribute, $pattern) { + public function theElementShouldHaveAttributeMatchingPattern($element, $attribute, $pattern) + { $this->theElementShouldHaveAttribute($element, $attribute); $session = $this->getSession(); $element = $session->getPage()->find('css', $element); @@ -290,7 +301,8 @@ public function theElementShouldHaveAttributeMatchingPattern($element, $attribut * * @Given I set the node with title :title to :status */ - public function setTheNodeWithTitle($status, $title) { + public function setTheNodeWithTitle($status, $title) + { /** @var array{id: int, node: \Drupal\node\NodeInterface} $nodes */ $nodes = \Drupal::entityTypeManager() ->getStorage('node') @@ -303,8 +315,7 @@ public function setTheNodeWithTitle($status, $title) { if ($status === 'published') { $node->setPublished(); $node->set('moderation_state', 'published'); - } - else { + } else { $node->setUnpublished(); $node->set('moderation_state', 'archived'); } @@ -319,13 +330,14 @@ public function setTheNodeWithTitle($status, $title) { * * @When I click on the xpath :expression */ - public function iClickOnTheXpath($expression) { + public function iClickOnTheXpath($expression) + { $session = $this->getSession(); $element = $session->getPage()->find( 'xpath', $session->getSelectorsHandler()->selectorToXpath('xpath', $expression) ); - if (NULL === $element) { + if (null === $element) { throw new \InvalidArgumentException(sprintf('Cannot find XPath expression: "%s"', $expression)); } $element->click(); @@ -339,13 +351,14 @@ public function iClickOnTheXpath($expression) { * * @When I click on the text :text */ - public function iClickOnTheText($text) { + public function iClickOnTheText($text) + { $session = $this->getSession(); $element = $session->getPage()->find( 'xpath', $session->getSelectorsHandler()->selectorToXpath('xpath', '*//*[text()="' . $text . '"]') ); - if (NULL === $element) { + if (null === $element) { throw new \InvalidArgumentException(sprintf('Cannot find text: "%s"', $text)); } @@ -357,11 +370,12 @@ public function iClickOnTheText($text) { * * @When I click on the element with selector :element */ - public function iClickOnTheElementWithSelector($element) { + public function iClickOnTheElementWithSelector($element) + { $session = $this->getSession(); $element = $session->getPage()->find('css', $element); - if (NULL === $element) { + if (null === $element) { throw new \InvalidArgumentException(sprintf('Could not evaluate XPath: "%s"', $element)); } @@ -380,15 +394,15 @@ public function iClickOnTheElementWithSelector($element) { * * @When I fill in :locator with the text :value */ - public function whenIfillInWith($locator, $value) { + public function whenIfillInWith($locator, $value) + { $session = $this->getSession(); $element = $session->getPage()->find('css', $locator); - if (NULL === $element) { + if (null === $element) { throw new \InvalidArgumentException(sprintf('Could not evaluate element: "%s"', $locator)); } $session->getPage()->find('css', $locator)->setValue($value); - } /** @@ -403,14 +417,15 @@ public function whenIfillInWith($locator, $value) { * * @Then the :option option from :select should be selected */ - public function theOptionFromShouldBeSelected($option, $select) { + public function theOptionFromShouldBeSelected($option, $select) + { $select_field = $this->getSession()->getPage()->find('css', $select); - if (NULL === $select_field) { + if (null === $select_field) { throw new \Exception(sprintf('The select "%s" was not found in the page %s', $select, $this->getSession()->getCurrentUrl())); } $option_field = $select_field->find('xpath', "//option[@selected='selected']"); - if (NULL === $option_field) { + if (null === $option_field) { throw new \Exception(sprintf('No option is selected in the %s select in the page %s', $select, $this->getSession()->getCurrentUrl())); } @@ -431,7 +446,8 @@ public function theOptionFromShouldBeSelected($option, $select) { * * @Then :selector should contain :item */ - public function thenSelectorShouldContain($selector, $item) { + public function thenSelectorShouldContain($selector, $item) + { $session = $this->getSession(); $select_item = $session->getPage()->find('css', $selector); if (empty($select_item)) { @@ -457,7 +473,8 @@ public function thenSelectorShouldContain($selector, $item) { * * @Then :selector should not contain :item */ - public function thenSelectorShouldNotContain($selector, $item) { + public function thenSelectorShouldNotContain($selector, $item) + { $session = $this->getSession(); $select_item = $session->getPage()->find('css', $selector); if (empty($select_item)) { @@ -477,14 +494,15 @@ public function thenSelectorShouldNotContain($selector, $item) { * @return array * The Drupal settings. */ - protected function getDrupalSettings() { + protected function getDrupalSettings() + { $session = $this->getSession(); $element = $session->getPage()->find('xpath', "//script[@data-drupal-selector='drupal-settings-json']"); - if (NULL === $element) { + if (null === $element) { throw new \Exception('The Drupal Settings JSON could not be retrieved.'); } $json = $element->getText(); - return json_decode($json, TRUE); + return json_decode($json, true); } /** @@ -492,7 +510,8 @@ protected function getDrupalSettings() { * * @Then the :arg1 flag for node :arg2 should be set for me */ - public function theFlagForNodeShouldBeSetForTheRevisionEditor(string $flagName, string $title) { + public function theFlagForNodeShouldBeSetForTheRevisionEditor(string $flagName, string $title) + { $account = User::load($this->getUserManager()->getCurrentUser()->uid); $flag_service = \Drupal::service('flag'); $flag = $flag_service->getFlagById($flagName); @@ -516,10 +535,11 @@ public function theFlagForNodeShouldBeSetForTheRevisionEditor(string $flagName, * * @BeforeScenario */ - public function gatherContexts(BeforeScenarioScope $scope) { + public function gatherContexts(BeforeScenarioScope $scope) + { /** @var \Behat\Behat\Context\Environment\InitializedContextEnvironment $environment */ $environment = $scope->getEnvironment(); - $this->drushContext = $environment->getContext(DrushContext::CLASS); + $this->drushContext = $environment->getContext(DrushContext::class); } /** @@ -527,7 +547,8 @@ public function gatherContexts(BeforeScenarioScope $scope) { * * @AfterStep */ - public function printWatchdogLogAfterFailedStep($event) { + public function printWatchdogLogAfterFailedStep($event) + { if ($event->getTestResult()->getResultCode() === TestResult::FAILED) { $this->drushContext->assertDrushCommand('wd-show'); $this->drushContext->printLastDrushOutput(); @@ -539,7 +560,8 @@ public function printWatchdogLogAfterFailedStep($event) { * * @AfterStep */ - public function printHtmlAfterFailedStep($event) { + public function printHtmlAfterFailedStep($event) + { if ($event->getTestResult()->getResultCode() === TestResult::FAILED) { $dumpPath = 'behat_failures'; $session = $this->getSession(); @@ -559,5 +581,4 @@ public function printHtmlAfterFailedStep($event) { echo "\nDumped HTML to $htmlPath\nDumped Text to $textPath\n"; } } - } diff --git a/tests/behavioral/cypress/integration/common/i_create_a_node.js b/tests/behavioral/cypress/integration/common/i_create_a_node.js index 59e90f257b5..23d3f8995e9 100644 --- a/tests/behavioral/cypress/integration/common/i_create_a_node.js +++ b/tests/behavioral/cypress/integration/common/i_create_a_node.js @@ -11,6 +11,34 @@ const creators = { cy.findAllByLabelText('Parent link').select('-- CMS Knowledge Base (disabled)', { force: true }); return cy.get('form.node-form').find('input#edit-submit').click(); }, + event: () => { + cy.visit('/node/add/event'); + cy.scrollTo('top'); + cy.findAllByLabelText('Name').type('[Test Data] ' + faker.lorem.sentence(), { force: true }); + cy.get('#edit-field-datetime-range-timezone-0-value-date').type('2023-12-05', { force: true }); + cy.get('#edit-field-datetime-range-timezone-0-value-time').type('12:00', { force: true }); + cy.findAllByLabelText('Where should the event be listed?').select('VA Alaska health care: Events', { force: true }); + cy.findAllByLabelText('Street address').type(faker.address.streetAddress(), { force: true }); + cy.findAllByLabelText('City').type(faker.address.city(), { force: true }); + cy.findAllByLabelText('State').select('Alabama', { force: true }); + cy.findAllByLabelText('Section').select('VACO', { force: true }); + cy.scrollToSelector('#edit-field-media-open-button'); + cy.get('#edit-field-media-open-button').click({ force: true }); + cy.get('.dropzone', { + timeout: 10000, + }); + cy.get('.dropzone').attachFile('images/polygon_image.png', { + subjectType: 'drag-n-drop', + }); + cy.wait(1000); + cy.findAllByLabelText('Alternative text').type(faker.lorem.sentence(), { force: true }); + cy.get('[data-drupal-selector="edit-media-0-fields-field-owner"]').select('VACO', { force: true }); + cy.get('button').contains('Save and insert').click({ force: true }); + cy.get('div.media-library-item[data-drupal-selector="edit-field-media-selection-0"]', { + timeout: 15000, + }); + return cy.get('form.node-form').find('input#edit-submit').click(); + }, health_care_region_detail_page: () => { cy.visit('/node/add/health_care_region_detail_page'); cy.scrollTo('top'); diff --git a/tests/behavioral/cypress/integration/common/i_should_see.js b/tests/behavioral/cypress/integration/common/i_should_see.js index 22bd3acfa50..2952689c89a 100644 --- a/tests/behavioral/cypress/integration/common/i_should_see.js +++ b/tests/behavioral/cypress/integration/common/i_should_see.js @@ -12,3 +12,12 @@ Then('I should not see an element with the xpath {string}', (expression) => cy.x Then('I should see xpath {string}', (expression) => cy.xpath(expression).should('exist')); Then('I should not see xpath {string}', (expression) => cy.xpath(expression).should('not.exist')); + +Then('I should see an image with the selector {string}', (selector) => { + cy.get(selector) + .should('be.visible') + .and(($img) => { + expect($img[0].naturalWidth).to.be.greaterThan(0); + expect($img[0].naturalHeight).to.be.greaterThan(0); + }); +}); diff --git a/tests/behavioral/cypress/integration/file_upload.feature b/tests/behavioral/cypress/integration/file_upload.feature new file mode 100644 index 00000000000..d39de0eea3a --- /dev/null +++ b/tests/behavioral/cypress/integration/file_upload.feature @@ -0,0 +1,11 @@ +@file_upload +Feature: Files can be uploaded and attached to nodes successfully + In order to reliably and predictably create content + As anybody involved in the project + I need to be able to upload and attach files to nodes. + + Scenario: We should be able to attach files to event nodes. + Given I am logged in as a user with the "content_admin" role + When I create a "event" node + Then I should see "polygon_image.png" + And I should see an image with the selector 'div.field--name-image a img' diff --git a/tests/phpunit/API/PostApiQueueTest.php b/tests/phpunit/API/PostApiQueueTest.php index 9b685b95478..6972dbf966e 100644 --- a/tests/phpunit/API/PostApiQueueTest.php +++ b/tests/phpunit/API/PostApiQueueTest.php @@ -152,10 +152,11 @@ protected function setExpiration($queue, $expire) { */ protected function processItem($data) { $apikey = Settings::get('post_api_apikey'); - $endpoint_path = isset($data['endpoint_path']) ? $data['endpoint_path'] : NULL; + $endpoint_path = isset($data['endpoint_path']) ?: $data['endpoint_path']; $endpoint = Settings::get('post_api_endpoint_host') . $endpoint_path; + // phpcs:disable. $payload = isset($data['payload']) ? $data['payload'] : []; - + // phpcs:enable. $request_service = \Drupal::service('post_api.request'); // Send POST request and return the response. diff --git a/tests/phpunit/Service/ExclusionTypesServiceTest.php b/tests/phpunit/Service/ExclusionTypesServiceTest.php index e32c882002f..8018c0c3302 100644 --- a/tests/phpunit/Service/ExclusionTypesServiceTest.php +++ b/tests/phpunit/Service/ExclusionTypesServiceTest.php @@ -31,9 +31,14 @@ class ExclusionTypesServiceTest extends UnitTestCase { public function setUp() { parent::setUp(); - $this->configFactory = $this->getConfigFactoryStub([ - 'exclusion_types_admin.settings' => ['types_to_exclude' => ['page' => 'page', 'office' => 'office']], - ]); + $this->configFactory = $this->getConfigFactoryStub( + [ + 'exclusion_types_admin.settings' + => [ + 'types_to_exclude' + => ['page' => 'page', 'office' => 'office'], + ] + ); $this->exclusionTypes = new ExclusionTypes($this->configFactory); $container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface');