@@ -41,10 +41,105 @@ The code is statically analyzed with [PHPStan](https://phpstan.org/). To run sta
41
41
composer run static
42
42
```
43
43
44
- ## Unit tests
44
+ ## Unit Tests
45
45
46
46
The code is tested with [ PHPUnit] ( https://phpunit.de/ ) . To run tests.
47
47
48
- ```
48
+ ``` shell
49
49
composer run test
50
50
```
51
+
52
+ ### Database Testing
53
+
54
+ This package supports testing with multiple database systems to ensure compatibility across different environments.
55
+
56
+ - ** MySQL** (8.0, 8.4, latest)
57
+ - ** Oracle** (23)
58
+ - ** PostgreSQL** (15, 16, 17)
59
+ - ** SQL Server** (2022-latest)
60
+ - ** SQLite** (default, in-memory) — No setup required
61
+
62
+ #### Database-Specific Testing
63
+
64
+ Run tests against specific database systems using PHPUnit groups.
65
+
66
+ ``` shell
67
+ # MySQL
68
+ ./vendor/bin/phpunit --group mysql
69
+
70
+ # Oracle
71
+ ./vendor/bin/phpunit --group oci
72
+
73
+ # PostgreSQL
74
+ ./vendor/bin/phpunit --group pgsql
75
+
76
+ # SQL Server
77
+ ./vendor/bin/phpunit --group mssql
78
+
79
+ # SQLite (default - in-memory database)
80
+ ./vendor/bin/phpunit --group sqlite
81
+ ```
82
+
83
+ #### Local Development Setup
84
+
85
+ For local testing with real databases, you can use Docker.
86
+
87
+ ##### MySQL
88
+ ``` shell
89
+ docker run -d --name mysql-test \
90
+ -e MYSQL_ROOT_PASSWORD=root \
91
+ -e MYSQL_DATABASE=yiitest \
92
+ -p 3306:3306 \
93
+ mysql:8.4
94
+
95
+ # Configure your database connection and run.
96
+ ./vendor/bin/phpunit --group mysql
97
+ ```
98
+
99
+ ##### Oracle
100
+ ``` shell
101
+ docker run -d --name oracle-test \
102
+ -e ORACLE_PASSWORD=root \
103
+ -e ORACLE_DATABASE=yiitest \
104
+ -p 1521:1521 \
105
+ gvenzl/oracle-free:23
106
+
107
+ # Configure your database connection and run.
108
+ ./vendor/bin/phpunit --group oci
109
+ ```
110
+
111
+ ##### PostgreSQL
112
+ ``` shell
113
+ docker run -d --name pgsql-test \
114
+ -e POSTGRES_PASSWORD=root \
115
+ -e POSTGRES_DB=yiitest \
116
+ -e POSTGRES_USER=root \
117
+ -p 5432:5432 \
118
+ postgres:17
119
+
120
+ # Configure your database connection and run.
121
+ ./vendor/bin/phpunit --group pgsql
122
+ ```
123
+
124
+ ##### SQL Server
125
+ ``` shell
126
+ docker run -d --name mssql-test \
127
+ -e ACCEPT_EULA=Y \
128
+ -e ' SA_PASSWORD=YourStrong!Passw0rd' \
129
+ -e MSSQL_PID=Developer \
130
+ -p 1433:1433 \
131
+ mcr.microsoft.com/mssql/server:2022-latest
132
+
133
+ # Create test database.
134
+ docker exec -it mssql-test /opt/mssql-tools18/bin/sqlcmd \
135
+ -C -S localhost -U SA -P ' YourStrong!Passw0rd' \
136
+ -Q " CREATE DATABASE yiitest;"
137
+
138
+ # Configure your database connection and run.
139
+ ./vendor/bin/phpunit --group mssql
140
+ ```
141
+
142
+ ##### SQLite
143
+ ``` shell
144
+ ./vendor/bin/phpunit --group sqlite
145
+ ```
0 commit comments