Test setup should copy default.settings.php/services.yml from assets

Created on 14 April 2024, 2 months ago
Updated 3 June 2024, 15 days ago

Problem/Motivation

FunctionalTestSetupTrait.php should copy default.settings.php and services.yml from the assets folder, since copying it from sites/default/ is more volatile, being dependent on the composer scaffold configuration. My observations is that people will develop phpunit tests within an existing site's codebase, so if the default.settings.php file is not in place unnecessary DX hurdle and stifles learning by example.

My logic is that, for sites/default/default.settings.php to be in place the scaffold MUST have run. If the scaffold has run then we assume the assets folder is intact. Therefore, simply copying the file from the assets folder is the same process but removes one step that is vulnerable to snowflake setups.

Steps to reproduce

In composer.json scaffold settings:

    "extra": {
        "drupal-scaffold": {
            "locations": {
                "web-root": "web/"
            },
            "file-mapping": {
                "[web-root]/sites/default/default.settings.php": false,
                "[web-root]/sites/default/default.services.yml": false
            }
        },

Proposed resolution

Change the line to copy the file from the asset folder. Every bootstrapped test in Drupal relies on this so an additional test would be redundant.

Remaining tasks

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

📌 Task
Status

Fixed

Version

10.4

Component
PHPUnit 

Last updated 3 minutes ago

Created by

🇦🇺Australia sime Canberra

Live updates comments and jobs are added and updated live.
  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024