diff --git a/.ddev/addon-metadata/ddev-selenium-standalone-chrome/manifest.yaml b/.ddev/addon-metadata/ddev-selenium-standalone-chrome/manifest.yaml new file mode 100644 index 0000000000..7715e9d662 --- /dev/null +++ b/.ddev/addon-metadata/ddev-selenium-standalone-chrome/manifest.yaml @@ -0,0 +1,19 @@ +name: ddev-selenium-standalone-chrome +repository: ddev/ddev-selenium-standalone-chrome +version: 2.1.0 +install_date: "2025-12-22T17:17:07-05:00" +project_files: + - docker-compose.selenium-chrome.yaml + - config.selenium-standalone-chrome.yaml +global_files: [] +removal_actions: + - | + #ddev-nodisplay + #ddev-description:Remove docker-compose.selenium-chrome_extras.yaml file + if [ -f docker-compose.selenium-chrome_extras.yaml ]; then + if grep -q '#ddev-generated' docker-compose.selenium-chrome_extras.yaml; then + rm -f docker-compose.selenium-chrome_extras.yaml + else + echo "Unwilling to remove '$DDEV_APPROOT/.ddev/docker-compose.selenium-chrome_extras.yaml' because it does not have #ddev-generated in it; you can manually delete it if it is safe to delete." + fi + fi diff --git a/.ddev/commands/web/blt b/.ddev/commands/web/blt new file mode 100755 index 0000000000..4d51f8296a --- /dev/null +++ b/.ddev/commands/web/blt @@ -0,0 +1,12 @@ +#!/bin/bash + +## Description: run blt in the web container +## Usage: blt [flags] [args] +## Example: "ddev blt setup" or "ddev blt validate" or "ddev blt tests" or "ddev blt source:build" + +if ! command -v blt >/dev/null; then + echo "blt is not available. You may need to 'composer require acquia/blt'" + exit 1 +fi + +/var/www/html/vendor/acquia/blt/bin/blt $@ diff --git a/.ddev/config.selenium-standalone-chrome.yaml b/.ddev/config.selenium-standalone-chrome.yaml new file mode 100644 index 0000000000..842c650b87 --- /dev/null +++ b/.ddev/config.selenium-standalone-chrome.yaml @@ -0,0 +1,31 @@ +#ddev-generated +# Remove the line above if you don't want this file to be overwritten when you run +# ddev get ddev/ddev-selenium-standalone-chrome +# +# This file comes from https://github.com/ddev/ddev-selenium-standalone-chrome +# +web_environment: + - BROWSERTEST_OUTPUT_DIRECTORY=/tmp + - BROWSERTEST_OUTPUT_BASE_URL=${DDEV_PRIMARY_URL} + - SIMPLETEST_BASE_URL=http://web + - SIMPLETEST_DB=mysql://db:db@db/db + # Use disable-dev-shm-usage instead of setting shm_usage + # https://developers.google.com/web/tools/puppeteer/troubleshooting#tips + # The format of chromeOptions is defined at https://chromedriver.chromium.org/capabilities + - MINK_DRIVER_ARGS_WEBDRIVER=[\"chrome\", {\"browserName\":\"chrome\",\"goog:chromeOptions\":{\"w3c\":true,\"args\":[\"--disable-dev-shm-usage\",\"--disable-gpu\",\"--headless\",\"--dns-prefetch-disable\"]}}, \"http://selenium-chrome:4444/wd/hub\"] + # Nightwatch + - DRUPAL_TEST_BASE_URL=http://web + - DRUPAL_TEST_DB_URL=mysql://db:db@db/db + - DRUPAL_TEST_WEBDRIVER_HOSTNAME=selenium-chrome + - DRUPAL_TEST_WEBDRIVER_PORT=4444 + - DRUPAL_TEST_WEBDRIVER_PATH_PREFIX=/wd/hub + - DRUPAL_TEST_WEBDRIVER_W3C=true + # --window-size=1920,1080 is needed to fix random timeouts in tests. See: https://community.latenode.com/t/selenium-webdriver-timeout-issue-when-running-in-headless-mode-with-c/21952/4 + - DRUPAL_TEST_WEBDRIVER_CHROME_ARGS=--disable-dev-shm-usage --disable-gpu --headless --dns-prefetch-disable --window-size=1920,1080 + - DRUPAL_TEST_CHROMEDRIVER_AUTOSTART=false + - DRUPAL_NIGHTWATCH_SEARCH_DIRECTORY=../ + - DRUPAL_NIGHTWATCH_IGNORE_DIRECTORIES=node_modules,vendor,.*,sites/*/files,sites/*/private,sites/simpletest + - DRUPAL_NIGHTWATCH_OUTPUT=reports/nightwatch + # DTT + - DTT_BASE_URL=http://web + - DTT_MINK_DRIVER_ARGS=[\"chrome\", {\"browserName\":\"chrome\",\"goog:chromeOptions\":{\"w3c\":true,\"args\":[\"--disable-dev-shm-usage\",\"--disable-gpu\",\"--headless\",\"--dns-prefetch-disable\"]}}, \"http://selenium-chrome:4444/wd/hub\"] diff --git a/.ddev/config.yaml b/.ddev/config.yaml new file mode 100644 index 0000000000..fc36a6accf --- /dev/null +++ b/.ddev/config.yaml @@ -0,0 +1,336 @@ +name: cgdp-ddev +type: drupal10 +docroot: docroot +php_version: "8.3" +webserver_type: apache-fpm +xdebug_enabled: false +additional_hostnames: [] +additional_fqdns: [] +database: + type: mysql + version: "8.0" +use_dns_when_possible: true +composer_version: "2" +web_environment: [] +webimage_extra_packages: + ## Requirements for Cypress + - chromium + - libgbm1 + - libasound2 + - libnss3 + - xvfb + - libgtk-3-0 +upload_dirs: + - sites/default/files + - ../files-private +nodejs_version: 22.17.1 +corepack_enable: false + +hooks: + "pre-start": + ## By default, DDEV mounts will create the mount point as a directory + ## if it does not exist. .npmrc and .composer/auth.json are files. + - exec-host: | + echo "Checking .npmrc and composer auth file existence." + if [ ! -f "$HOME/.npmrc" ] || [ ! -f "$HOME/.composer/auth.json" ]; then + echo "Error: Both ~/.npmrc and ~/.composer/auth.json are required." + echo "Please ensure they exist on your host system." + exit 1 + fi + + "post-start": + - exec: | + echo "Refreshing Cypress packages" + pushd ./tests/cypress && npm ci && popd + + "post-stop": + - exec-host: | + printf "\n\033[1;31m********************************************************************************\n" + printf "WARNING: Do not make changes to the repository folder (including switching branches) \n" + printf "when the DDEV instance is stopped.\n" + printf "If you do make changes, the mutagen sync process will overwrite the host files with the contents \n" + printf "inside of the container.\n" + printf "********************************************************************************\033[0m\n\n" + + +# Key features of DDEV's config.yaml: + +# name: # Name of the project, automatically provides +# http://projectname.ddev.site and https://projectname.ddev.site +# If the name is omitted, the project will take the name of the enclosing directory, +# which is useful if you want to have a copy of the project side by side with this one. + +# type: # backdrop, cakephp, craftcms, drupal, drupal6, drupal7, drupal8, drupal9, drupal10, drupal11, generic, laravel, magento, magento2, php, shopware6, silverstripe, symfony, typo3, wordpress +# See https://docs.ddev.com/en/stable/users/quickstart/ for more +# information on the different project types + +# docroot: # Relative path to the directory containing index.php. + +# php_version: "8.3" # PHP version to use, "5.6" through "8.5" + +# You can explicitly specify the webimage but this +# is not recommended, as the images are often closely tied to DDEV's' behavior, +# so this can break upgrades. + +# webimage: +# It’s unusual to change this option, and we don’t recommend it without Docker experience and a good reason. +# Typically, this means additions to the existing web image using a .ddev/web-build/Dockerfile.* + +# database: +# type: # mysql, mariadb, postgres +# version: # database version, like "10.11" or "8.0" +# MariaDB versions can be 5.5-10.8, 10.11, 11.4, 11.8 +# MySQL versions can be 5.5-8.0, 8.4 +# PostgreSQL versions can be 9-18 + +# router_http_port: # Port to be used for http (defaults to global configuration, usually 80) +# router_https_port: # Port for https (defaults to global configuration, usually 443) + +# xdebug_enabled: false # Set to true to enable Xdebug and "ddev start" or "ddev restart" +# Note that for most people the commands +# "ddev xdebug" to enable Xdebug and "ddev xdebug off" to disable it work better, +# as leaving Xdebug enabled all the time is a big performance hit. + +# xhgui_http_port: "8143" +# xhgui_https_port: "8142" +# The XHGui ports can be changed from the default 8143 and 8142 +# Very rarely used + +# host_xhgui_port: "8142" +# Can be used to change the host binding port of the XHGui +# application. Rarely used; only when port conflict and +# bind_all_ports is used (normally with router disabled) + +# xhprof_mode: [prepend|xhgui|global] +# Set to "xhgui" to enable XHGui features +# "xhgui" will become default in a future major release + +# webserver_type: nginx-fpm, apache-fpm, generic + +# timezone: Europe/Berlin +# If timezone is unset, DDEV will attempt to derive it from the host system timezone +# using the $TZ environment variable or the /etc/localtime symlink. +# This is the timezone used in the containers and by PHP; +# it can be set to any valid timezone, +# see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones +# For example Europe/Dublin or MST7MDT + +# composer_root: +# Relative path to the Composer root directory from the project root. This is +# the directory which contains the composer.json and where all Composer related +# commands are executed. + +# composer_version: "2" +# You can set it to "" or "2" (default) for Composer v2 or "1" for Composer v1 +# to use the latest major version available at the time your container is built. +# It is also possible to use each other Composer version channel. This includes: +# - 2.2 (latest Composer LTS version) +# - stable +# - preview +# - snapshot +# Alternatively, an explicit Composer version may be specified, for example "2.2.18". +# To reinstall Composer after the image was built, run "ddev debug rebuild". + +# nodejs_version: "22" +# change from the default system Node.js version to any other version. +# See https://docs.ddev.com/en/stable/users/configuration/config/#nodejs_version for more information +# and https://www.npmjs.com/package/n#specifying-nodejs-versions for the full documentation, +# Note that using of 'ddev nvm' is discouraged because "nodejs_version" is much easier to use, +# can specify any version, and is more robust than using 'nvm'. + +# corepack_enable: false +# Change to 'true' to 'corepack enable' and gain access to latest versions of yarn/pnpm + +# additional_hostnames: +# - somename +# - someothername +# would provide http and https URLs for "somename.ddev.site" +# and "someothername.ddev.site". + +# additional_fqdns: +# - example.com +# - sub1.example.com +# would provide http and https URLs for "example.com" and "sub1.example.com" +# Please take care with this because it can cause great confusion. + +# upload_dirs: "custom/upload/dir" +# +# upload_dirs: +# - custom/upload/dir +# - ../private +# +# would set the destination paths for ddev import-files to /custom/upload/dir +# When Mutagen is enabled this path is bind-mounted so that all the files +# in the upload_dirs don't have to be synced into Mutagen. + +# disable_upload_dirs_warning: false +# If true, turns off the normal warning that says +# "You have Mutagen enabled and your 'php' project type doesn't have upload_dirs set" + +# ddev_version_constraint: "" +# Example: +# ddev_version_constraint: ">= 1.24.8" +# This will enforce that the running ddev version is within this constraint. +# See https://github.com/Masterminds/semver#checking-version-constraints for +# supported constraint formats + +# working_dir: +# web: /var/www/html +# db: /home +# would set the default working directory for the web and db services. +# These values specify the destination directory for ddev ssh and the +# directory in which commands passed into ddev exec are run. + +# omit_containers: [db, ddev-ssh-agent] +# Currently only these containers are supported. Some containers can also be +# omitted globally in the ~/.ddev/global_config.yaml. Note that if you omit +# the "db" container, several standard features of DDEV that access the +# database container will be unusable. In the global configuration it is also +# possible to omit ddev-router, but not here. + +# performance_mode: "global" +# DDEV offers performance optimization strategies to improve the filesystem +# performance depending on your host system. Should be configured globally. +# +# If set, will override the global config. Possible values are: +# - "global": uses the value from the global config. +# - "none": disables performance optimization for this project. +# - "mutagen": enables Mutagen for this project. +# - "nfs": enables NFS for this project. +# +# See https://docs.ddev.com/en/stable/users/install/performance/#nfs +# See https://docs.ddev.com/en/stable/users/install/performance/#mutagen + +# fail_on_hook_fail: False +# Decide whether 'ddev start' should be interrupted by a failing hook + +# host_https_port: "59002" +# The host port binding for https can be explicitly specified. It is +# dynamic unless otherwise specified. +# This is not used by most people, most people use the *router* instead +# of the localhost port. + +# host_webserver_port: "59001" +# The host port binding for the ddev-webserver can be explicitly specified. It is +# dynamic unless otherwise specified. +# This is not used by most people, most people use the *router* instead +# of the localhost port. + +# host_db_port: "59002" +# The host port binding for the ddev-dbserver can be explicitly specified. It is dynamic +# unless explicitly specified. + +# mailpit_http_port: "8025" +# mailpit_https_port: "8026" +# The Mailpit ports can be changed from the default 8025 and 8026 + +# host_mailpit_port: "8025" +# The mailpit port is not normally bound on the host at all, instead being routed +# through ddev-router, but it can be bound directly to localhost if specified here. + +# webimage_extra_packages: [php7.4-tidy, php-bcmath] +# Extra Debian packages that are needed in the webimage can be added here + +# dbimage_extra_packages: [telnet,netcat] +# Extra Debian packages that are needed in the dbimage can be added here + +# use_dns_when_possible: true +# If the host has internet access and the domain configured can +# successfully be looked up, DNS will be used for hostname resolution +# instead of editing /etc/hosts +# Defaults to true + +# project_tld: ddev.site +# The top-level domain used for project URLs +# The default "ddev.site" allows DNS lookup via a wildcard +# If you prefer you can change this to "ddev.local" to preserve +# pre-v1.9 behavior. + +# ngrok_args: --basic-auth username:pass1234 +# Provide extra flags to the "ngrok http" command, see +# https://ngrok.com/docs/agent/config/v3/#agent-configuration or run "ngrok http -h" + +# disable_settings_management: false +# If true, DDEV will not create CMS-specific settings files like +# Drupal's settings.php/settings.ddev.php or TYPO3's additional.php +# In this case the user must provide all such settings. + +# You can inject environment variables into the web container with: +# web_environment: +# - SOMEENV=somevalue +# - SOMEOTHERENV=someothervalue + +# no_project_mount: false +# (Experimental) If true, DDEV will not mount the project into the web container; +# the user is responsible for mounting it manually or via a script. +# This is to enable experimentation with alternate file mounting strategies. +# For advanced users only! + +# bind_all_interfaces: false +# If true, host ports will be bound on all network interfaces, +# not the localhost interface only. This means that ports +# will be available on the local network if the host firewall +# allows it. + +# default_container_timeout: 120 +# The default time that DDEV waits for all containers to become ready can be increased from +# the default 120. This helps in importing huge databases, for example. + +#web_extra_exposed_ports: +#- name: nodejs +# container_port: 3000 +# http_port: 2999 +# https_port: 3000 +#- name: something +# container_port: 4000 +# https_port: 4000 +# http_port: 3999 +# Allows a set of extra ports to be exposed via ddev-router +# Fill in all three fields even if you don’t intend to use the https_port! +# If you don’t add https_port, then it defaults to 0 and ddev-router will fail to start. +# +# The port behavior on the ddev-webserver must be arranged separately, for example +# using web_extra_daemons. +# For example, with a web app on port 3000 inside the container, this config would +# expose that web app on https://.ddev.site:9999 and http://.ddev.site:9998 +# web_extra_exposed_ports: +# - name: myapp +# container_port: 3000 +# http_port: 9998 +# https_port: 9999 + +#web_extra_daemons: +#- name: "http-1" +# command: "/var/www/html/node_modules/.bin/http-server -p 3000" +# directory: /var/www/html +#- name: "http-2" +# command: "/var/www/html/node_modules/.bin/http-server /var/www/html/sub -p 3000" +# directory: /var/www/html + +# override_config: false +# By default, config.*.yaml files are *merged* into the configuration +# But this means that some things can't be overridden +# For example, if you have 'use_dns_when_possible: true'' you can't override it with a merge +# and you can't erase existing hooks or all environment variables. +# However, with "override_config: true" in a particular config.*.yaml file, +# 'use_dns_when_possible: false' can override the existing values, and +# hooks: +# post-start: [] +# or +# web_environment: [] +# or +# additional_hostnames: [] +# can have their intended affect. 'override_config' affects only behavior of the +# config.*.yaml file it exists in. + +# Many DDEV commands can be extended to run tasks before or after the +# DDEV command is executed, for example "post-start", "post-import-db", +# "pre-composer", "post-composer" +# See https://docs.ddev.com/en/stable/users/extend/custom-commands/ for more +# information on the commands that can be extended and the tasks you can define +# for them. Example: +#hooks: +# post-import-db: +# - exec: drush sql:sanitize +# - exec: drush updatedb +# - exec: drush cache:rebuild diff --git a/.ddev/docker-compose.mounts.yml b/.ddev/docker-compose.mounts.yml new file mode 100644 index 0000000000..1956e0998b --- /dev/null +++ b/.ddev/docker-compose.mounts.yml @@ -0,0 +1,29 @@ +# .ddev/docker-compose.mounts.yaml +############################################################################### +## Normally ddev would have you make symlinks from the homeadditions folder +## to your home directory files, but for sensitive files like these, it's +## better to mount them directly from the host system so they are not stored +## in the project at all. Also, the files get copied into the container when +## using homeadditions, which means you must restart to update a token. By +## mounting, the files are always current. +## +## We do need a pre-start hook to ensure that the files exist on the host +## system before ddev starts, or ddev will create empty directories at those +## mount points. DDev reads this file and generates volume mounts accordingly. +############################################################################### +services: + web: + volumes: + ## Npmrc for package installation. + ## https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token + ## You should only need read:packages if you are not someone + ## that works with it frequently enough to know what this + ## iss. (For read-only don't follow the npm login steps) + - ~/.npmrc:/home/${DDEV_USER}/.npmrc + ## Composer authentication for NCIOCPL package overrides. + ## This only needs a no-scope token. (Classic token with nothing + ## checked.) (The token needs to authorized for NCIOCPL SSO) + ## Authenticate using: + ## `composer config --global github-oauth.github.com ` + - ~/.composer/auth.json:/home/${DDEV_USER}/.composer/auth.json + \ No newline at end of file diff --git a/.ddev/docker-compose.selenium-chrome.yaml b/.ddev/docker-compose.selenium-chrome.yaml new file mode 100644 index 0000000000..9da12f4221 --- /dev/null +++ b/.ddev/docker-compose.selenium-chrome.yaml @@ -0,0 +1,37 @@ +#ddev-generated +# Remove the line above if you don't want this file to be overwritten when you run +# ddev get ddev/ddev-selenium-standalone-chrome +# +# This file comes from https://github.com/ddev/ddev-selenium-standalone-chrome +# +services: + selenium-chrome: + image: selenium/standalone-chromium:138.0 + container_name: ddev-${DDEV_SITENAME}-selenium-chrome + expose: + # The internal noVNC port, which operates over HTTP so it can be exposed + # through the router. + - 7900 + environment: + - VIRTUAL_HOST=$DDEV_HOSTNAME + - HTTPS_EXPOSE=7900:7900 + - HTTP_EXPOSE=7910:7900 + - VNC_NO_PASSWORD=1 + # Enables multiple parallel connections to the Selenium. + - SE_NODE_MAX_SESSIONS=12 + - SE_NODE_OVERRIDE_MAX_SESSIONS=true + # To enable VNC access for traditional VNC clients like macOS "Screen Sharing", + # uncomment the following two lines. + #ports: + # - "5900:5900" + labels: + com.ddev.site-name: ${DDEV_SITENAME} + com.ddev.approot: $DDEV_APPROOT + volumes: + # To enable file uploads in E2E tests. + - ${DDEV_APPROOT}:/var/www/html:r + - ".:/mnt/ddev_config" + + web: + links: + - selenium-chrome diff --git a/.ddev/docker-compose.selenium-chrome_extras.yaml b/.ddev/docker-compose.selenium-chrome_extras.yaml new file mode 100644 index 0000000000..4b8e2336f6 --- /dev/null +++ b/.ddev/docker-compose.selenium-chrome_extras.yaml @@ -0,0 +1,5 @@ +#ddev-generated +services: + selenium-chrome: + external_links: + - "ddev-router:${DDEV_PROJECT}.${DDEV_TLD}" diff --git a/.ddev/web-build/pre.Dockerfile.certificates b/.ddev/web-build/pre.Dockerfile.certificates new file mode 100644 index 0000000000..001e38b01c --- /dev/null +++ b/.ddev/web-build/pre.Dockerfile.certificates @@ -0,0 +1,8 @@ +# Get the NIH Root certificates and install them so we work on VPN +# Download from https://ocio.nih.gov/Smartcard/Pages/PKI_chain.aspx + +## These are throwing 404s. +RUN mkdir /usr/local/share/ca-certificates/nih \ + && curl -o /usr/local/share/ca-certificates/nih/NIH-DPKI-ROOT-1A-base64.crt http://nihdpkicrl.nih.gov/CertData/NIH-DPKI-CA-1A.crt \ + && curl -o /usr/local/share/ca-certificates/nih/NIH-DPKI-CA-1A-base64.crt http://nihdpkicrl.nih.gov/CertData/NIHDPKIRCA_NIH-DPKI-ROOT-1A.crt \ + && update-ca-certificates diff --git a/docroot/modules/custom/cgov_js_app_module/tests/src/Functional/JSOnlyAppModulePluginBuildTest.php b/docroot/modules/custom/cgov_js_app_module/tests/src/Functional/JSOnlyAppModulePluginBuildTest.php index 33f800f59f..aba059b569 100644 --- a/docroot/modules/custom/cgov_js_app_module/tests/src/Functional/JSOnlyAppModulePluginBuildTest.php +++ b/docroot/modules/custom/cgov_js_app_module/tests/src/Functional/JSOnlyAppModulePluginBuildTest.php @@ -70,6 +70,17 @@ class JSOnlyAppModulePluginBuildTest extends BrowserTestBase { */ protected $defaultTheme = 'stable9'; + /** + * Known SIMPLETEST_BASE_URL strings. + * + * The baseHost can change depending on the SIMPLETEST_BASE_URL, + * and this impacts the base url of the config. So we can replace + * known hosts with a common value for testing. + * + * @var array + */ + private static $replaceableHosts = ['http://127.0.0.1', 'http://web']; + /** * These are a set of default options for the plugin methods. * @@ -365,9 +376,17 @@ private function internalTestApage( $script_config_el = $assert->elementExists('css', 'script#' . $rootId . '-js-config'); $actual_script_config = $script_config_el->getText(); $full_expected_config = "(function() { window." . str_replace("-", "_", $rootId) . "_js_config = { " . $expected_config . "}; })();"; - // So in pipelines the test URL will not be simpletest, so we need to - // replace it. - $this->assertEquals($full_expected_config, str_replace("http://127.0.0.1", "http://simpletest", $actual_script_config)); + + // The baseHost can change depending on the SIMPLETEST_BASE_URL, + // and this impacts the base url of the config. So we can replace + // known hosts with a common value for testing. + $this->assertEquals( + $full_expected_config, + str_replace( + self::$replaceableHosts, + 'http://simpletest', + $actual_script_config) + ); // Test that the app root exists. $assert->elementExists('css', 'div#' . $rootId); diff --git a/docroot/sites/default/settings.ddev.php b/docroot/sites/default/settings.ddev.php new file mode 100644 index 0000000000..c4b83e04af --- /dev/null +++ b/docroot/sites/default/settings.ddev.php @@ -0,0 +1,50 @@ + - array( - 'default' => - array( - 'database' => $db_name, - 'username' => '${drupal.db.username}', - 'password' => '${drupal.db.password}', - 'host' => '${drupal.db.host}', - 'port' => '${drupal.db.port}', - 'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', - 'driver' => 'mysql', - 'prefix' => '', - ), - ), -); -$dir = dirname(DRUPAL_ROOT); +use Acquia\Drupal\RecommendedSettings\Helpers\EnvironmentDetector; // Use development service parameters. -$settings['container_yamls'][] = $dir . '/docroot/sites/development.services.yml'; -$settings['container_yamls'][] = $dir . '/docroot/sites/blt.development.services.yml'; +$settings['container_yamls'][] = EnvironmentDetector::getRepoRoot() . '/docroot/sites/development.services.yml'; // Allow access to update.php. $settings['update_free_access'] = TRUE; @@ -57,8 +37,24 @@ * * @see https://wiki.php.net/rfc/expectations */ -assert_options(ASSERT_ACTIVE, TRUE); -Handle::register(); +/* + * If you are using php 8.3 and above assertions options + * usage is deprecated. + * @see https://www.drupal.org/node/3391611 + * + * If you are using php 8.3 and less + * Drupal\Component\Assertion\Handle is deprecated. + * @see https://www.drupal.org/node/3105918 + */ +if (phpversion() >= 8.3) { + @ini_set('zend.assertions', 1); +} +else { + // phpcs:disable + assert_options(ASSERT_ACTIVE, TRUE); + assert_options(ASSERT_EXCEPTION, TRUE); + // phpcs:enable +} /** * Show all error messages, with backtrace information. @@ -74,9 +70,6 @@ $config['system.performance']['css']['preprocess'] = FALSE; $config['system.performance']['js']['preprocess'] = FALSE; -# Disable HTTP Caching. -$config['system.performance']['cache']['page']['max_age'] = 0; - /** * Disable the render cache (this includes the page cache). * @@ -111,18 +104,17 @@ /** * Configure static caches. * - * Note: you should test with the config, bootstrap, and discovery caches enabled to - * test that metadata is cached as expected. However, in the early stages of development, - * you may want to disable them. Overrides to these bins must be explicitly set for each - * bin to change the default configuration provided by Drupal core in core.services.yml. + * Note: you should test with the config, bootstrap, and discovery caches + * enabled to test that metadata is cached as expected. However, in the early + * stages of development, you may want to disable them. Overrides to these bins + * must be explicitly set for each bin to change the default configuration + * provided by Drupal core in core.services.yml. * See https://www.drupal.org/node/2754947 */ - // $settings['cache']['bins']['bootstrap'] = 'cache.backend.null'; - // $settings['cache']['bins']['discovery'] = 'cache.backend.null'; - // $settings['cache']['bins']['config'] = 'cache.backend.null'; - - +// $settings['cache']['bins']['bootstrap'] = 'cache.backend.null'; +// $settings['cache']['bins']['discovery'] = 'cache.backend.null'; +// $settings['cache']['bins']['config'] = 'cache.backend.null'; /** * Enable access to rebuild.php. * @@ -146,32 +138,14 @@ $settings['skip_permissions_hardening'] = TRUE; /** - * Temporary file path: - * - * A local file system path where temporary files will be stored. This - * directory should not be accessible over the web. - * - * Note: Caches need to be cleared when this value is changed. - * - * See https://www.drupal.org/node/1928898 for more information - * about global configuration override. + * Files paths. */ -$config['system.file']['path']['temporary'] = '/tmp'; - -/** - * Private file path. - */ -$settings['file_private_path'] = $dir . '/files-private'; -if (isset($_acsf_site_name)) { - $settings['file_public_path'] = "sites/default/files/$_acsf_site_name"; - $settings['file_private_path'] = "$repo_root/files-private/$_acsf_site_name"; -} - +$settings['file_private_path'] = EnvironmentDetector::getRepoRoot() . '/files-private/' . EnvironmentDetector::getSiteName($site_path); /** - * Trusted host configuration. + * Site path. * - * See full description in default.settings.php. + * @var string $site_path + * This is always set and exposed by the Drupal Kernel. */ -$settings['trusted_host_patterns'] = array( - '^.+$', -); +// phpcs:ignore +$settings['file_public_path'] = 'sites/' . EnvironmentDetector::getSiteName($site_path) . '/files'; diff --git a/docroot/sites/settings/global.settings.php b/docroot/sites/settings/global.settings.php index afc1686a6e..3ecad23785 100644 --- a/docroot/sites/settings/global.settings.php +++ b/docroot/sites/settings/global.settings.php @@ -36,3 +36,16 @@ function($file) use ($excludeFiles) { return !in_array($file, $excludeFiles); }) require $settings_file; } } + +/* + * DDev wants to add the following to settings.php. We would like to leave that + * untouched, so we will add after all the other general config options. We do + * need to leave the settings.ddev.php in the folder with settings.php though, + * since ddev can make changes there. + */ +if (getenv('IS_DDEV_PROJECT') == 'true') { + $ddev_settings = __DIR__ . '/../default' . '/settings.ddev.php'; + if (is_readable($ddev_settings)) { + require $ddev_settings; + } +} diff --git a/phpunit.xml b/phpunit.xml index c75582d2a2..48e64e02cc 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -11,7 +11,7 @@ beStrictAboutOutputDuringTests="true" beStrictAboutChangesToGlobalState="true" failOnWarning="true" - printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter" + printerClass="\PHPUnit\TextUI\DefaultResultPrinter" cacheResult="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">