diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a3fa4a..a4050d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Change Log -## 0.1.0 July 4, 2025 +## 0.1.0 July 8, 2025 - Initial release diff --git a/docs/testing.md b/docs/testing.md index 2c92040..8d177b5 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -41,10 +41,105 @@ The code is statically analyzed with [PHPStan](https://phpstan.org/). To run sta composer run static ``` -## Unit tests +## Unit Tests The code is tested with [PHPUnit](https://phpunit.de/). To run tests. -``` +```shell composer run test ``` + +### Database Testing + +This package supports testing with multiple database systems to ensure compatibility across different environments. + +- **MySQL** (8.0, 8.4, latest) +- **Oracle** (23) +- **PostgreSQL** (15, 16, 17) +- **SQL Server** (2022-latest) +- **SQLite** (default, in-memory) — No setup required + +#### Database-Specific Testing + +Run tests against specific database systems using PHPUnit groups. + +```shell +# MySQL +./vendor/bin/phpunit --group mysql + +# Oracle +./vendor/bin/phpunit --group oci + +# PostgreSQL +./vendor/bin/phpunit --group pgsql + +# SQL Server +./vendor/bin/phpunit --group mssql + +# SQLite (default - in-memory database) +./vendor/bin/phpunit --group sqlite +``` + +#### Local Development Setup + +For local testing with real databases, you can use Docker. + +##### MySQL +```shell +docker run -d --name mysql-test \ + -e MYSQL_ROOT_PASSWORD=root \ + -e MYSQL_DATABASE=yiitest \ + -p 3306:3306 \ + mysql:8.4 + +# Configure your database connection and run. +./vendor/bin/phpunit --group mysql +``` + +##### Oracle +```shell +docker run -d --name oracle-test \ + -e ORACLE_PASSWORD=root \ + -e ORACLE_DATABASE=yiitest \ + -p 1521:1521 \ + gvenzl/oracle-free:23 + +# Configure your database connection and run. +./vendor/bin/phpunit --group oci +``` + +##### PostgreSQL +```shell +docker run -d --name pgsql-test \ + -e POSTGRES_PASSWORD=root \ + -e POSTGRES_DB=yiitest \ + -e POSTGRES_USER=root \ + -p 5432:5432 \ + postgres:17 + +# Configure your database connection and run. +./vendor/bin/phpunit --group pgsql +``` + +##### SQL Server +```shell +docker run -d --name mssql-test \ + -e ACCEPT_EULA=Y \ + -e 'SA_PASSWORD=YourStrong!Passw0rd' \ + -e MSSQL_PID=Developer \ + -p 1433:1433 \ + mcr.microsoft.com/mssql/server:2022-latest + +# Create test database. +docker exec -it mssql-test /opt/mssql-tools18/bin/sqlcmd \ + -C -S localhost -U SA -P 'YourStrong!Passw0rd' \ + -Q "CREATE DATABASE yiitest;" + +# Configure your database connection and run. +./vendor/bin/phpunit --group mssql +``` + +##### SQLite +```shell +./vendor/bin/phpunit --group sqlite +```