Skip to content

Commit 89e7856

Browse files
MGatnerpaulbalandan
authored andcommitted
Migrate PHPUnit to 9
1 parent 22e34b1 commit 89e7856

5 files changed

Lines changed: 105 additions & 159 deletions

File tree

.github/workflows/test-phpunit.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- 'tests/**'
1313
- composer.json
1414
- spark
15+
- phpunit.xml.dist
1516
- '**.php'
1617
- phpunit.xml.dist
1718
- .github/workflows/test-phpunit.yml
@@ -26,6 +27,7 @@ on:
2627
- 'tests/**'
2728
- composer.json
2829
- spark
30+
- phpunit.xml.dist
2931
- '**.php'
3032
- phpunit.xml.dist
3133
- .github/workflows/test-phpunit.yml
@@ -40,7 +42,7 @@ jobs:
4042
strategy:
4143
fail-fast: false
4244
matrix:
43-
php-versions: ['7.2', '7.3', '7.4', '8.0']
45+
php-versions: ['7.3', '7.4', '8.0']
4446
db-platforms: ['MySQLi', 'Postgre', 'SQLite3', 'SQLSRV']
4547

4648
services:

admin/framework/phpunit.xml.dist

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,46 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="system/Test/bootstrap.php"
3-
backupGlobals="false"
4-
colors="true"
5-
convertErrorsToExceptions="true"
6-
convertNoticesToExceptions="true"
7-
convertWarningsToExceptions="true"
8-
stopOnError="false"
9-
stopOnFailure="false"
10-
stopOnIncomplete="false"
11-
stopOnSkipped="false">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="system/Test/bootstrap.php" backupGlobals="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./app</directory>
6+
</include>
7+
<exclude>
8+
<directory suffix=".php">./app/Views</directory>
9+
<file>./app/Config/Routes.php</file>
10+
</exclude>
11+
<report>
12+
<clover outputFile="build/logs/clover.xml"/>
13+
<html outputDirectory="build/logs/html"/>
14+
<php outputFile="build/logs/coverage.serialized"/>
15+
<text outputFile="php://stdout" showUncoveredFiles="false"/>
16+
</report>
17+
</coverage>
1218
<testsuites>
1319
<testsuite name="App">
1420
<directory>./tests</directory>
1521
</testsuite>
1622
</testsuites>
17-
18-
<filter>
19-
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
20-
<directory suffix=".php">./app</directory>
21-
<exclude>
22-
<directory suffix=".php">./app/Views</directory>
23-
<file>./app/Config/Routes.php</file>
24-
</exclude>
25-
</whitelist>
26-
</filter>
27-
2823
<logging>
29-
<log type="coverage-html" target="build/logs/html"/>
30-
<log type="coverage-clover" target="build/logs/clover.xml"/>
31-
<log type="coverage-php" target="build/logs/coverage.serialized"/>
32-
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/>
33-
<log type="testdox-html" target="build/logs/testdox.html"/>
34-
<log type="testdox-text" target="build/logs/testdox.txt"/>
35-
<log type="junit" target="build/logs/logfile.xml"/>
24+
<testdoxHtml outputFile="build/logs/testdox.html"/>
25+
<testdoxText outputFile="build/logs/testdox.txt"/>
26+
<junit outputFile="build/logs/logfile.xml"/>
3627
</logging>
37-
3828
<php>
3929
<server name="app.baseURL" value="http://example.com/"/>
40-
4130
<!-- Directory containing phpunit.xml -->
4231
<const name="HOMEPATH" value="./"/>
43-
4432
<!-- Directory containing the Paths config file -->
4533
<const name="CONFIGPATH" value="./app/Config/"/>
46-
4734
<!-- Directory containing the front controller (index.php) -->
4835
<const name="PUBLICPATH" value="./public/"/>
49-
5036
<!-- Database configuration -->
51-
<!-- <env name="database.tests.hostname" value="localhost"/> -->
52-
<!-- <env name="database.tests.database" value="tests"/> -->
53-
<!-- <env name="database.tests.username" value="tests_user"/> -->
54-
<!-- <env name="database.tests.password" value=""/> -->
55-
<!-- <env name="database.tests.DBDriver" value="MySQLi"/> -->
56-
<!-- <env name="database.tests.DBPrefix" value="tests_"/> -->
57-
<env name="database.tests.database" value=":memory:"/>
58-
<env name="database.tests.DBDriver" value="SQLite3"/>
37+
<!-- Uncomment to provide your own database for testing
38+
<env name="database.tests.hostname" value="localhost"/>
39+
<env name="database.tests.database" value="tests"/>
40+
<env name="database.tests.username" value="tests_user"/>
41+
<env name="database.tests.password" value=""/>
42+
<env name="database.tests.DBDriver" value="MySQLi"/>
43+
<env name="database.tests.DBPrefix" value="tests_"/>
44+
-->
5945
</php>
6046
</phpunit>

