Skip to content

Commit

Permalink
Update docs 1.
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Apr 27, 2023
1 parent cf3baa5 commit 0ab5627
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 23 deletions.
30 changes: 30 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,36 @@ Since Yii 3 consists of many packages, we have a [special development tool](http

3. Now you are ready. Fork any package listed in `packages.php` and do `./yii-dev install username/package`.

4. Create a new branch for your changes.

If you are only going to make a pull request in a single repository, simply create the new branch, where the name correctly identifies the fix or feature to be made.

if you are going to make a pull request in multiple repositories, create a **new branch with the same name in all repositories**, this allows our github actions workflow to sync all branches, and tests to run correctly.

5. [Check your changes](/docs/en/testing.md).

## Reporting issues

Please follow the guidelines below when creating an issue so that your issue can be more promptly resolved:

* Provide information including: the version of PHP, dbms and the type of operating system.
* Provide the **complete** error call stack if available. A screenshot to explain the issue is very welcome.
* Describe the steps for reproducing the issue. It would be even better if you could provide code to reproduce the issue.
* If possible you may even create a failing unit test and [send it as a pull request](#git-workflow).

If the issue is related to one of the dbms packages, please report it to the corresponding repository.

If you are unsure, [report it to the main repository](https://github.com/yiisoft/cache-db/issues/new) (<https://github.com/yiisoft/cache-db/issues>).

**Do not report an issue if**

* you are asking how to use some **Yii Cache Library** feature. You should use [the forum](https://forum.yiiframework.com/c/yii-3-0/63) or [telegram](https://t.me/yii3en) for this purpose.
* your issue is about security. Please [contact us directly](https://www.yiiframework.com/security/) to report security issues.

**Avoid duplicated issues**

Before you report an issue, please search through [existing issues](https://github.com/yiisoft/cache-db/issues) to see if your issue is already reported or fixed to make sure you are not reporting a duplicated issue.

If you don't have any particular package in mind to start with:

- [Check roadmap](https://github.com/yiisoft/docs/blob/master/003-roadmap.md).
Expand Down
28 changes: 5 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,32 +104,14 @@ $cache->setLogger(new \Yiisoft\Log\Logger());

This allows you to log cache operations, when ocurring errors, etc.

## Testing

### Unit testing

The package is tested with [PHPUnit](https://phpunit.de/). To run tests:

```shell
./vendor/bin/phpunit
```

### Mutation testing
## Support

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:
If you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/db/68) is a good place for that.
You may also check out other [Yii Community Resources](https://www.yiiframework.com/community).

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

### Static analysis

The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:
## Testing

```shell
./vendor/bin/psalm
```
[Check the testing instructions](/docs/en/testing.md) to learn about testing.

### Support the project

Expand Down
101 changes: 101 additions & 0 deletions docs/en/testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Testing

This package can be tested globally or individually for each DBMS.

- [MSSQL](https://github.com/yiisoft/db-mssql)
- [MySQL/MariaDB](https://github.com/yiisoft/db-mysql)
- [Oracle](https://github.com/yiisoft/db-oracle)
- [PostgreSQL](https://github.com/yiisoft/db-pgsql)
- [SQLite](https://github.com/yiisoft/db-sqlite)

## Github actions

All our packages have github actions by default, so you can test your [contribution](https://github.com/yiisoft/db/blob/master/.github/CONTRIBUTING.md) in the cloud.

> Note: We recommend pull requesting in draft mode until all tests pass.
## Docker images

For greater ease it is recommended to use Docker containers for each DBMS, for this you can use the [docker-compose.yml](https://docs.docker.com/compose/compose-file/) file that in the root directory of each package.

- [MSSQL 2022](https://github.com/yiisoft/db-mssql/blob/master/docker-compose.yml)
- [MySQL 8](https://github.com/yiisoft/db-mysql/blob/master/docker-compose.yml)
- [MariaDB 10.11](https://github.com/yiisoft/db-mysql/blob/master/docker-compose-mariadb.yml)
- [Oracle 21](https://github.com/yiisoft/db-oracle/blob/master/docker-compose.yml)
- [PostgreSQL 15](https://github.com/yiisoft/db-pgsql/blob/master/docker-compose.yml)

For running the Docker containers you can use the following command:

```shell
docker compose up -d
```

## Unit testing

The package is tested with [PHPUnit](https://phpunit.de/).

### Global testing

The following steps are required to run the tests.

1. Run all Docker containers for each dbms.
2. Install the dependencies of the project with composer.
3. Run the tests.

```shell
vendor/bin/phpunit
```

### Individual testing

The following steps are required to run the tests.

1. Run the Docker container for the dbms you want to test.
2. Install the dependencies of the project with composer.
3. Run the tests.

```shell
vendor/bin/phpunit --testsuite=Pgsql
```

Suites available:
- Mssql
- Mysql
- Oracle
- Pgsql
- Sqlite

### 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
```

0 comments on commit 0ab5627

Please sign in to comment.