From a963d3a3a83adbe8f815345edec1b838b4c59480 Mon Sep 17 00:00:00 2001 From: Randy Fay Date: Thu, 31 Oct 2024 11:16:00 -0600 Subject: [PATCH] Fix broken CRLF line endings --- README.md | 180 +++++++++++++-------------- config.ddev-drupal-core-dev.yaml | 20 +-- core-dev/phpunit-chrome.xml | 204 +++++++++++++++---------------- core-dev/phpunit-firefox.xml | 204 +++++++++++++++---------------- install.yaml | 72 +++++------ tests/test.bats | 130 ++++++++++---------- 6 files changed, 405 insertions(+), 405 deletions(-) diff --git a/README.md b/README.md index bfbded9..f3737cf 100644 --- a/README.md +++ b/README.md @@ -1,90 +1,90 @@ -# ddev-core-dev - -This is a DDEV addon for doing Drupal core development. - -We're in #ddev-for-core-dev on [Drupal Slack](https://www.drupal.org/community/contributor-guide/reference-information/talk/tools/slack) (but please try and keep work and feature requests in Issues where it's visible to all 🙏) - -`ddev drush` is fully supported, along with using or testing MariaDB, MySQL, and PostgreSQL databases (and Sqlite3) - - -``` -git clone https://git.drupalcode.org/project/drupal.git drupal -cd drupal -ddev config --project-type=drupal -ddev get justafish/ddev-drupal-core-dev -ddev restart -ddev composer install -ddev config --update - - -# Install drupal -ddev drush si -y --account-pass==admin - -# Run PHPUnit tests -ddev phpunit core/modules/sdc - -# Run Nightwatch tests (currently only runs on Chrome) -ddev nightwatch --tag core -``` - -## Using various database types - -By default, the DDEV default database type is used (MariaDB). - -To use another supported database type, -`ddev delete -Oy` and `ddev config --database=mysql:8.0` or `ddev config --database=postgres:16` for example. - -To use Sqlite, -``` -ddev stop -ddev config --disable-settings-management --omit-containers=db -rm -rf web/sites/default/settings*.php web/sites/default/files -ddev start -ddev drupal install -``` - -## Nightwatch Examples - -You can watch Nightwatch running in real time at https://drupal.ddev.site:7900 -for Chrome and https://drupal.ddev.site:7901 for Firefox. The password is -"secret". YMMV using Firefox as core tests don't currently run on it. - -Only core tests -``` -ddev nightwatch --tag core -``` - -Skip running core tests -``` -ddev nightwatch --skiptags core -``` - -Run a single test -``` -ddev nightwatch tests/Drupal/Nightwatch/Tests/exampleTest.js -``` - -a11y tests for both the admin and default themes -``` -ddev nightwatch --tag a11y -``` - -a11y tests for the admin theme only -``` -ddev nightwatch --tag a11y:admin -``` - -a11y tests for the default theme only -``` -ddev nightwatch --tag a11y:default -``` - -a11y test for a custom theme used as the default theme -``` -ddev nightwatch --tag a11y:default --defaultTheme bartik -``` - -a11y test for a custom admin theme -``` -ddev nightwatch --tag a11y:admin --adminTheme seven -``` +# ddev-core-dev + +This is a DDEV addon for doing Drupal core development. + +We're in #ddev-for-core-dev on [Drupal Slack](https://www.drupal.org/community/contributor-guide/reference-information/talk/tools/slack) (but please try and keep work and feature requests in Issues where it's visible to all 🙏) + +`ddev drush` is fully supported, along with using or testing MariaDB, MySQL, and PostgreSQL databases (and Sqlite3) + + +``` +git clone https://git.drupalcode.org/project/drupal.git drupal +cd drupal +ddev config --project-type=drupal +ddev get justafish/ddev-drupal-core-dev +ddev restart +ddev composer install +ddev config --update + + +# Install drupal +ddev drush si -y --account-pass==admin + +# Run PHPUnit tests +ddev phpunit core/modules/sdc + +# Run Nightwatch tests (currently only runs on Chrome) +ddev nightwatch --tag core +``` + +## Using various database types + +By default, the DDEV default database type is used (MariaDB). + +To use another supported database type, +`ddev delete -Oy` and `ddev config --database=mysql:8.0` or `ddev config --database=postgres:16` for example. + +To use Sqlite, +``` +ddev stop +ddev config --disable-settings-management --omit-containers=db +rm -rf web/sites/default/settings*.php web/sites/default/files +ddev start +ddev drupal install +``` + +## Nightwatch Examples + +You can watch Nightwatch running in real time at https://drupal.ddev.site:7900 +for Chrome and https://drupal.ddev.site:7901 for Firefox. The password is +"secret". YMMV using Firefox as core tests don't currently run on it. + +Only core tests +``` +ddev nightwatch --tag core +``` + +Skip running core tests +``` +ddev nightwatch --skiptags core +``` + +Run a single test +``` +ddev nightwatch tests/Drupal/Nightwatch/Tests/exampleTest.js +``` + +a11y tests for both the admin and default themes +``` +ddev nightwatch --tag a11y +``` + +a11y tests for the admin theme only +``` +ddev nightwatch --tag a11y:admin +``` + +a11y tests for the default theme only +``` +ddev nightwatch --tag a11y:default +``` + +a11y test for a custom theme used as the default theme +``` +ddev nightwatch --tag a11y:default --defaultTheme bartik +``` + +a11y test for a custom admin theme +``` +ddev nightwatch --tag a11y:admin --adminTheme seven +``` diff --git a/config.ddev-drupal-core-dev.yaml b/config.ddev-drupal-core-dev.yaml index d6bcda1..6c12f31 100644 --- a/config.ddev-drupal-core-dev.yaml +++ b/config.ddev-drupal-core-dev.yaml @@ -1,10 +1,10 @@ -# #ddev-generated -# This file is placed by the justafish/ddev-drupal-core-dev addon. - -webimage_extra_packages: ["chromium-driver"] -ddev_version_constraint: '>=v1.23.1' -upload_dirs: -# The install technique tries to remove all of sites/default/files -# but with DDEV + mutagen that isn't possible. -# so just redirect the upload_dirs. - - .ddev/tmp +# #ddev-generated +# This file is placed by the justafish/ddev-drupal-core-dev addon. + +webimage_extra_packages: ["chromium-driver"] +ddev_version_constraint: '>=v1.23.1' +upload_dirs: +# The install technique tries to remove all of sites/default/files +# but with DDEV + mutagen that isn't possible. +# so just redirect the upload_dirs. + - .ddev/tmp diff --git a/core-dev/phpunit-chrome.xml b/core-dev/phpunit-chrome.xml index 8e5e47c..b4f1a5a 100644 --- a/core-dev/phpunit-chrome.xml +++ b/core-dev/phpunit-chrome.xml @@ -1,102 +1,102 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ./tests/TestSuites/UnitTestSuite.php - - - ./tests/TestSuites/KernelTestSuite.php - - - ./tests/TestSuites/FunctionalTestSuite.php - - - ./tests/TestSuites/FunctionalJavascriptTestSuite.php - - - ./tests/TestSuites/BuildTestSuite.php - - - - - - - - - - ./includes - ./lib - ./modules - ../modules - ../sites - - - ./modules/*/src/Tests - ./modules/*/tests - ../modules/*/src/Tests - ../modules/*/tests - ../modules/*/*/src/Tests - ../modules/*/*/tests - ./lib/** - ./modules/** - ../modules/** - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ./tests/TestSuites/UnitTestSuite.php + + + ./tests/TestSuites/KernelTestSuite.php + + + ./tests/TestSuites/FunctionalTestSuite.php + + + ./tests/TestSuites/FunctionalJavascriptTestSuite.php + + + ./tests/TestSuites/BuildTestSuite.php + + + + + + + + + + ./includes + ./lib + ./modules + ../modules + ../sites + + + ./modules/*/src/Tests + ./modules/*/tests + ../modules/*/src/Tests + ../modules/*/tests + ../modules/*/*/src/Tests + ../modules/*/*/tests + ./lib/** + ./modules/** + ../modules/** + + + diff --git a/core-dev/phpunit-firefox.xml b/core-dev/phpunit-firefox.xml index 109c9f7..23fd617 100644 --- a/core-dev/phpunit-firefox.xml +++ b/core-dev/phpunit-firefox.xml @@ -1,102 +1,102 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ./tests/TestSuites/UnitTestSuite.php - - - ./tests/TestSuites/KernelTestSuite.php - - - ./tests/TestSuites/FunctionalTestSuite.php - - - ./tests/TestSuites/FunctionalJavascriptTestSuite.php - - - ./tests/TestSuites/BuildTestSuite.php - - - - - - - - - - ./includes - ./lib - ./modules - ../modules - ../sites - - - ./modules/*/src/Tests - ./modules/*/tests - ../modules/*/src/Tests - ../modules/*/tests - ../modules/*/*/src/Tests - ../modules/*/*/tests - ./lib/** - ./modules/** - ../modules/** - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ./tests/TestSuites/UnitTestSuite.php + + + ./tests/TestSuites/KernelTestSuite.php + + + ./tests/TestSuites/FunctionalTestSuite.php + + + ./tests/TestSuites/FunctionalJavascriptTestSuite.php + + + ./tests/TestSuites/BuildTestSuite.php + + + + + + + + + + ./includes + ./lib + ./modules + ../modules + ../sites + + + ./modules/*/src/Tests + ./modules/*/tests + ../modules/*/src/Tests + ../modules/*/tests + ../modules/*/*/src/Tests + ../modules/*/*/tests + ./lib/** + ./modules/** + ../modules/** + + + diff --git a/install.yaml b/install.yaml index b050f7a..2b9f2aa 100644 --- a/install.yaml +++ b/install.yaml @@ -1,36 +1,36 @@ -# Details about the install.yaml file are at https://ddev.readthedocs.io/en/latest/users/extend/additional-services/#sections-and-features-of-ddev-get-add-on-installyaml - -name: ddev-drupal-core-dev - -project_files: - - config.core-dev.yaml - - docker-compose.core-dev-selenium.yaml - - core-dev/phpunit-firefox.xml - - core-dev/phpunit-chrome.xml - - commands/web/drupal - - commands/web/drush - - commands/web/phpunit - - commands/web/nightwatch - - core-dev/install_drush.sh - - core-dev/gitignore - - core-dev/.env - - core-dev/src/Command/AdminLoginCommand.php - - core-dev/src/Command/BootCommand.php - - core-dev/src/Command/CacheCommand.php - - core-dev/src/Command/TestCommand.php - - core-dev/src/Command/TestBrowserCommand.php - - core-dev/src/Command/UninstallCommand.php - -post_install_actions: - - cp core-dev/gitignore ../.gitignore - - mkdir -p ../test_output - - chmod +w ../test_output - -removal_actions: - - | - for item in ../core/phpunit.xml ../core/.env ../.gitignore; do - if grep '#ddev-generated' ${item} >/dev/null; then - rm -f ${item} - fi - done - - rm -rf ../test_output +# Details about the install.yaml file are at https://ddev.readthedocs.io/en/latest/users/extend/additional-services/#sections-and-features-of-ddev-get-add-on-installyaml + +name: ddev-drupal-core-dev + +project_files: + - config.core-dev.yaml + - docker-compose.core-dev-selenium.yaml + - core-dev/phpunit-firefox.xml + - core-dev/phpunit-chrome.xml + - commands/web/drupal + - commands/web/drush + - commands/web/phpunit + - commands/web/nightwatch + - core-dev/install_drush.sh + - core-dev/gitignore + - core-dev/.env + - core-dev/src/Command/AdminLoginCommand.php + - core-dev/src/Command/BootCommand.php + - core-dev/src/Command/CacheCommand.php + - core-dev/src/Command/TestCommand.php + - core-dev/src/Command/TestBrowserCommand.php + - core-dev/src/Command/UninstallCommand.php + +post_install_actions: + - cp core-dev/gitignore ../.gitignore + - mkdir -p ../test_output + - chmod +w ../test_output + +removal_actions: + - | + for item in ../core/phpunit.xml ../core/.env ../.gitignore; do + if grep '#ddev-generated' ${item} >/dev/null; then + rm -f ${item} + fi + done + - rm -rf ../test_output diff --git a/tests/test.bats b/tests/test.bats index 3f54ef5..11e4241 100644 --- a/tests/test.bats +++ b/tests/test.bats @@ -1,65 +1,65 @@ -setup() { - set -eu -o pipefail - export DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.." - export TESTDIR=~/tmp/test-ddev-drupal-core-dev - rm -rf ${TESTDIR} - mkdir -p ${TESTDIR} - export PROJNAME=test-ddev-drupal-core-dev - export DDEV_NON_INTERACTIVE=true - ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 || true - curl -L -o /tmp/drupal.tar.gz https://ftp.drupal.org/files/projects/drupal-11.x-dev.tar.gz - tar --strip-components 1 -zxf /tmp/drupal.tar.gz -C ${TESTDIR} - cd "${TESTDIR}" - mv vendor /tmp/vendor.bak - git config --global user.email "example@example.com" - git config --global user.name "Example Example" - git init && git add . >/dev/null && git commit -m "current" >/dev/null - mv /tmp/vendor.bak vendor - ddev config --project-name=${PROJNAME} --upload-dirs=.ddev/tmp - ddev config --update - ddev start -y >/dev/null - ddev composer install >/dev/null -} - -base_checks() { - ddev exec "curl -s chrome:7900" | grep "noVNC" >/dev/null - ddev exec "curl -s firefox:7901" | grep "noVNC" >/dev/null - ddev phpunit core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php -} - -drush_checks() { - # Make sure there's nothing in the git index before drush install - git diff --cached --quiet - ddev drush st - # Make sure there's nothing after the drush install - git diff --cached --quiet || (echo "git index has been touched" && exit 2) - ddev drush si -y --account-pass=admin -} - -teardown() { - set -eu -o pipefail - cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 ) - ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 - [ "${TESTDIR}" != "" ] && rm -rf ${TESTDIR} -} - -@test "install from directory" { - set -eu -o pipefail - cd ${TESTDIR} - echo "# ddev get ${DIR} with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 - ddev get ${DIR} - ddev restart - base_checks - drush_checks -} - -#TODO: Re-enable release tests after the add-on has a release with DDEV v1.23.0 support -#@test "install from release" { -# set -eu -o pipefail -# cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 ) -# echo "# ddev get ddev/ddev-addon-template with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 -# ddev get justafish/ddev-drupal-core-dev -# ddev restart >/dev/null -# health_checks -#} - +setup() { + set -eu -o pipefail + export DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.." + export TESTDIR=~/tmp/test-ddev-drupal-core-dev + rm -rf ${TESTDIR} + mkdir -p ${TESTDIR} + export PROJNAME=test-ddev-drupal-core-dev + export DDEV_NON_INTERACTIVE=true + ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 || true + curl -L -o /tmp/drupal.tar.gz https://ftp.drupal.org/files/projects/drupal-11.x-dev.tar.gz + tar --strip-components 1 -zxf /tmp/drupal.tar.gz -C ${TESTDIR} + cd "${TESTDIR}" + mv vendor /tmp/vendor.bak + git config --global user.email "example@example.com" + git config --global user.name "Example Example" + git init && git add . >/dev/null && git commit -m "current" >/dev/null + mv /tmp/vendor.bak vendor + ddev config --project-name=${PROJNAME} --upload-dirs=.ddev/tmp + ddev config --update + ddev start -y >/dev/null + ddev composer install >/dev/null +} + +base_checks() { + ddev exec "curl -s chrome:7900" | grep "noVNC" >/dev/null + ddev exec "curl -s firefox:7901" | grep "noVNC" >/dev/null + ddev phpunit core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php +} + +drush_checks() { + # Make sure there's nothing in the git index before drush install + git diff --cached --quiet + ddev drush st + # Make sure there's nothing after the drush install + git diff --cached --quiet || (echo "git index has been touched" && exit 2) + ddev drush si -y --account-pass=admin +} + +teardown() { + set -eu -o pipefail + cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 ) + ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 + [ "${TESTDIR}" != "" ] && rm -rf ${TESTDIR} +} + +@test "install from directory" { + set -eu -o pipefail + cd ${TESTDIR} + echo "# ddev get ${DIR} with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 + ddev get ${DIR} + ddev restart + base_checks + drush_checks +} + +#TODO: Re-enable release tests after the add-on has a release with DDEV v1.23.0 support +#@test "install from release" { +# set -eu -o pipefail +# cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 ) +# echo "# ddev get ddev/ddev-addon-template with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 +# ddev get justafish/ddev-drupal-core-dev +# ddev restart >/dev/null +# health_checks +#} +