From fba0f7e55e945596d271d4b1bf1b2e42a06280fe Mon Sep 17 00:00:00 2001 From: Muhammad Shahrukh <> Date: Thu, 8 Aug 2024 13:46:54 +0500 Subject: [PATCH] COMCL-706: Update CivICRM test version to 5.75.0 --- .github/workflows/unit-test.yml | 24 +++++++++++++++++++++--- tests/phpunit/bootstrap.php | 5 ++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index b989b4fea..b1a16b736 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -28,14 +28,14 @@ jobs: run : amp config:set --mysql_dsn=mysql://root:root@mysql:3306 - name: Build Drupal site - run: civibuild create drupal-clean --civi-ver 5.51.3 --cms-ver 7.79 --web-root $GITHUB_WORKSPACE/site + run: civibuild create drupal-clean --civi-ver 5.75.0 --cms-ver 7.79 --web-root $GITHUB_WORKSPACE/site - uses: compucorp/apply-patch@1.0.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: repo: compucorp/civicrm-core - version: 5.51.3 + version: 5.75.0 path: site/web/sites/all/modules/civicrm - uses: actions/checkout@v2 @@ -46,9 +46,27 @@ jobs: working-directory: ${{ env.CIVICRM_EXTENSIONS_DIR }} run: | git clone --depth 1 https://github.com/civicrm/org.civicrm.shoreditch.git - git clone --depth 1 https://github.com/compucorp/uk.co.compucorp.usermenu.git + git clone --depth 1 -b 2.1.0-dev https://github.com/compucorp/uk.co.compucorp.usermenu.git cv en shoreditch usermenu civicase + - name: Setup Test DB + run: echo "CREATE DATABASE civicrm_test;" | mysql -u root --password=root --host=mysql + + - name: Update civicrm.settings.php + run: | + FILE_PATH="$GITHUB_WORKSPACE/site/web/sites/default/civicrm.settings.php" + INSERT_LINE="\$GLOBALS['_CV']['TEST_DB_DSN'] = 'mysql://root:root@mysql:3306/civicrm_test?new_link=true';" + TMP_FILE=$(mktemp) + while IFS= read -r line + do + echo "$line" >> "$TMP_FILE" + if [ "$line" = "> "$TMP_FILE" + fi + done < "$FILE_PATH" + mv "$TMP_FILE" "$FILE_PATH" + echo "File modified successfully." + - name: Run JS unit tests working-directory: ${{ env.CIVICRM_EXTENSIONS_DIR }}/uk.co.compucorp.civicase run: | diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php index cfe8c427e..66bfef74b 100644 --- a/tests/phpunit/bootstrap.php +++ b/tests/phpunit/bootstrap.php @@ -2,7 +2,10 @@ ini_set('memory_limit', '2G'); ini_set('safe_mode', 0); -eval(cv('php:boot --level=classloader', 'phpcode')); +define('CIVICRM_CONTAINER_CACHE', 'never'); +define('CIVICRM_TEST', 1); +putenv('CIVICRM_UF=' . ($_ENV['CIVICRM_UF'] = 'UnitTests')); +eval(cv('php:boot --level=settings', 'phpcode')); //This will redirect all mails to the database. define('CIVICRM_MAILER_SPOOL', 1);