Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08a0973
commit 3c26252
Showing
4 changed files
with
107 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: '3' | ||
|
||
services: | ||
mariadb: | ||
image: mariadb:10.11 | ||
restart: always | ||
environment: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: "true" | ||
MYSQL_PASSWORD: '' | ||
MYSQL_ROOT_PASSWORD: '' | ||
MYSQL_DATABASE: 'yiitest' | ||
ports: | ||
# <Port exposed> : < MySQL Port running inside container> | ||
- '3306:3306' | ||
expose: | ||
# Opens port 3306 on the container | ||
- '3306' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: '3' | ||
|
||
services: | ||
mysql: | ||
image: mysql:8 | ||
environment: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: "true" | ||
# user and password are set in the yml file | ||
MYSQL_PASSWORD: '' | ||
MYSQL_ROOT_PASSWORD: '' | ||
MYSQL_DATABASE: 'yiitest' | ||
ports: | ||
# <Port exposed> : < MySQL Port running inside container> | ||
- '3306:3306' | ||
expose: | ||
# Opens port 3306 on the container | ||
- '3306' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Testing | ||
|
||
## Docker image | ||
|
||
For greater ease it is recommended to use docker containers, for this you can use the [docker-compose.yml](https://docs.docker.com/compose/compose-file/) file that is in the docs folder. | ||
|
||
1. [MySQL 8](/docker-compose.yml) | ||
2. [MariaDB 10.11](/docker-compose-mariadb.yml) | ||
|
||
For running the docker containers you can use the following command: | ||
|
||
MySQL 8.0. | ||
|
||
```shell | ||
docker compose up -d | ||
``` | ||
|
||
MariaDB 10.11. | ||
|
||
```shell | ||
docker compose -f docker-compose-mariadb.yml up -d | ||
``` | ||
|
||
## Unit testing | ||
|
||
The package is tested with [PHPUnit](https://phpunit.de/). | ||
|
||
The following steps are required to run the tests: | ||
|
||
1. Run the docker container for the dbms. | ||
2. Install the dependencies of the project with composer. | ||
3. Run the tests. | ||
|
||
```shell | ||
vendor/bin/phpunit | ||
``` | ||
|
||
### Mutation testing | ||
|
||
The package tests are checked with [Infection](https://infection.github.io/) mutation framework with | ||
[Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it: | ||
|
||
```shell | ||
./vendor/bin/roave-infection-static-analysis-plugin | ||
``` | ||
|
||
## Static analysis | ||
|
||
The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis: | ||
|
||
```shell | ||
./vendor/bin/psalm | ||
``` | ||
|
||
## Rector | ||
|
||
Use [Rector](https://github.com/rectorphp/rector) to make codebase follow some specific rules or | ||
use either newest or any specific version of PHP: | ||
|
||
```shell | ||
./vendor/bin/rector | ||
``` | ||
|
||
## Composer require checker | ||
|
||
This package uses [composer-require-checker](https://github.com/maglnet/ComposerRequireChecker) to check if all dependencies are correctly defined in `composer.json`. | ||
|
||
To run the checker, execute the following command: | ||
|
||
```shell | ||
./vendor/bin/composer-require-checker | ||
``` |