Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,23 @@ jobs:
fail-fast: false
matrix:
include:
- name: '11.1'
- name: '11.4'
php: '8.3'
drupal: '11.1.*'
phpunit: '^10.5.19'
drupal: '^11.4'
phpunit: '^11.5'
bridge: '^7.2'
behat: true
core_composer_scaffold: ''
- name: '11 current'
- name: '11.4'
php: '8.4'
drupal: '^11.4'
phpunit: '^11.5'
bridge: '^7.2'
behat: false
core_composer_scaffold: ''
- name: '11.4'
php: '8.5'
drupal: '^11.3'
drupal: '^11.4'
phpunit: '^11.5'
bridge: '^7.2'
behat: false
Expand Down Expand Up @@ -72,7 +79,7 @@ jobs:
"drupal/core-composer-scaffold:${{ matrix.core_composer_scaffold }}"

- name: Resolve dependencies
# Drupal 11.1 is retained as the historical minimum compatibility
# Drupal 11.4 is retained as the historical minimum compatibility
# target even after that minor line receives security advisories.
run: >-
composer update --no-interaction --prefer-dist
Expand Down Expand Up @@ -116,9 +123,9 @@ jobs:
- name: Verify optional Drupal 11 Behat configuration
if: matrix.behat
run: |
# Keep the optional integration on the matrix's 11.1 line. Without
# Keep the optional integration on the matrix's 11.4 line. Without
# this explicit constraint Composer upgrades vendor/drupal/core,
# while the fixture still contains the already-smoke-tested 11.1
# while the fixture still contains the already-smoke-tested 11.4
# copy in web/core.
composer require --dev --no-interaction --with-all-dependencies --no-security-blocking "drupal/core:${{ matrix.drupal }}" "drupal/drupal-extension:^6.1"
cp configs/behat.yml behat.qa-drupal.yml
Expand Down
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ All Notable changes to the **Quality Assurance - Drupal** package.
locale, and multibyte initialization to the extension bootstrap.
- Added focused tests for configuration merging, skip variables, and
transactional filesystem commit/rollback behavior.
- Added a GitHub Actions matrix for Drupal 11.1 on PHP 8.3, a current Drupal 11
release on PHP 8.5, and Drupal 12 on PHP 8.5.
- Added a GitHub Actions matrix for Drupal 11.4 on PHP 8.3 through 8.5 and
Drupal 12 on PHP 8.5.
- Added Lennart Van Vaerenbergh as a package author.

### Changed

- Raised the platform requirements to PHP `^8.3` and Drupal
`^11.1 || ^12.0`.
`^11.4 || ^12.0`.
- Use QA PHP `^3.0` for shared QA tooling. PHPUnit 10 support is removed;
PHPUnit 11.5 and 12.5 are selected for Drupal 11.4 and Drupal 12.
- Updated Coder, PHPCompatibility, PHPStan, PHPUnit, Symfony PHPUnit Bridge,
PHPCPD, GrumPHP, and related QA tools for Drupal 11/12 and PHP 8.3/8.5.
- Allowed the PHPMD 3 and PDepend 3 development lines specifically for Drupal
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ Drupal websites and extensions (modules, themes, and profiles).

| Drupal | PHP | Notes |
| --- | --- | --- |
| `^11.1` | `^8.3` | PHP 8.3 and 8.4 are supported throughout this Drupal range. Use Drupal 11.3 or later for PHP 8.5 support. |
| `^11.3` | `^8.3` | Includes the Drupal 11 releases that support PHP 8.5. |
| `^11.4` | `^8.3` | PHP 8.3 through 8.5 are supported. |
| `^12.0` | `^8.5` | Drupal 12 requires PHP 8.5. Behat is not currently available for this combination. |

QA Drupal 5.x intentionally drops Drupal 10 and PHP versions older than 8.3.
See [UPGRADE-5.x.md](UPGRADE-5.x.md) before updating an existing project.

