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
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

All Notable changes to the **Quality Assurance - Drupal** package.

## [5.0.2]

### Fixed

- Limited extension PHPUnit test and source discovery to project paths. The
shared configuration now discovers tests from the `tests/src` root rather
than requiring every optional test-type directory. This prevents both
recursive Composer-dependency scans and errors for absent test directories.

## [5.0.1]

### Fixed

- Select the PHPUnit 11.5 extension and site configuration templates when the
installed test runner is PHPUnit 11.

## [5.0.0]

### Added
Expand Down Expand Up @@ -177,6 +193,8 @@ Older releases (2.x.x) see [CHANGELOG-2.x.md](CHANGELOG-1.x.md).

Older releases (1.x.x) see [CHANGELOG-1.x.md](CHANGELOG-1.x.md).

[5.0.2]: https://github.com/district09/php_package_qa-drupal/compare/5.0.1...5.0.2
[5.0.1]: https://github.com/district09/php_package_qa-drupal/compare/5.0.0...5.0.1
[5.0.0]: https://github.com/district09/php_package_qa-drupal/compare/4.1.4...5.0.0
[4.1.4]: https://github.com/district09/php_package_qa-drupal/compare/4.1.3...4.1.4
[4.1.3]: https://github.com/district09/php_package_qa-drupal/compare/4.1.2...4.1.3
Expand Down
23 changes: 3 additions & 20 deletions configs/phpunit-extension-11.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,9 @@
</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 name="tests">
<directory suffix="Test.php">tests/src</directory>
<directory suffix="Test.php">modules/**/tests/src</directory>
</testsuite>
</testsuites>

Expand All @@ -57,7 +41,6 @@
<source ignoreSuppressionOfDeprecations="true">
<include>
<directory suffix=".php">./src</directory>
<directory suffix=".php">./**/src</directory>
<directory suffix=".php">./modules/**/src</directory>
</include>
<exclude>
Expand Down
23 changes: 3 additions & 20 deletions configs/phpunit-extension.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,9 @@
</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 name="tests">
<directory suffix="Test.php">tests/src</directory>
<directory suffix="Test.php">modules/**/tests/src</directory>
</testsuite>
</testsuites>

Expand All @@ -57,7 +41,6 @@
<source ignoreSuppressionOfDeprecations="true">
<include>
<directory suffix=".php">./src</directory>
<directory suffix=".php">./**/src</directory>
<directory suffix=".php">./modules/**/src</directory>
</include>
<exclude>
Expand Down
15 changes: 15 additions & 0 deletions tests/src/Unit/GrumPHP/ConfigFileMergerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,21 @@ public function testPhpunitConfigurationUsesCurrentRunnerSchema(): void {
);
}

/**
* Tests that extension test discovery is limited to project code.
*/
public function testExtensionPhpunitConfigurationExcludesVendorPaths(): void {
$task = (new \ReflectionClass(Phpunit::class))->newInstanceWithoutConstructor();
(new ConfigFileMerger())->mergeTaskConfig($task, TRUE);

$configuration = (string) file_get_contents('phpunit.qa-drupal.xml');
$document = new \DOMDocument();
self::assertTrue($document->loadXML($configuration));
self::assertStringContainsString('<directory suffix="Test.php">tests/src</directory>', $configuration);
self::assertStringNotContainsString('tests/src/Kernel', $configuration);
self::assertStringNotContainsString('<directory suffix=".php">./**/src', $configuration);
}

/**
* Runs the configuration merger with a PHPStan task instance.
*/
Expand Down
Loading