admin/module/phpunit.xml.dist

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,46 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
3-
backupGlobals="false"
4-
colors="true"
5-
convertErrorsToExceptions="true"
6-
convertNoticesToExceptions="true"
7-
convertWarningsToExceptions="true"
8-
stopOnError="false"
9-
stopOnFailure="false"
10-
stopOnIncomplete="false"
11-
stopOnSkipped="false">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php" backupGlobals="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./src</directory>
6+
</include>
7+
<exclude>
8+
<directory suffix=".php">./src/Views</directory>
9+
<file>./src/Config/Routes.php</file>
10+
</exclude>
11+
<report>
12+
<clover outputFile="build/logs/clover.xml"/>
13+
<html outputDirectory="build/logs/html"/>
14+
<php outputFile="build/logs/coverage.serialized"/>
15+
<text outputFile="php://stdout" showUncoveredFiles="false"/>
16+
</report>
17+
</coverage>
1218
<testsuites>
1319
<testsuite name="App">
1420
<directory>./tests</directory>
1521
</testsuite>
1622
</testsuites>
17-
18-
<filter>
19-
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
20-
<directory suffix=".php">./src</directory>
21-
<exclude>
22-
<directory suffix=".php">./src/Views</directory>
23-
<file>./src/Config/Routes.php</file>
24-
</exclude>
25-
</whitelist>
26-
</filter>
27-
2823
<logging>
29-
<log type="coverage-html" target="build/logs/html"/>
30-
<log type="coverage-clover" target="build/logs/clover.xml"/>
31-
<log type="coverage-php" target="build/logs/coverage.serialized"/>
32-
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/>
33-
<log type="testdox-html" target="build/logs/testdox.html"/>
34-
<log type="testdox-text" target="build/logs/testdox.txt"/>
35-
<log type="junit" target="build/logs/logfile.xml"/>
24+
<testdoxHtml outputFile="build/logs/testdox.html"/>
25+
<testdoxText outputFile="build/logs/testdox.txt"/>
26+
<junit outputFile="build/logs/logfile.xml"/>
3627
</logging>
37-
3828
<php>
3929
<server name="app.baseURL" value="http://example.com/"/>
40-
4130
<!-- Directory containing phpunit.xml -->
4231
<const name="HOMEPATH" value="./"/>
43-
4432
<!-- Directory containing the Paths config file -->
4533
<const name="CONFIGPATH" value="./vendor/codeigniter4/framework/app/Config/"/>
46-
4734
<!-- Directory containing the front controller (index.php) -->
4835
<const name="PUBLICPATH" value="./vendor/codeigniter4/framework/public/"/>
49-
5036
<!-- Database configuration -->
51-
<!-- <env name="database.tests.hostname" value="localhost"/> -->
52-
<!-- <env name="database.tests.database" value="tests"/> -->
53-
<!-- <env name="database.tests.username" value="tests_user"/> -->
54-
<!-- <env name="database.tests.password" value=""/> -->
55-
<!-- <env name="database.tests.DBDriver" value="MySQLi"/> -->
56-
<!-- <env name="database.tests.DBPrefix" value="tests_"/> -->
57-
<env name="database.tests.database" value=":memory:"/>
58-
<env name="database.tests.DBDriver" value="SQLite3"/>
37+
<!-- Uncomment to provide your own database for testing
38+
<env name="database.tests.hostname" value="localhost"/>
39+
<env name="database.tests.database" value="tests"/>
40+
<env name="database.tests.username" value="tests_user"/>
41+
<env name="database.tests.password" value=""/>
42+
<env name="database.tests.DBDriver" value="MySQLi"/>
43+
<env name="database.tests.DBPrefix" value="tests_"/>
44+
-->
5945
</php>
6046
</phpunit>

