From 70abdf31b8bb30bc1fcb11d568079adeabe39c27 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Thu, 4 Jan 2024 09:13:06 -0300 Subject: [PATCH 01/24] Add docs for testing. --- composer.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 9f43232ff..d30c4ab25 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": "^8.0", + "php": "^8.1", "ext-json": "*", "yiisoft/arrays": "^3.0", "yiisoft/db": "^1.1", @@ -27,13 +27,14 @@ }, "require-dev": { "maglnet/composer-require-checker": "^4.2", - "phpunit/phpunit": "^9.6|^10.0", + "phpunit/phpunit": "^10.5", "rector/rector": "^0.18", - "roave/infection-static-analysis-plugin": "^1.16", + "roave/infection-static-analysis-plugin": "^1.34", "spatie/phpunit-watcher": "^1.23", - "vimeo/psalm": "^4.8|^5.8", + "vimeo/psalm": "^5.8", "yiisoft/aliases": "^2.0", "yiisoft/cache": "^3.0", + "yiisoft/db-sqlite": "^1.1", "yiisoft/di": "^1.0", "yiisoft/json": "^1.0" }, From 3cb78c8d15ac36c9e24a254d57f6571fd48792c9 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Thu, 4 Jan 2024 09:15:50 -0300 Subject: [PATCH 02/24] Update workflows, remove php `8.0`, add php `8.3`. --- .github/workflows/composer-require-checker.yml | 2 +- .github/workflows/db-mssql.yml | 2 +- .github/workflows/db-mysql.yml | 2 +- .github/workflows/db-oracle.yml | 2 +- .github/workflows/db-pgsql.yml | 2 +- .github/workflows/mutation.yml | 2 +- .github/workflows/rector.yml | 2 +- .github/workflows/static.yml | 3 ++- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/composer-require-checker.yml b/.github/workflows/composer-require-checker.yml index ae5893f54..2c99e346f 100644 --- a/.github/workflows/composer-require-checker.yml +++ b/.github/workflows/composer-require-checker.yml @@ -30,4 +30,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.0', '8.1'] + ['8.1', '8.2', '8.3'] diff --git a/.github/workflows/db-mssql.yml b/.github/workflows/db-mssql.yml index e90bf347b..37f5c5c9a 100644 --- a/.github/workflows/db-mssql.yml +++ b/.github/workflows/db-mssql.yml @@ -38,9 +38,9 @@ jobs: - ubuntu-latest php: - - 8.0 - 8.1 - 8.2 + - 8.3 services: mssql: diff --git a/.github/workflows/db-mysql.yml b/.github/workflows/db-mysql.yml index c6f6b17d5..c91502280 100644 --- a/.github/workflows/db-mysql.yml +++ b/.github/workflows/db-mysql.yml @@ -38,9 +38,9 @@ jobs: - ubuntu-latest php: - - 8.0 - 8.1 - 8.2 + - 8.3 services: mysql: diff --git a/.github/workflows/db-oracle.yml b/.github/workflows/db-oracle.yml index 7d2d6bdba..a764f55f1 100644 --- a/.github/workflows/db-oracle.yml +++ b/.github/workflows/db-oracle.yml @@ -38,9 +38,9 @@ jobs: - ubuntu-latest php: - - 8.0 - 8.1 - 8.2 + - 8.3 services: oci: diff --git a/.github/workflows/db-pgsql.yml b/.github/workflows/db-pgsql.yml index 97b968df7..750c840b3 100644 --- a/.github/workflows/db-pgsql.yml +++ b/.github/workflows/db-pgsql.yml @@ -38,9 +38,9 @@ jobs: - ubuntu-latest php: - - 8.0 - 8.1 - 8.2 + - 8.3 services: postgres: diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index db5c7aafb..a25011219 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -34,7 +34,7 @@ jobs: - ubuntu-latest php: - - 8.0 + - 8.1 services: mssql: diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index e21dd376a..61e99090f 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -28,4 +28,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.0'] + ['8.1'] diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index d04a2f729..768981023 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -33,8 +33,9 @@ jobs: - ubuntu-latest php: - - 8.0 - 8.1 + - 8.2 + - 8.3 steps: - name: Checkout From 78ff492ec7a34b25e4abd34eba0a23eaac471761 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Thu, 4 Jan 2024 09:19:24 -0300 Subject: [PATCH 03/24] Add concurrency to workflows. --- .github/workflows/composer-require-checker.yml | 4 ++++ .github/workflows/db-mssql.yml | 4 ++++ .github/workflows/db-mysql.yml | 4 ++++ .github/workflows/db-oracle.yml | 4 ++++ .github/workflows/db-pgsql.yml | 4 ++++ .github/workflows/db-sqlite.yml | 4 ++++ .github/workflows/mutation.yml | 4 ++++ .github/workflows/rector.yml | 4 ++++ .github/workflows/static.yml | 4 ++++ 9 files changed, 36 insertions(+) diff --git a/.github/workflows/composer-require-checker.yml b/.github/workflows/composer-require-checker.yml index 2c99e346f..7817057db 100644 --- a/.github/workflows/composer-require-checker.yml +++ b/.github/workflows/composer-require-checker.yml @@ -23,6 +23,10 @@ on: name: Composer require checker +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: composer-require-checker: uses: yiisoft/actions/.github/workflows/composer-require-checker.yml@master diff --git a/.github/workflows/db-mssql.yml b/.github/workflows/db-mssql.yml index 37f5c5c9a..896560545 100644 --- a/.github/workflows/db-mssql.yml +++ b/.github/workflows/db-mssql.yml @@ -21,6 +21,10 @@ on: name: db-mssql +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: name: PHP ${{ matrix.php }} diff --git a/.github/workflows/db-mysql.yml b/.github/workflows/db-mysql.yml index c91502280..739e37970 100644 --- a/.github/workflows/db-mysql.yml +++ b/.github/workflows/db-mysql.yml @@ -21,6 +21,10 @@ on: name: db-mysql +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: name: PHP ${{ matrix.php }} diff --git a/.github/workflows/db-oracle.yml b/.github/workflows/db-oracle.yml index a764f55f1..62bd30ec2 100644 --- a/.github/workflows/db-oracle.yml +++ b/.github/workflows/db-oracle.yml @@ -21,6 +21,10 @@ on: name: db-oracle +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: name: PHP ${{ matrix.php }} diff --git a/.github/workflows/db-pgsql.yml b/.github/workflows/db-pgsql.yml index 750c840b3..88921f407 100644 --- a/.github/workflows/db-pgsql.yml +++ b/.github/workflows/db-pgsql.yml @@ -21,6 +21,10 @@ on: name: db-pgsql +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: name: PHP ${{ matrix.php }} diff --git a/.github/workflows/db-sqlite.yml b/.github/workflows/db-sqlite.yml index f01766d2e..c9273db0f 100644 --- a/.github/workflows/db-sqlite.yml +++ b/.github/workflows/db-sqlite.yml @@ -21,6 +21,10 @@ on: name: db-sqlite +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: name: PHP ${{ matrix.php }}-sqlite-${{ matrix.os }} diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index a25011219..4be9458a0 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -19,6 +19,10 @@ on: name: mutation +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: mutation: name: PHP ${{ matrix.php }}-${{ matrix.os }} diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index 61e99090f..21cb5b39f 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -21,6 +21,10 @@ on: name: rector +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: rector: uses: yiisoft/actions/.github/workflows/rector.yml@master diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 768981023..78374887d 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -21,6 +21,10 @@ on: name: static analysis +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: mutation: name: PHP ${{ matrix.php }}-${{ matrix.os }} From 54d0b640518811af5b7ea0047d4284881fa3d637 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Thu, 4 Jan 2024 09:21:34 -0300 Subject: [PATCH 04/24] Fix error typo. --- .github/workflows/db-sqlite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/db-sqlite.yml b/.github/workflows/db-sqlite.yml index c9273db0f..6f49b5b33 100644 --- a/.github/workflows/db-sqlite.yml +++ b/.github/workflows/db-sqlite.yml @@ -43,9 +43,9 @@ jobs: - windows-latest php: - - 8.0 - 8.1 - 8.2 + - 8.3 steps: - name: Checkout. From 70e5988ee406dd83fba3595ac557e16c96f338c1 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Thu, 4 Jan 2024 09:28:34 -0300 Subject: [PATCH 05/24] Fix mutattion workflow. --- .github/workflows/mutation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index 4be9458a0..6f36d3923 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -105,6 +105,6 @@ jobs: - name: Run infection. run: | - vendor/bin/roave-infection-static-analysis-plugin -j2 --ignore-msi-with-no-mutations --only-covered + vendor/bin/roave-infection-static-analysis-plugin --threads=2 --ignore-msi-with-no-mutations --only-covered env: STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} From c0e9feccde5506c280005661aec20299a07fe6ce Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Thu, 4 Jan 2024 09:38:34 -0300 Subject: [PATCH 06/24] Fix mutation tests. --- .github/workflows/mutation.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index 6f36d3923..4a329eab7 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -100,11 +100,11 @@ jobs: - name: Update composer. run: composer self-update - - name: Install db drivers. - run: composer require 'yiisoft/db-mssql:dev-master' 'yiisoft/db-mysql:dev-master' 'yiisoft/db-oracle:dev-master' 'yiisoft/db-pgsql:dev-master' 'yiisoft/db-sqlite:dev-master' --no-interaction --no-progress --optimize-autoloader --ansi + - name: Install db-pgsql. + run: composer require yiisoft/db-pgsql --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - name: Run infection. run: | - vendor/bin/roave-infection-static-analysis-plugin --threads=2 --ignore-msi-with-no-mutations --only-covered + vendor/bin/roave-infection-static-analysis-plugin --threads=2 --ignore-msi-with-no-mutations --only-covered --test-framework-options="--testsuite=Pgsql" env: STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} From 1efac2ecf21bf9d42dc2442a570b1edce2dccdeb Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Thu, 4 Jan 2024 11:24:57 -0300 Subject: [PATCH 07/24] Clean workflow. --- .github/workflows/mutation.yml | 35 +--------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index 4a329eab7..26f19e282 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -28,7 +28,7 @@ jobs: name: PHP ${{ matrix.php }}-${{ matrix.os }} env: - extensions: pdo, pdo_mysql, pdo_oci, pdo_pgsql, pdo_sqlite, pdo_sqlsrv-5.10.0-beta2, oci8 + extensions: pdo, pdo_pgsql runs-on: ${{ matrix.os }} @@ -41,36 +41,6 @@ jobs: - 8.1 services: - mssql: - image: mcr.microsoft.com/mssql/server:2019-latest - env: - SA_PASSWORD: YourStrong!Passw0rd - ACCEPT_EULA: Y - MSSQL_PID: Developer - ports: - - 1433:1433 - options: --name=mssql --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3 - mysql: - image: mysql:latest - env: - MYSQL_ALLOW_EMPTY_PASSWORD: true - MYSQL_PASSWORD: '' - MYSQL_DATABASE: yiitest - ports: - - 3306:3306 - options: --name=mysql --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - oci: - image: gvenzl/oracle-xe:latest - ports: - - 1521:1521 - env: - ORACLE_PASSWORD : root - options: >- - --name=oci - --health-cmd healthcheck.sh - --health-interval 10s - --health-timeout 5s - --health-retries 10 postgres: image: postgres:14 env: @@ -85,9 +55,6 @@ jobs: - name: Checkout. uses: actions/checkout@v3 - - name: Create MS SQL Database. - run: docker exec -i mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'CREATE DATABASE yiitest' - - name: Install PHP with extensions. uses: shivammathur/setup-php@v2 with: From 450161c31f40132e04f0888e23c902a2b2510356 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Thu, 4 Jan 2024 11:28:52 -0300 Subject: [PATCH 08/24] Update README.md. --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1c400c4d6..833a0d183 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ declare(strict_types=1); use Yiisoft\Db\Connection\ConnectionInterface; use Yiisoft\Db\Sqlite\Connection as SqliteConnection; +use Yiisoft\Db\Sqlite\Driver; /** * config ConnectionInterface::class @@ -64,8 +65,8 @@ return [ ConnectionInterface::class => [ 'class' => SqliteConnection::class, '__construct()' => [ - 'dsn' => $params['yiisoft/db-sqlite']['dsn'], - ] + 'driver' => new Driver($params['yiisoft/db-sqlite']['dsn']), + ], ] ]; ``` @@ -145,6 +146,7 @@ declare(strict_types=1); use Yiisoft\ActiveRecord\ActiveRecordFactory; use Yiisoft\Db\Connection\ConnectionInterface; use Yiisoft\Db\Sqlite\Connection as SqliteConnection; +use Yiisoft\Db\Sqlite\Driver; use Yiisoft\Definitions\Reference; /** @@ -154,8 +156,8 @@ return [ SqliteConnection::class => [ 'class' => SqliteConnection::class, '__construct()' => [ - 'dsn' => $params['yiisoft/db-sqlite']['dsn'], - ] + 'driver' => new Driver($params['yiisoft/db-sqlite']['dsn']), + ], ], ActiveRecordFactory::class => [ From 1c85b9d69e227a7e54a82b6aade76c6129d810db Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Thu, 4 Jan 2024 11:32:40 -0300 Subject: [PATCH 09/24] Remove ActiveRecord testsuite from phpunit.xml.dist. --- phpunit.xml.dist | 3 --- 1 file changed, 3 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index dafbc9b93..b92f0e1b3 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -5,9 +5,6 @@ - - ./tests/Driver - ./tests/Driver/Mssql From 873ff90972f25fb9f45066d8f5f9b307532eef29 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Thu, 4 Jan 2024 11:37:03 -0300 Subject: [PATCH 10/24] Add docs for testing. --- README.md | 26 +++---------- docs/en/testing.md | 92 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 21 deletions(-) create mode 100644 docs/en/testing.md diff --git a/README.md b/README.md index 833a0d183..6b2214dcf 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ It is used in [Yii Framework] but is supposed to be usable separately. [![Latest Stable Version](https://poser.pugx.org/yiisoft/active-record/v/stable.png)](https://packagist.org/packages/yiisoft/active-record) [![Total Downloads](https://poser.pugx.org/yiisoft/active-record/downloads.png)](https://packagist.org/packages/yiisoft/active-record) -[![build](https://github.com/yiisoft/active-record/actions/workflows/build.yml/badge.svg?branch=dev)](https://github.com/yiisoft/active-record/actions/workflows/build.yml) [![codecov](https://codecov.io/gh/yiisoft/active-record/branch/master/graph/badge.svg?token=w4KarhYyEF)](https://codecov.io/gh/yiisoft/active-record) [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Factive-record%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/active-record/master) [![static analysis](https://github.com/yiisoft/active-record/actions/workflows/static.yml/badge.svg?branch=dev)](https://github.com/yiisoft/active-record/actions/workflows/static.yml) @@ -237,29 +236,14 @@ final class Register } ``` -### Unit testing +## Support -The package is tested with [PHPUnit](https://phpunit.de/). To run tests: +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/phpunit -``` - -### Mutation testing - -The package tests are checked with [Infection](https://infection.github.io/) mutation framework. To run it: - -```shell -./vendor/bin/infection -``` - -### Static analysis +## Testing -The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis: - -```shell -./vendor/bin/psalm -``` +[Check the testing instructions](/docs/en/testing.md) to learn about testing. ### Support the project diff --git a/docs/en/testing.md b/docs/en/testing.md new file mode 100644 index 000000000..99774a57d --- /dev/null +++ b/docs/en/testing.md @@ -0,0 +1,92 @@ +# 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 + +## 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 +``` From 52b1d3d2896018f40e4309d82d1fabe5b73a48ab Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Thu, 4 Jan 2024 11:42:58 -0300 Subject: [PATCH 11/24] Fix testing.md. --- docs/en/testing.md | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/docs/en/testing.md b/docs/en/testing.md index 99774a57d..11ed44eec 100644 --- a/docs/en/testing.md +++ b/docs/en/testing.md @@ -38,9 +38,15 @@ The package is tested with [PHPUnit](https://phpunit.de/). 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. +1. Install all dbms dependencies with composer. + +```shell +composer require --dev yiisoft/db-mssql yiisoft/db-mysql yiisoft/db-oracle yiisoft/db-pgsql yiisoft/db-sqlite --ansi +``` + +2. Run all Docker containers for each dbms. +3. Install the dependencies of the project with composer. +4. Run the tests. ```shell vendor/bin/phpunit @@ -50,9 +56,15 @@ vendor/bin/phpunit 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. +1. Install dbms dependencies with composer. + +```shell +composer require --dev yiisoft/db-pgsql --ansi +``` + +2. Run the Docker container for the dbms you want to test. +3. Install the dependencies of the project with composer. +4. Run the tests. ```shell vendor/bin/phpunit --testsuite=Pgsql From e018622949511fa8f776ff1d0a56da7a34c44ae4 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Thu, 4 Jan 2024 11:45:34 -0300 Subject: [PATCH 12/24] Refactor testing instructions. --- docs/en/testing.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/en/testing.md b/docs/en/testing.md index 11ed44eec..347a5203c 100644 --- a/docs/en/testing.md +++ b/docs/en/testing.md @@ -45,8 +45,7 @@ composer require --dev yiisoft/db-mssql yiisoft/db-mysql yiisoft/db-oracle yiiso ``` 2. Run all Docker containers for each dbms. -3. Install the dependencies of the project with composer. -4. Run the tests. +3. Run the tests. ```shell vendor/bin/phpunit @@ -63,8 +62,7 @@ composer require --dev yiisoft/db-pgsql --ansi ``` 2. Run the Docker container for the dbms you want to test. -3. Install the dependencies of the project with composer. -4. Run the tests. +3. Run the tests. ```shell vendor/bin/phpunit --testsuite=Pgsql From 83cd3be93893aa9667d00005b4a4c8e8fdd92d80 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Thu, 4 Jan 2024 18:29:43 -0300 Subject: [PATCH 13/24] Update README.md. --- README.md | 90 ++++++------------------------------------------------- 1 file changed, 9 insertions(+), 81 deletions(-) diff --git a/README.md b/README.md index 6b2214dcf..77abd3681 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,10 @@ composer require yiisoft/active-record Example: ```php -composer require yiisoft/db-mysql +composer require yiisoft/db-sqlite ``` -## Configuration container di autowired +## Config container interface class web.php: ```php @@ -54,7 +54,7 @@ web.php: declare(strict_types=1); use Yiisoft\Db\Connection\ConnectionInterface; -use Yiisoft\Db\Sqlite\Connection as SqliteConnection; +use Yiisoft\Db\Sqlite\Connection; use Yiisoft\Db\Sqlite\Driver; /** @@ -62,7 +62,7 @@ use Yiisoft\Db\Sqlite\Driver; */ return [ ConnectionInterface::class => [ - 'class' => SqliteConnection::class, + 'class' => Connection::class, '__construct()' => [ 'driver' => new Driver($params['yiisoft/db-sqlite']['dsn']), ], @@ -83,7 +83,8 @@ return [ ] ``` -defined your active record, example User.php: +## Defined your active record class + ```php [ - 'class' => SqliteConnection::class, - '__construct()' => [ - 'driver' => new Driver($params['yiisoft/db-sqlite']['dsn']), - ], - ], - - ActiveRecordFactory::class => [ - 'class' => ActiveRecordFactory::class, - '__construct()' => [ - null, - [ConnectionInterface::class => Reference::to(SqliteConnection::class)], - ] - ] -]; -``` - -params.php -```php - [ - 'dsn' => 'sqlite:' . dirname(__DIR__) . '/runtime/yiitest.sq3', - ] -] -``` - -defined your active record, example User.php: -```php - Date: Fri, 5 Jan 2024 07:52:51 -0300 Subject: [PATCH 14/24] Update README.md Co-authored-by: Alexander Makarov --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 77abd3681..c46246cfe 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ final class User extends ActiveRecord } ``` -## Usage in controler with di container autowired +## Usage in controler with DI container autowiring ```php Date: Fri, 5 Jan 2024 07:53:02 -0300 Subject: [PATCH 15/24] Update README.md Co-authored-by: Alexander Makarov --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c46246cfe..c5ca2d965 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ final class Register } ``` -## Usage in controler with active record factory +## Usage in controler with Active Record factory ```php Date: Fri, 5 Jan 2024 07:53:13 -0300 Subject: [PATCH 16/24] Update docs/en/testing.md Co-authored-by: Alexander Makarov --- docs/en/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/testing.md b/docs/en/testing.md index 347a5203c..6fec84b37 100644 --- a/docs/en/testing.md +++ b/docs/en/testing.md @@ -8,7 +8,7 @@ This package can be tested globally or individually for each DBMS. - [PostgreSQL](https://github.com/yiisoft/db-pgsql) - [SQLite](https://github.com/yiisoft/db-sqlite) -## Github actions +## 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. From cc98b682176a6ce3e3738f206e59f9c867144710 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Fri, 5 Jan 2024 07:53:23 -0300 Subject: [PATCH 17/24] Update docs/en/testing.md Co-authored-by: Alexander Makarov --- docs/en/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/testing.md b/docs/en/testing.md index 6fec84b37..57b5d181c 100644 --- a/docs/en/testing.md +++ b/docs/en/testing.md @@ -10,7 +10,7 @@ This package can be tested globally or individually for each DBMS. ## 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. +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. From 7284f1bdf51babf35ca0cd1a6c1548199ed12eef Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Fri, 5 Jan 2024 07:53:38 -0300 Subject: [PATCH 18/24] Update docs/en/testing.md Co-authored-by: Alexander Makarov --- docs/en/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/testing.md b/docs/en/testing.md index 57b5d181c..800ae372e 100644 --- a/docs/en/testing.md +++ b/docs/en/testing.md @@ -16,7 +16,7 @@ All our packages have GitHub actions by default, so you can test your [contribut ## 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. +For greater ease we recommend to use Docker container for each DBMS. For this you can use the [docker-compose.yml](https://docs.docker.com/compose/compose-file/) file that's 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) From 7b5f2df7323947c8c3dd8c1adaaa21242ed5729e Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Fri, 5 Jan 2024 07:53:57 -0300 Subject: [PATCH 19/24] Update docs/en/testing.md Co-authored-by: Alexander Makarov --- docs/en/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/testing.md b/docs/en/testing.md index 800ae372e..a908bc7a8 100644 --- a/docs/en/testing.md +++ b/docs/en/testing.md @@ -24,7 +24,7 @@ For greater ease we recommend to use Docker container for each DBMS. For this yo - [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: +To run Docker containers you can use the following command: ```shell docker compose up -d From 0275cd020ae98025d5812d52e573a478c4fc0fdc Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Fri, 5 Jan 2024 07:54:09 -0300 Subject: [PATCH 20/24] Update docs/en/testing.md Co-authored-by: Alexander Makarov --- docs/en/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/testing.md b/docs/en/testing.md index a908bc7a8..8e302af1f 100644 --- a/docs/en/testing.md +++ b/docs/en/testing.md @@ -36,7 +36,7 @@ The package is tested with [PHPUnit](https://phpunit.de/). ### Global testing -The following steps are required to run the tests. +The following steps are required to run tests. 1. Install all dbms dependencies with composer. From 1b53d701181ecd5e12bbd549d2ea28dfcf2e3ccd Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Fri, 5 Jan 2024 07:54:18 -0300 Subject: [PATCH 21/24] Update docs/en/testing.md Co-authored-by: Alexander Makarov --- docs/en/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/testing.md b/docs/en/testing.md index 8e302af1f..e1b0bf97b 100644 --- a/docs/en/testing.md +++ b/docs/en/testing.md @@ -38,7 +38,7 @@ The package is tested with [PHPUnit](https://phpunit.de/). The following steps are required to run tests. -1. Install all dbms dependencies with composer. +1. Install all DBMS dependencies with composer. ```shell composer require --dev yiisoft/db-mssql yiisoft/db-mysql yiisoft/db-oracle yiisoft/db-pgsql yiisoft/db-sqlite --ansi From 220d588a992d7b3cb657b4e5f14551c3f45fc78c Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Fri, 5 Jan 2024 07:54:27 -0300 Subject: [PATCH 22/24] Update docs/en/testing.md Co-authored-by: Alexander Makarov --- docs/en/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/testing.md b/docs/en/testing.md index e1b0bf97b..d3b5e9c8e 100644 --- a/docs/en/testing.md +++ b/docs/en/testing.md @@ -44,7 +44,7 @@ The following steps are required to run tests. composer require --dev yiisoft/db-mssql yiisoft/db-mysql yiisoft/db-oracle yiisoft/db-pgsql yiisoft/db-sqlite --ansi ``` -2. Run all Docker containers for each dbms. +2. Run all Docker containers for each DBMS. 3. Run the tests. ```shell From de97975d32db655bf7eb75b6d71d89e3f32f5526 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Fri, 5 Jan 2024 07:54:35 -0300 Subject: [PATCH 23/24] Update docs/en/testing.md Co-authored-by: Alexander Makarov --- docs/en/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/testing.md b/docs/en/testing.md index d3b5e9c8e..5c825a666 100644 --- a/docs/en/testing.md +++ b/docs/en/testing.md @@ -55,7 +55,7 @@ vendor/bin/phpunit The following steps are required to run the tests. -1. Install dbms dependencies with composer. +1. Install DBMS dependencies with Composer. ```shell composer require --dev yiisoft/db-pgsql --ansi From f9d31b566c45561f1bb5186932a6bd2e851f5523 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Fri, 5 Jan 2024 07:54:45 -0300 Subject: [PATCH 24/24] Update docs/en/testing.md Co-authored-by: Alexander Makarov --- docs/en/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/testing.md b/docs/en/testing.md index 5c825a666..602bc8012 100644 --- a/docs/en/testing.md +++ b/docs/en/testing.md @@ -61,7 +61,7 @@ The following steps are required to run the tests. composer require --dev yiisoft/db-pgsql --ansi ``` -2. Run the Docker container for the dbms you want to test. +2. Run the Docker container for the DBMS you want to test. 3. Run the tests. ```shell