Skip to content

Commit 1e901d8

Browse files
committed
🚿 add test groups, update phpunit.xml
1 parent b27bff7 commit 1e901d8

18 files changed

+68
-33
lines changed

.editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
charset = utf-8
6+
end_of_line = lf
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.py]
11+
indent_style = space
12+
indent_size = 4
13+
14+
[*.{yml,yaml}]
15+
indent_style = space
16+
indent_size = 2

phpunit.xml.dist

+17-26
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,37 @@
11
<?xml version="1.0"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
5-
cacheResultFile=".build/phpunit.result.cache"
5+
cacheDirectory=".build/phpunit.cache"
66
colors="true"
7+
beStrictAboutCoverageMetadata="true"
78
>
89
<testsuites>
910
<testsuite name="php-database test suite">
10-
<directory suffix=".php">./tests</directory>
11-
<!-- abstract classes because phpunit 10 -.- -->
12-
<exclude>./tests/DBTestAbstract.php</exclude>
13-
<exclude>./tests/Drivers/DriverTestAbstract.php</exclude>
14-
<exclude>./tests/Drivers/PDODriverTestAbstract.php</exclude>
15-
<exclude>./tests/Query/QueryTestAbstract.php</exclude>
16-
<!-- excluded tests on CI -->
17-
<exclude>./tests/Drivers/PDOFirebirdTest.php</exclude>
18-
<exclude>./tests/Drivers/MSSqlSrvTest.php</exclude>
19-
<exclude>./tests/Drivers/PDOMSSqlSrvTest.php</exclude>
20-
<exclude>./tests/Drivers/MySQLiTest.php</exclude>
21-
<exclude>./tests/Drivers/PDOMySQLTest.php</exclude>
22-
<exclude>./tests/Drivers/PostgreSQLTest.php</exclude>
23-
<exclude>./tests/Drivers/PDOPostgreSQLTest.php</exclude>
24-
<exclude>./tests/Query/FirebirdTest.php</exclude>
25-
<exclude>./tests/Query/MSSQLTest.php</exclude>
26-
<exclude>./tests/Query/MySQLTest.php</exclude>
27-
<exclude>./tests/Query/PostgresTest.php</exclude>
11+
<directory>tests</directory>
2812
</testsuite>
2913
</testsuites>
30-
<coverage>
14+
<source>
3115
<include>
32-
<directory suffix=".php">./src</directory>
16+
<directory>src</directory>
3317
</include>
18+
</source>
19+
<coverage>
3420
<report>
3521
<clover outputFile=".build/coverage/clover.xml"/>
3622
<xml outputDirectory=".build/coverage/coverage-xml"/>
3723
</report>
3824
</coverage>
39-
<logging>
40-
<junit outputFile=".build/logs/junit.xml"/>
41-
</logging>
25+
<groups>
26+
<exclude>
27+
<group>firebird</group>
28+
<group>pgsql</group>
29+
<group>mssql</group>
30+
<group>mysql</group>
31+
</exclude>
32+
</groups>
4233
<php>
43-
<!-- whether the test runs on CI or not - set to false to allow tests to run in your local setup -->
34+
<!-- whether the test runs on CI - set to false to allow tests to run in your local setup -->
4435
<const name="TEST_IS_CI" value="true"/>
4536
<!-- the config directory, where .env, cacert.pem and test oauth tokens reside, relative from project root -->
4637
<const name="TEST_CFGDIR" value="./config"/>

