Skip to content
This repository has been archived by the owner on Oct 8, 2023. It is now read-only.

PHPUnit Testing

PHPUnit Testing #228

Workflow file for this run

name: PHPUnit Testing
on:
push:
branches: [ main ]
schedule:
- cron: "0 6 * * 3"
env:
SIMPLETEST_DB: "mysqli://root:@0.0.0.0/drupal_db?module=mysqli#d10t"
SIMPLETEST_BASE_URL: "http://localhost:8080"
BROWSERTEST_OUTPUT_DIRECTORY: "sites/default/files/simpletest"
PHPUNIT_SKIP_CLASS: '[
"Drupal\\KernelTests\\Core\\Cache\\ApcuBackendTest",
"Drupal\\Tests\\file\\Functional\\FileAddPermissionsUpdateTest"
]'
jobs:
#################################
mysqli:
name: "Test mysqli"
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
php-version:
- "8.1"
test-args:
- "--group Database"
- "--group Cache"
- "--group Config"
- "--group Entity"
- "--group file"
- "--group field,Field"
- "--group views"
services:
mysql:
image: "mysql:5.7"
options: >-
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes
-e MYSQL_DATABASE=drupal_db
ports:
- "3306:3306"
steps:
- name: Install PHP
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "none"
extensions: "mysqli, apcu"
ini-values: "zend.assertions=1"
- name: Checkout Drupal
run: git clone --depth=5 --branch=11.x http://git.drupal.org/project/drupal.git .
- name: Checkout mysqli module
uses: actions/checkout@v3
with:
path: mysqli_staging
- name: Patch Drupal
run: ./mysqli_staging/tests/github/drupal_patch.sh
- name: Install Composer dependencies
run: composer install --no-progress --ansi
- name: Composer require mysqli from local staging
run: |
git -C mysqli_staging checkout -b test-run-branch
composer config repositories.test-run '{"type": "path", "url": "mysqli_staging", "options": {"symlink": false}}'
composer require "mondrake/mysqli:dev-test-run-branch" --no-progress --ansi
- name: Install Drupal
run: |
cp mysqli_staging/tests/github/install_* .
# Install via Drush.
vendor/bin/drush site-install standard --db-url=$SIMPLETEST_DB -y
# Report installation status.
php install_report.php
vendor/bin/drush core:status
vendor/bin/drush core:requirements
vendor/bin/drush pml --type=module --no-core
# Spin a test webserver.
mkdir -p sites/default/files/simpletest
vendor/bin/drush runserver localhost:8080 --default-server=localhost:8080 &
sleep 1s
- name: Run tests ${{ matrix.test-args }}
run: vendor/bin/phpunit -c core --color=always ${{ matrix.test-args }}
- uses: actions/upload-artifact@v3
with:
name: test-results
path: sites/simpletest/browser_output