admin/starter/phpunit.xml.dist

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,46 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
3-
backupGlobals="false"
4-
colors="true"
5-
convertErrorsToExceptions="true"
6-
convertNoticesToExceptions="true"
7-
convertWarningsToExceptions="true"
8-
stopOnError="false"
9-
stopOnFailure="false"
10-
stopOnIncomplete="false"
11-
stopOnSkipped="false">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php" backupGlobals="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./app</directory>
6+
</include>
7+
<exclude>
8+
<directory suffix=".php">./app/Views</directory>
9+
<file>./app/Config/Routes.php</file>
10+
</exclude>
11+
<report>
12+
<clover outputFile="build/logs/clover.xml"/>
13+
<html outputDirectory="build/logs/html"/>
14+
<php outputFile="build/logs/coverage.serialized"/>
15+
<text outputFile="php://stdout" showUncoveredFiles="false"/>
16+
</report>
17+
</coverage>
1218
<testsuites>
1319
<testsuite name="App">
1420
<directory>./tests</directory>
1521
</testsuite>
1622
</testsuites>
17-
18-
<filter>
19-
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
20-
<directory suffix=".php">./app</directory>
21-
<exclude>
22-
<directory suffix=".php">./app/Views</directory>
23-
<file>./app/Config/Routes.php</file>
24-
</exclude>
25-
</whitelist>
26-
</filter>
27-
2823
<logging>
29-
<log type="coverage-html" target="build/logs/html"/>
30-
<log type="coverage-clover" target="build/logs/clover.xml"/>
31-
<log type="coverage-php" target="build/logs/coverage.serialized"/>
32-
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/>
33-
<log type="testdox-html" target="build/logs/testdox.html"/>
34-
<log type="testdox-text" target="build/logs/testdox.txt"/>
35-
<log type="junit" target="build/logs/logfile.xml"/>
24+
<testdoxHtml outputFile="build/logs/testdox.html"/>
25+
<testdoxText outputFile="build/logs/testdox.txt"/>
26+
<junit outputFile="build/logs/logfile.xml"/>
3627
</logging>
37-
3828
<php>
3929
<server name="app.baseURL" value="http://example.com/"/>
40-
4130
<!-- Directory containing phpunit.xml -->
4231
<const name="HOMEPATH" value="./"/>
43-
4432
<!-- Directory containing the Paths config file -->
4533
<const name="CONFIGPATH" value="./app/Config/"/>
46-
4734
<!-- Directory containing the front controller (index.php) -->
4835
<const name="PUBLICPATH" value="./public/"/>
49-
5036
<!-- Database configuration -->
51-
<!-- <env name="database.tests.hostname" value="localhost"/> -->
52-
<!-- <env name="database.tests.database" value="tests"/> -->
53-
<!-- <env name="database.tests.username" value="tests_user"/> -->
54-
<!-- <env name="database.tests.password" value=""/> -->
55-
<!-- <env name="database.tests.DBDriver" value="MySQLi"/> -->
56-
<!-- <env name="database.tests.DBPrefix" value="tests_"/> -->
57-
<env name="database.tests.database" value=":memory:"/>
58-
<env name="database.tests.DBDriver" value="SQLite3"/>
37+
<!-- Uncomment to provide your own database for testing
38+
<env name="database.tests.hostname" value="localhost"/>
39+
<env name="database.tests.database" value="tests"/>
40+
<env name="database.tests.username" value="tests_user"/>
41+
<env name="database.tests.password" value=""/>
42+
<env name="database.tests.DBDriver" value="MySQLi"/>
43+
<env name="database.tests.DBPrefix" value="tests_"/>
44+
-->
5945
</php>
6046
</phpunit>

phpunit.xml.dist

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="system/Test/bootstrap.php"
3-
backupGlobals="false"
4-
colors="true"
5-
convertErrorsToExceptions="true"
6-
convertNoticesToExceptions="true"
7-
convertWarningsToExceptions="true"
8-
stopOnError="false"
9-
stopOnFailure="false"
10-
stopOnIncomplete="false"
11-
stopOnSkipped="false">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="system/Test/bootstrap.php" backupGlobals="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./system</directory>
6+
</include>
7+
<exclude>
8+
<directory>./system/Commands/Generators/Views</directory>
9+
<directory>./system/Debug/Toolbar/Views</directory>
10+
<directory>./system/Pager/Views</directory>
11+
<directory>./system/ThirdParty</directory>
12+
<directory>./system/Validation/Views</directory>
13+
<file>./system/bootstrap.php</file>
14+
<file>./system/ComposerScripts.php</file>
15+
<file>./system/Config/Routes.php</file>
16+
<file>./system/Test/bootstrap.php</file>
17+
</exclude>
18+
<report>
19+
<clover outputFile="build/logs/clover.xml"/>
20+
</report>
21+
</coverage>
1222
<testsuites>
1323
<testsuite name="System">
1424
<directory>./tests/system</directory>
@@ -18,38 +28,14 @@
1828
<directory>./tests/system/Database</directory>
1929
</testsuite>
2030
</testsuites>
21-
22-
<filter>
23-
<whitelist processUncoveredFilesFromWhitelist="true">
24-
<directory suffix=".php">./system</directory>
25-
<exclude>
26-
<directory>./system/Commands/Generators/Views</directory>
27-
<directory>./system/Debug/Toolbar/Views</directory>
28-
<directory>./system/Pager/Views</directory>
29-
<directory>./system/ThirdParty</directory>
30-
<directory>./system/Validation/Views</directory>
31-
<file>./system/bootstrap.php</file>
32-
<file>./system/ComposerScripts.php</file>
33-
<file>./system/Config/Routes.php</file>
34-
<file>./system/Test/bootstrap.php</file>
35-
</exclude>
36-
</whitelist>
37-
</filter>
38-
39-
<logging>
40-
<log type="coverage-clover" target="build/logs/clover.xml"/>
41-
</logging>
42-
31+
<logging/>
4332
<php>
4433
<env name="XDEBUG_MODE" value="coverage"/>
4534
<server name="app.baseURL" value="http://example.com/"/>
46-
4735
<!-- Directory containing phpunit.xml -->
4836
<const name="HOMEPATH" value="./"/>
49-
5037
<!-- Directory containing the Paths config file -->
5138
<const name="CONFIGPATH" value="./app/Config/"/>
52-
5339
<!-- Directory containing the front controller (index.php) -->
5440
<const name="PUBLICPATH" value="./public/"/>
5541
</php>

0 commit comments

Comments
 (0)