tests/DBTestAbstract.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ protected function setUp():void{
8888

8989
$this->options = new DatabaseOptions([
9090
'host' => $this->env->get($this->envPrefix.'_HOST'),
91-
'port' => $this->env->get($this->envPrefix.'_PORT'),
91+
'port' => (int)$this->env->get($this->envPrefix.'_PORT'),
9292
'database' => $this->env->get($this->envPrefix.'_DATABASE'),
9393
'username' => $this->env->get($this->envPrefix.'_USERNAME'),
9494
'password' => $this->env->get($this->envPrefix.'_PASSWORD'),

tests/Drivers/MSSqlSrvTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
namespace chillerlan\DatabaseTest\Drivers;
1212

1313
use chillerlan\Database\Drivers\MSSqlSrv;
14+
use PHPUnit\Framework\Attributes\Group;
1415
use function function_exists, get_resource_type;
1516

17+
#[Group('mssql')]
1618
final class MSSqlSrvTest extends DriverTestAbstract{
1719

1820
protected string $envPrefix = 'DB_MSSQL';

tests/Drivers/MySQLiTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414

1515
use chillerlan\Database\Drivers\MySQLiDrv;
1616
use mysqli;
17+
use PHPUnit\Framework\Attributes\Group;
1718
use function extension_loaded;
1819

20+
#[Group('mysql')]
1921
final class MySQLiTest extends DriverTestAbstract{
2022

2123
protected string $envPrefix = 'DB_MYSQLI';

tests/Drivers/PDOFirebirdTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
namespace chillerlan\DatabaseTest\Drivers;
1212

1313
use chillerlan\Database\Drivers\PDOFirebird;
14+
use PHPUnit\Framework\Attributes\Group;
1415
use function extension_loaded;
1516

17+
#[Group('firebird')]
1618
final class PDOFirebirdTest extends PDODriverTestAbstract{
1719

1820
protected string $envPrefix = 'DB_FIREBIRD';

tests/Drivers/PDOMSSqlSrvTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
namespace chillerlan\DatabaseTest\Drivers;
1212

1313
use chillerlan\Database\Drivers\PDOMSSqlSrv;
14+
use PHPUnit\Framework\Attributes\Group;
1415
use function function_exists;
1516

17+
#[Group('mssql')]
1618
final class PDOMSSqlSrvTest extends PDODriverTestAbstract{
1719

1820
protected string $envPrefix = 'DB_MSSQL';

tests/Drivers/PDOMySQLTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
namespace chillerlan\DatabaseTest\Drivers;
1212

1313
use chillerlan\Database\Drivers\PDOMySQL;
14+
use PHPUnit\Framework\Attributes\Group;
1415
use function extension_loaded;
1516

17+
#[Group('mysql')]
1618
final class PDOMySQLTest extends PDODriverTestAbstract{
1719

1820
protected string $envPrefix = 'DB_MYSQLI';

tests/Drivers/PDOPostgreSQLTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
namespace chillerlan\DatabaseTest\Drivers;
1212

1313
use chillerlan\Database\Drivers\PDOPostgreSQL;
14+
use PHPUnit\Framework\Attributes\Group;
1415
use function extension_loaded;
1516

17+
#[Group('pgsql')]
1618
final class PDOPostgreSQLTest extends PDODriverTestAbstract{
1719

1820
protected string $envPrefix = 'DB_POSTGRES';

tests/Drivers/PDOSQLiteMemoryTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
namespace chillerlan\DatabaseTest\Drivers;
1212

1313
use chillerlan\Database\Drivers\PDOSQLite;
14+
use PHPUnit\Framework\Attributes\Group;
1415
use function extension_loaded;
1516

17+
#[Group('sqlite')]
1618
final class PDOSQLiteMemoryTest extends PDODriverTestAbstract{
1719

1820
protected string $envPrefix = 'SQLITE_MEM';

tests/Drivers/PDOSQLiteTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
namespace chillerlan\DatabaseTest\Drivers;
1212

1313
use chillerlan\Database\Drivers\PDOSQLite;
14+
use PHPUnit\Framework\Attributes\Group;
1415
use function extension_loaded;
1516

17+
#[Group('sqlite')]
1618
final class PDOSQLiteTest extends PDODriverTestAbstract{
1719

1820
protected string $envPrefix = 'DB_SQLITE3';

tests/Drivers/PostgreSQLTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
namespace chillerlan\DatabaseTest\Drivers;
1212

1313
use chillerlan\Database\Drivers\PostgreSQL;
14+
use PHPUnit\Framework\Attributes\Group;
1415
use function extension_loaded;
1516
use function get_resource_type;
1617
use const PHP_VERSION_ID;
1718

19+
#[Group('pgsql')]
1820
final class PostgreSQLTest extends DriverTestAbstract{
1921

2022
protected string $envPrefix = 'DB_POSTGRES';

tests/Query/FirebirdTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212

1313
use chillerlan\Database\Drivers\PDOFirebird;
1414
use chillerlan\Database\ResultInterface;
15+
use PHPUnit\Framework\Attributes\Group;
1516
use function extension_loaded;
1617

17-
class FirebirdTest extends QueryTestAbstract{
18+
#[Group('firebird')]
19+
final class FirebirdTest extends QueryTestAbstract{
1820

1921
protected string $envPrefix = 'DB_FIREBIRD';
2022
protected string $driverFQCN = PDOFirebird::class;

tests/Query/MSSQLTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212

1313
use chillerlan\Database\Drivers\MSSqlSrv;
1414
use chillerlan\Database\ResultInterface;
15+
use PHPUnit\Framework\Attributes\Group;
1516
use function function_exists;
1617

17-
class MSSQLTest extends QueryTestAbstract{
18+
#[Group('mssql')]
19+
final class MSSQLTest extends QueryTestAbstract{
1820

1921
protected string $envPrefix = 'DB_MSSQL';
2022
protected string $driverFQCN = MSSqlSrv::class;

tests/Query/MySQLTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212

1313
use chillerlan\Database\Drivers\MySQLiDrv;
1414
use chillerlan\Database\ResultInterface;
15+
use PHPUnit\Framework\Attributes\Group;
1516
use function extension_loaded;
1617

17-
class MySQLTest extends QueryTestAbstract{
18+
#[Group('mysql')]
19+
final class MySQLTest extends QueryTestAbstract{
1820

1921
protected string $envPrefix = 'DB_MYSQLI';
2022
protected string $driverFQCN = MySQLiDrv::class;

tests/Query/PostgresTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212

1313
use chillerlan\Database\Drivers\PostgreSQL;
1414
use chillerlan\Database\ResultInterface;
15+
use PHPUnit\Framework\Attributes\Group;
1516
use function extension_loaded;
1617

17-
class PostgresTest extends QueryTestAbstract{
18+
#[Group('pgsql')]
19+
final class PostgresTest extends QueryTestAbstract{
1820

1921
protected string $envPrefix = 'DB_POSTGRES';
2022
protected string $driverFQCN = PostgreSQL::class;

tests/Query/SQLiteTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212

1313
use chillerlan\Database\Drivers\PDOSQLite;
1414
use chillerlan\Database\ResultInterface;
15+
use PHPUnit\Framework\Attributes\Group;
1516
use function extension_loaded;
1617
use function json_encode;
1718
use function md5;
1819
use const PHP_VERSION_ID;
1920

20-
class SQLiteTest extends QueryTestAbstract{
21+
#[Group('sqlite')]
22+
final class SQLiteTest extends QueryTestAbstract{
2123

2224
protected string $envPrefix = 'DB_SQLITE3';
2325
protected string $driverFQCN = PDOSQLite::class;

tests/ResultTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
use function hex2bin, json_encode, md5, range;
1818

19-
class ResultTest extends TestCase{
19+
final class ResultTest extends TestCase{
2020

2121
/**
2222
* @var \chillerlan\Database\Result

0 commit comments

Comments
 (0)