Skip to content

Commit ce61c80

Browse files
authored
Merge pull request #63 from iMattPro/testing
Host own phpunit config for coverage
2 parents a6264c9 + aa3ddc6 commit ce61c80

File tree

3 files changed

+103
-1
lines changed

3 files changed

+103
-1
lines changed

.github/phpunit-mariadb-github.xml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
backupGlobals="true"
4+
colors="true"
5+
processIsolation="false"
6+
stopOnFailure="false"
7+
bootstrap="../tests/bootstrap.php"
8+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
9+
cacheDirectory=".phpunit.cache"
10+
backupStaticProperties="false">
11+
<testsuites>
12+
<testsuite name="phpBB Test Suite">
13+
<directory suffix="_test.php">../tests</directory>
14+
<exclude>../tests/functional</exclude>
15+
<exclude>../tests/lint_test.php</exclude>
16+
</testsuite>
17+
<testsuite name="phpBB Functional Tests">
18+
<directory suffix="_test.php">../tests/functional</directory>
19+
</testsuite>
20+
</testsuites>
21+
<groups>
22+
<exclude>
23+
<group>slow</group>
24+
</exclude>
25+
</groups>
26+
<source restrictDeprecations="true">
27+
<include>
28+
<directory>../</directory>
29+
</include>
30+
<exclude>
31+
<directory>../tests/</directory>
32+
<directory>../language/</directory>
33+
<directory>../migrations/</directory>
34+
</exclude>
35+
</source>
36+
<php>
37+
<server name="PHPBB_TEST_DBMS" value="mysqli"/>
38+
<server name="PHPBB_TEST_DBHOST" value="0.0.0.0"/>
39+
<server name="PHPBB_TEST_DBPORT" value="3306"/>
40+
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests"/>
41+
<server name="PHPBB_TEST_DBUSER" value="root"/>
42+
<server name="PHPBB_TEST_DBPASSWD" value=""/>
43+
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
44+
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/"/>
45+
</php>
46+
</phpunit>

.github/phpunit-mysql-github.xml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
backupGlobals="true"
4+
colors="true"
5+
processIsolation="false"
6+
stopOnFailure="false"
7+
bootstrap="../tests/bootstrap.php"
8+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
9+
cacheDirectory=".phpunit.cache"
10+
backupStaticProperties="false">
11+
<testsuites>
12+
<testsuite name="phpBB Test Suite">
13+
<directory suffix="_test.php">../tests</directory>
14+
<exclude>../tests/functional</exclude>
15+
<exclude>../tests/lint_test.php</exclude>
16+
</testsuite>
17+
<testsuite name="phpBB Functional Tests">
18+
<directory suffix="_test.php">../tests/functional</directory>
19+
</testsuite>
20+
</testsuites>
21+
<groups>
22+
<exclude>
23+
<group>slow</group>
24+
</exclude>
25+
</groups>
26+
<source restrictDeprecations="true">
27+
<include>
28+
<directory>../</directory>
29+
</include>
30+
<exclude>
31+
<directory>../tests/</directory>
32+
<directory>../language/</directory>
33+
<directory>../migrations/</directory>
34+
</exclude>
35+
</source>
36+
<php>
37+
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\mysqli"/>
38+
<server name="PHPBB_TEST_DBHOST" value="0.0.0.0"/>
39+
<server name="PHPBB_TEST_DBPORT" value="3306"/>
40+
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests"/>
41+
<server name="PHPBB_TEST_DBUSER" value="root"/>
42+
<server name="PHPBB_TEST_DBPASSWD" value=""/>
43+
<server name="PHPBB_TEST_REDIS_HOST" value="localhost"/>
44+
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost"/>
45+
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
46+
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/"/>
47+
</php>
48+
</phpunit>

.github/workflows/tests.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,21 @@ jobs:
300300
run: composer install
301301
working-directory: ./phpBB4/phpBB/ext/${{ env.EXTNAME }}
302302

303+
- name: Checkout test-framework
304+
if: ${{ matrix.COVERAGE == '1' }}
305+
uses: actions/checkout@v4
306+
with:
307+
repository: phpbb-extensions/test-framework
308+
ref: ${{ env.PHPBB_BRANCH }}
309+
path: phpBB4/test-framework
310+
303311
- name: Setup PHPUnit files
304312
env:
305313
DB: ${{steps.database-type.outputs.db}}
306314
COVERAGE: ${{ matrix.COVERAGE == '1' && '1' || '0' }}
307315
run: |
308316
if [ "$COVERAGE" == '1' ]; then
309-
sed '/<source restrictDeprecations="true">/,/<\/source>/c\\t<source restrictDeprecations="true">\n\t\t<include>\n\t\t\t<directory>../</directory>\n\t\t</include>\n\t\t<exclude>\n\t\t\t<directory>../tests/</directory>\n\t\t\t<directory>../language/</directory>\n\t\t\t<directory>../migrations/</directory>\n\t\t</exclude>\n\t</source>' ".github/phpunit-$DB-github.xml" > "phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml"
317+
mkdir -p "phpBB/ext/$EXTNAME/.github" && cp test-framework/.github/phpunit* "$_"
310318
else
311319
mkdir -p "phpBB/ext/$EXTNAME/.github" && cp .github/phpunit* "$_"
312320
fi

0 commit comments

Comments
 (0)