Skip to content

Latest commit

 

History

History
86 lines (57 loc) · 2.37 KB

internals.md

File metadata and controls

86 lines (57 loc) · 2.37 KB

Internals

Github actions

All our packages have github actions by default, so you can test your contribution in the cloud.

Note: We recommend pull requesting in draft mode until all tests pass.

Docker

For greater ease it is recommended to use docker containers.

You can use the docker-compose.yml file with PostgreSQL 15 that is in the root of the package:

docker-compose up -d

Or run container directly via command:

docker run --rm --name yiisoft-db-pgsql-db -e POSTGRES_PASSWORD=root -e POSTGRES_USER=root -e POSTGRES_DB=yiitest -d -p 5432:5432 postgres:15

If you're running Docker on Linux (in WSL also), you can create tmpfs volume that persist database in the host memory and significantly speeds up the execution time of tests. Use docker run command argument for it:

--mount type=tmpfs,destination=/var/lib/postgresql/data

DB must be accessible by address 127.0.0.1. If you use PHP via docker container, run PHP container in network of DB container. Use docker run command argument for it:

--network container:yiisoft-db-pgsql-db

Unit testing

The package is tested with PHPUnit. To run tests:

  1. Run the docker container for the dbms.
  2. Install the dependencies of the project with composer.
  3. Run the tests.
vendor/bin/phpunit

Mutation testing

The package tests are checked with Infection mutation framework with Infection Static Analysis Plugin. To run it:

./vendor/bin/roave-infection-static-analysis-plugin

Static analysis

The code is statically analyzed with Psalm. To run static analysis:

./vendor/bin/psalm

Code style

Use Rector to make codebase follow some specific rules or use either newest or any specific version of PHP:

./vendor/bin/rector

Dependencies

This package uses composer-require-checker to check if all dependencies are correctly defined in composer.json. To run the checker, execute the following command:

./vendor/bin/composer-require-checker