From 067d5c6c072ebeceed9cbf3f591961ee40eab8b9 Mon Sep 17 00:00:00 2001
From: Fran Garcia-Linares <fjgarlin@gmail.com>
Date: Mon, 23 Sep 2024 14:59:42 +0200
Subject: [PATCH] Revert "Issue #3475974 by mondrake, fjgarlin:
 BROWSERTEST_OUTPUT_VERBOSE is not passed to run-tests.sh when running tests
 with it"

This reverts commit 0a5516ba09f3b1da44843e2bf9d64143c37c1d73.
---
 assets/internal/.project-words.txt | 1 -
 includes/include.drupalci.main.yml | 9 ++++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/assets/internal/.project-words.txt b/assets/internal/.project-words.txt
index 27beaef8..b6978e6c 100644
--- a/assets/internal/.project-words.txt
+++ b/assets/internal/.project-words.txt
@@ -99,4 +99,3 @@ nextmajor
 Dwebdriver
 logfile
 XVFB
-usermod
diff --git a/includes/include.drupalci.main.yml b/includes/include.drupalci.main.yml
index 42987f7f..43b2310d 100644
--- a/includes/include.drupalci.main.yml
+++ b/includes/include.drupalci.main.yml
@@ -117,7 +117,6 @@
   - chmod -R 755 $CI_PROJECT_DIR/$_WEB_ROOT/sites/default/files/simpletest
   - ln -s $CI_PROJECT_DIR/$_WEB_ROOT /var/www/html
   - chown -R www-data:www-data $CI_PROJECT_DIR
-  - usermod -a -G root www-data
   - service apache2 start
 
 # If the module already supports Drupal 11, do nothing, otherwise, claim Drupal 11 support for testing purposes.
@@ -1003,17 +1002,17 @@ nightwatch (next major):
         if [ "$PHPUNIT_VERSION" == "9" ]; then
           PHPUNIT_OPTIONS="--printer=\Drupal\Tests\Listeners\HtmlOutputPrinter"
         fi
-        echo "executing: vendor/bin/phpunit $PHPUNIT_OPTIONS --bootstrap $PWD/$_WEB_ROOT/core/tests/bootstrap.php $PWD/$_WEB_ROOT/modules/custom/$CI_PROJECT_NAME --log-junit $CI_PROJECT_DIR/junit.xml $WHAT_TO_RUN $_PHPUNIT_EXTRA"
-        vendor/bin/phpunit $PHPUNIT_OPTIONS --bootstrap $PWD/$_WEB_ROOT/core/tests/bootstrap.php $PWD/$_WEB_ROOT/modules/custom/$CI_PROJECT_NAME --log-junit $CI_PROJECT_DIR/junit.xml $WHAT_TO_RUN $_PHPUNIT_EXTRA || EXIT_CODE=$?
+        echo "executing: sudo -u www-data -E vendor/bin/phpunit $PHPUNIT_OPTIONS --bootstrap $PWD/$_WEB_ROOT/core/tests/bootstrap.php $PWD/$_WEB_ROOT/modules/custom/$CI_PROJECT_NAME --log-junit $CI_PROJECT_DIR/junit.xml $WHAT_TO_RUN $_PHPUNIT_EXTRA"
+        sudo -u www-data -E vendor/bin/phpunit $PHPUNIT_OPTIONS --bootstrap $PWD/$_WEB_ROOT/core/tests/bootstrap.php $PWD/$_WEB_ROOT/modules/custom/$CI_PROJECT_NAME --log-junit $CI_PROJECT_DIR/junit.xml $WHAT_TO_RUN $_PHPUNIT_EXTRA || EXIT_CODE=$?
       elif [ "$_PHPUNIT_CONCURRENT" == "1" ]; then
         # if _PHPUNIT_TESTGROUPS is blank then do not add anything, because the test group will be handled by the matrix.
         # if _PHPUNIT_TESTGROUPS is --all then add --directory modules/custom/$CI_PROJECT_NAME
         # Otherwise add $_PHPUNIT_TESTGROUPS (without the --group)
         WHAT_TO_RUN=$([[ "$_PHPUNIT_TESTGROUPS" == "" ]] && echo "" || ([[ "$_PHPUNIT_TESTGROUPS" == "--all" ]] && echo "--directory modules/custom/$CI_PROJECT_NAME" || echo "$_PHPUNIT_TESTGROUPS"))
         echo "_PHPUNIT_CONCURRENT=$_PHPUNIT_CONCURRENT, _PHPUNIT_TESTGROUPS=$_PHPUNIT_TESTGROUPS, _PHPUNIT_EXTRA=$_PHPUNIT_EXTRA, WHAT_TO_RUN=$WHAT_TO_RUN"
-        echo "executing: php $_WEB_ROOT/core/scripts/run-tests.sh --color --keep-results --concurrency $_CONCURRENCY_THREADS --repeat '1' --sqlite 'sites/default/files/.sqlite' --dburl $SIMPLETEST_DB --url $SIMPLETEST_BASE_URL --xml $CI_PROJECT_DIR/$_WEB_ROOT/sites/default/files/simpletest --verbose --non-html $WHAT_TO_RUN $_PHPUNIT_EXTRA"
+        echo "executing: sudo SYMFONY_DEPRECATIONS_HELPER='$SYMFONY_DEPRECATIONS_HELPER' MINK_DRIVER_ARGS_WEBDRIVER='$MINK_DRIVER_ARGS_WEBDRIVER' -u www-data php $_WEB_ROOT/core/scripts/run-tests.sh --color --keep-results --concurrency $_CONCURRENCY_THREADS --repeat '1' --sqlite 'sites/default/files/.sqlite' --dburl $SIMPLETEST_DB --url $SIMPLETEST_BASE_URL --verbose --non-html $WHAT_TO_RUN $_PHPUNIT_EXTRA"
         vendor/bin/phpunit --version
-        php $_WEB_ROOT/core/scripts/run-tests.sh --color --keep-results --concurrency $_CONCURRENCY_THREADS --repeat "1" --sqlite "sites/default/files/.sqlite" --dburl $SIMPLETEST_DB --url $SIMPLETEST_BASE_URL --xml $CI_PROJECT_DIR/$_WEB_ROOT/sites/default/files/simpletest --verbose --non-html $WHAT_TO_RUN $_PHPUNIT_EXTRA || EXIT_CODE=$?
+        sudo SYMFONY_DEPRECATIONS_HELPER="$SYMFONY_DEPRECATIONS_HELPER" MINK_DRIVER_ARGS_WEBDRIVER="$MINK_DRIVER_ARGS_WEBDRIVER" -u www-data php $_WEB_ROOT/core/scripts/run-tests.sh --color --keep-results --concurrency $_CONCURRENCY_THREADS --repeat "1" --sqlite "sites/default/files/.sqlite" --dburl $SIMPLETEST_DB --url $SIMPLETEST_BASE_URL --xml $CI_PROJECT_DIR/$_WEB_ROOT/sites/default/files/simpletest --verbose --non-html $WHAT_TO_RUN $_PHPUNIT_EXTRA || EXIT_CODE=$?
       fi
     - cp /var/log/apache2/test.apache.access.log $CI_PROJECT_DIR/apache.access.log.txt
     - cp /var/log/apache2/test.apache.error.log $CI_PROJECT_DIR/apache.error.log.txt
-- 
GitLab