Skip to content

Commit ffdd1c8

Browse files
committed
fix: Update PHPUnit config and bootstrap for PHPUnit 10 compatibility
- Migrate phpunit.xml from PHPUnit 9.3 to 10.5 schema - Fix test directory case: tests/unit -> tests/Unit - Add NC tests autoload to bootstrap.php - Add openregister as additional app dependency for CI tests
1 parent cde4a50 commit ffdd1c8

3 files changed

Lines changed: 32 additions & 5 deletions

File tree

.github/workflows/code-quality.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ jobs:
1919
enable-frontend: true
2020
enable-eslint: true
2121
enable-phpunit: true
22+
additional-apps: '[{"repo":"ConductionNL/openregister","app":"openregister"}]'
2223
enable-newman: true
2324
newman-collection-path: "tests"

phpunit.xml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,41 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
44
bootstrap="tests/bootstrap.php"
5-
colors="true">
5+
colors="true"
6+
cacheDirectory=".phpunit.cache"
7+
executionOrder="depends,defects"
8+
requireCoverageMetadata="false"
9+
beStrictAboutCoverageMetadata="true"
10+
beStrictAboutOutputDuringTests="true"
11+
failOnRisky="true"
12+
failOnWarning="false"
13+
failOnDeprecation="false">
14+
615
<testsuites>
716
<testsuite name="Unit Tests">
8-
<directory>tests/unit</directory>
17+
<directory>tests/Unit</directory>
918
</testsuite>
1019
<testsuite name="Integration Tests">
1120
<directory>tests/Integration</directory>
1221
</testsuite>
1322
</testsuites>
1423

15-
<coverage processUncoveredFiles="true">
24+
<source>
1625
<include>
1726
<directory suffix=".php">lib/</directory>
1827
</include>
28+
</source>
29+
30+
<coverage>
31+
<report>
32+
<clover outputFile="coverage/clover.xml"/>
33+
<html outputDirectory="coverage/html"/>
34+
<text outputFile="php://stdout" showUncoveredFiles="false"/>
35+
</report>
1936
</coverage>
37+
38+
<php>
39+
<env name="PHPUNIT_RUN" value="1"/>
40+
</php>
2041
</phpunit>

tests/bootstrap.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@
2828
if (file_exists(__DIR__ . '/../../../lib/base.php')) {
2929
require_once __DIR__ . '/../../../lib/base.php';
3030
}
31-
31+
32+
// Load Test\TestCase and other NC test classes (NC convention).
33+
if (file_exists(__DIR__ . '/../../../tests/autoload.php')) {
34+
require_once __DIR__ . '/../../../tests/autoload.php';
35+
}
36+
3237
// Load all enabled apps
3338
\OC_App::loadApps();
3439

0 commit comments

Comments
 (0)