QA Drupal 5.x uses [QA PHP 3.x](https://packagist.org/packages/district09/qa-php)
for its shared PHP QA toolchain. PHPUnit 11.5 is used with Drupal 11.4 and
PHPUnit 12.5 with Drupal 12.

## Installation

Installation depends on whether the consuming project is a Drupal website or a
Expand Down
33 changes: 14 additions & 19 deletions UPGRADE-5.x.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# Upgrading to QA Drupal 5.x

QA Drupal 5.x is the major-version compatibility release for Drupal 11.1 and
QA Drupal 5.x is the major-version compatibility release for Drupal 11.4 and
Drupal 12. Review every section before changing the Composer constraint in a
consumer project.

## Platform requirements

- Drupal 10 support is removed.
- PHP 8.3 is the minimum supported PHP version.
- Drupal 11.1 and later are supported on compatible PHP versions.
- Use Drupal 11.3 or later when running Drupal 11 on PHP 8.5.
- Drupal 11.4 and later are supported on compatible PHP versions.
- Drupal 12 requires PHP 8.5.

Drupal 11.1 is the minimum API compatibility target, not a recommendation to
Drupal 11.4 is the minimum API compatibility target, not a recommendation to
run an obsolete or insecure minor release. Production projects should always
use a currently supported Drupal release with all security updates applied.

Expand Down Expand Up @@ -89,19 +88,15 @@ grumphp:

## QA dependency generations

The 5.x dependency set moves to Drupal- and PHP-appropriate generations:
The 5.x dependency set builds on QA PHP 3.x and moves to Drupal- and
PHP-appropriate generations:

- Coder 9 and PHP_CodeSniffer 4 compatible rules.
- PHPCompatibility 10 alpha, required for PHP_CodeSniffer 4 and PHP 8.5 syntax.
- PHPStan Drupal 2 and PHPStan deprecation rules 2.
- PHPMD 2.15 on Drupal 11; Drupal 12 selects the explicitly allowed PHPMD 3
and PDepend 3 development lines because PHPMD 2/PDepend 2 do not allow
Symfony 8. Both development constraints are explicit; the package does not
lower global minimum stability. They can return to stable-only constraints
after PHPMD 3 and PDepend 3 are released.
- PHPUnit 10.5, 11.5, or 12.5, selected to match the Drupal line.
- PHPUnit 11.5 or 12.5, selected to match the Drupal line.
- Symfony PHPUnit Bridge 7.2 or 8.1.
- PHPCPD 7, 8, or 9, allowing Composer to match PHPUnit 10, 11, or 12.
- PHPCPD 8 or 9, allowing Composer to match PHPUnit 11 or 12.
- Current GrumPHP, Composer Normalize, TwigCS, PHP Mess Detector, Prophecy,
Mink, and Drupal browser-driver generations.

Expand All @@ -122,22 +117,22 @@ running GrumPHP.

The extension bootstrap now follows Drupal's current test initialization:

- Drupal 11.1 uses its legacy deprecation-handler initialization.
- Drupal 11.4 uses its legacy deprecation-handler initialization.
- Drupal 12 uses `DeprecationHandler::preBootstrap()` with PHPUnit's parsed
configuration.
- Composer autoload discovery, extension namespaces, `Drupal\TestSite`, the
Drupal `DocumentElement` alias, locale, multibyte settings, and timezone are
initialized consistently.
- Obsolete PHPUnit 8 compatibility mutation is removed.

The supplied site and extension XML configurations follow current PHPUnit
conventions and use `.phpunit.cache`. Update `.gitignore` if it still only
ignores `.phpunit.result.cache`. Existing test discovery and coverage output
locations are retained.
The supplied site and extension XML configurations select an 11.5 or 12.5
schema for the installed PHPUnit major and use `.phpunit.cache`. Update
`.gitignore` if it still only ignores `.phpunit.result.cache`. Existing test
discovery and coverage output locations are retained.

## Continuous integration

This repository now uses `.github/workflows/qa.yml` instead of Travis CI. The
matrix covers Drupal 11.1 on PHP 8.3, a PHP 8.5 compatible Drupal 11 release,
and Drupal 12 on PHP 8.5. Only the Drupal 11.1 job installs Drupal Extension and
matrix covers Drupal 11.4 on PHP 8.3 through 8.5 and Drupal 12 on PHP 8.5.
Only the Drupal 11.4 PHP 8.3 job installs Drupal Extension and
loads the optional Behat configuration.
13 changes: 4 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"php": "^8.3",
"behat/mink": "^1.13",
"behat/mink-browserkit-driver": "^2.3",
"district09/qa-php": "^3.0.3",
"drupal/coder": "^9.0",
"drupal/core": "^11.1 || ^12.0",
"ergebnis/composer-normalize": "^2.52",
"drupal/core": "^11.4 || ^12.0",
"friendsoftwig/twigcs": "^6.5",
"lullabot/mink-selenium2-driver": "^1.7.4",
"lullabot/php-webdriver": "^2.0.7",
Expand All @@ -40,13 +40,8 @@
"pdepend/pdepend": "^2.16.1 || 3.x-dev",
"phpcompatibility/php-compatibility": "^10.0@alpha",
"phpmd/phpmd": "^2.15 || 3.x-dev",
"phpro/grumphp-shim": "^2.0",
"phpspec/prophecy": "^1.23",
"phpspec/prophecy-phpunit": "^2.4",
"phpstan/phpstan-deprecation-rules": "^2.0",
"phpunit/phpunit": "^10.5.19 || ^11.5 || ^12.5",
"symfony/phpunit-bridge": "^7.2 || ^8.1",
"systemsdk/phpcpd": "^7.0.1 || ^8.0 || ^9.0"
"symfony/filesystem": "^6.4 || ^7.0 || ^8.0",
"symfony/phpunit-bridge": "^7.2 || ^8.1"
},
"suggest": {
"drupal/drupal-extension": "Install ^6.1 to enable the optional Behat integration on Drupal 11; Drupal 12 is not supported until Drupal Extension supports Symfony 8."
Expand Down
72 changes: 72 additions & 0 deletions configs/phpunit-extension-11.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- TODO set checkForUnintentionallyCoveredCode="true" once https://www.drupal.org/node/2626832 is resolved. -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/digipolisgent/qa-drupal/src/PHPUnit/Extension/bootstrap.php"
colors="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutChangesToGlobalState="true"
failOnRisky="true"
failOnWarning="true"
failOnPhpunitWarning="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnPhpunitDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
cacheResult="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
>
<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
<ini name="error_reporting" value="32767"/>
<ini name="memory_limit" value="-1"/>
</php>

<testsuites>
<testsuite name="unit">
<directory>**/tests/src/Unit</directory>
<exclude>vendor</exclude>
</testsuite>
<testsuite name="kernel">
<directory>**/tests/src/Kernel</directory>
<exclude>vendor</exclude>
</testsuite>
<testsuite name="functional">
<directory>**/tests/src/Functional</directory>
<exclude>vendor</exclude>
</testsuite>
<testsuite name="functional-javascript">
<directory>**/tests/src/FunctionalJavascript</directory>
<exclude>vendor</exclude>
</testsuite>
<testsuite name="build">
<directory>**/tests/src/Build</directory>
<exclude>vendor</exclude>
</testsuite>
</testsuites>

<coverage>
<report>
<html outputDirectory="./build/coverage"/>
<clover outputFile="./build/logs/clover.xml"/>
</report>
</coverage>

<source ignoreSuppressionOfDeprecations="true">
<include>
<directory suffix=".php">./src</directory>
<directory suffix=".php">./**/src</directory>
<directory suffix=".php">./modules/**/src</directory>
</include>
<exclude>
<directory suffix=".api.php">./</directory>
<directory suffix="Spy.php">./</directory>
<directory suffix="Stub.php">./</directory>
<directory suffix="Test.php">./</directory>
<directory suffix="TestBase.php">./</directory>
<directory suffix="TestCase.php">./</directory>
</exclude>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion configs/phpunit-extension.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
cacheResult="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
>
<php>
Expand Down
79 changes: 79 additions & 0 deletions configs/phpunit-site-11.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- TODO set checkForUnintentionallyCoveredCode="true" once https://www.drupal.org/node/2626832 is resolved. -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="web/core/tests/bootstrap.php"
colors="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutChangesToGlobalState="true"
failOnRisky="true"
failOnWarning="true"
failOnPhpunitWarning="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnPhpunitDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
cacheResult="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
>
<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
<ini name="error_reporting" value="32767"/>
<ini name="memory_limit" value="-1"/>
</php>

<testsuites>
<testsuite name="unit">
<directory>web/modules/custom/**/tests/src/Unit</directory>
<directory>web/profiles/custom/**/tests/src/Unit</directory>
<directory>web/themes/custom/**/tests/src/Unit</directory>
</testsuite>
<testsuite name="kernel">
<directory>web/modules/custom/**/tests/src/Kernel</directory>
<directory>web/recipes/custom/*/tests/src/Kernel</directory>
<directory>web/profiles/custom/**/tests/src/Kernel</directory>
<directory>web/themes/custom/**/tests/src/Kernel</directory>
</testsuite>
<testsuite name="functional">
<directory>web/modules/custom/**/tests/src/Functional</directory>
<directory>web/profiles/custom/**/tests/src/Functional</directory>
<directory>web/recipes/custom/*/tests/src/Functional</directory>
<directory>web/themes/custom/**/tests/src/Functional</directory>
</testsuite>
<testsuite name="functional-javascript">
<directory>web/modules/custom/**/tests/src/FunctionalJavascript</directory>
<directory>web/recipes/custom/*/tests/src/FunctionalJavascript</directory>
<directory>web/profiles/custom/**/tests/src/FunctionalJavascript</directory>
<directory>web/themes/custom/**/tests/src/FunctionalJavascript</directory>
</testsuite>
<testsuite name="build">
<directory>web/modules/custom/**/tests/src/Build</directory>
</testsuite>
</testsuites>

<coverage>
<report>
<html outputDirectory="./build/coverage"/>
<clover outputFile="./build/logs/clover.xml"/>
</report>
</coverage>

<source ignoreSuppressionOfDeprecations="true">
<include>
<directory suffix=".php">web/modules/custom</directory>
<directory suffix=".php">web/profiles/custom</directory>
<directory suffix=".php">web/themes/custom</directory>
</include>
<exclude>
<directory suffix=".api.php">./</directory>
<directory suffix="Spy.php">./</directory>
<directory suffix="Stub.php">./</directory>
<directory suffix="Test.php">./</directory>
<directory suffix="TestBase.php">./</directory>
<directory suffix="TestCase.php">./</directory>
<directory>web/themes/custom/*/source</directory>
</exclude>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion configs/phpunit-site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
cacheResult="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
>
<php>
Expand Down
9 changes: 8 additions & 1 deletion src/GrumPHP/ConfigFileMerger.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use GrumPHP\Task\Phpunit;
use GrumPHP\Task\TaskInterface;
use Nette\Neon\Neon;
use PHPUnit\Runner\Version;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Yaml\Yaml;

Expand Down Expand Up @@ -175,11 +176,17 @@ private function getConfigFileCandidates(
$key = strtoupper($taskInfo['filename']) . '_SKIP_';
$type = ($isExtension ? 'extension' : 'site');
$path = dirname(__FILE__, 3) . '/configs/';
$packageTypeFilename = $taskInfo['filename'] . '-' . $type;

// PHPUnit configuration schemas are specific to the runner major.
if ($taskInfo['filename'] === 'phpunit' && Version::majorVersionNumber() === 11) {
$packageTypeFilename .= '-11';
}

return [
$key . 'LOCAL' => $taskInfo['filename'] . '.local.' . $taskInfo['extension'],
$key . 'PROJECT' => $taskInfo['filename'] . '.' . $taskInfo['extension'],
$key . 'PACKAGE_TYPE' => $path . $taskInfo['filename'] . '-' . $type . '.' . $taskInfo['extension'],
$key . 'PACKAGE_TYPE' => $path . $packageTypeFilename . '.' . $taskInfo['extension'],
$key . 'PACKAGE_GLOBAL' => $path . $taskInfo['filename'] . '.' . $taskInfo['extension'],
];
}
Expand Down
Loading
Loading