Skip to content

Commit d2fc64f

Browse files
Remove src\TestSupport\TestCommandTrait::class from yiisoft/db. (#398)
* Remove src\TestSupport\TestCommandTrait::class from yiisoft/db.
1 parent 37e4839 commit d2fc64f

31 files changed

Lines changed: 3377 additions & 2448 deletions

.github/workflows/db-mssql.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727

2828
env:
2929
COMPOSER_ROOT_VERSION: dev-master
30-
composer_flag: "${{ matrix.php == '8.2' && '--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi --ignore-platform-reqs' || '--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi' }}"
3130
extensions: pdo, pdo_sqlsrv-5.10.1
3231

3332
runs-on: ${{ matrix.os }}
@@ -45,6 +44,7 @@ jobs:
4544
mssql:
4645
- server:2017-latest
4746
- server:2019-latest
47+
- server:2022-latest
4848

4949
services:
5050
mssql:
@@ -58,13 +58,13 @@ jobs:
5858
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
5959

6060
steps:
61-
- name: Checkout
61+
- name: Checkout.
6262
uses: actions/checkout@v3
6363

64-
- name: Create MS SQL Database
64+
- name: Create MS SQL Database.
6565
run: docker exec -i mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'CREATE DATABASE yiitest'
6666

67-
- name: Install PHP with extensions
67+
- name: Install PHP with extensions.
6868
uses: shivammathur/setup-php@v2
6969
with:
7070
php-version: ${{ matrix.php }}
@@ -75,16 +75,16 @@ jobs:
7575
env:
7676
update: true
7777

78-
- name: Update composer
78+
- name: Update composer.
7979
run: composer self-update
8080

81-
- name: Install db-mssql
82-
run: composer require yiisoft/db-mssql ${{ env.composer_flag }}
81+
- name: Install db-mssql.
82+
run: composer config preferred-install.yiisoft/db-mssql source && composer require yiisoft/db-mssql --no-interaction --no-progress --optimize-autoloader --ansi
8383

84-
- name: Run mssql tests with phpunit
84+
- name: Run mssql tests with phpunit and code coverage.
8585
run: vendor/bin/phpunit --testsuite Mssql --coverage-clover=coverage.xml --colors=always
8686

87-
- name: Upload coverage to Codecov
87+
- name: Upload coverage to Codecov.
8888
if: matrix.php == '8.0'
8989
uses: codecov/codecov-action@v3
9090
with:

.github/workflows/db-mysql.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727

2828
env:
2929
COMPOSER_ROOT_VERSION: dev-master
30-
composer_flag: "${{ matrix.php == '8.2' && '--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi --ignore-platform-reqs' || '--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi' }}"
3130
extensions: pdo, pdo_mysql
3231

3332
runs-on: ${{ matrix.os }}
@@ -58,27 +57,27 @@ jobs:
5857
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
5958

6059
steps:
61-
- name: Checkout
60+
- name: Checkout.
6261
uses: actions/checkout@v3
6362

64-
- name: Install PHP with extensions
63+
- name: Install PHP with extensions.
6564
uses: shivammathur/setup-php@v2
6665
with:
6766
php-version: ${{ matrix.php }}
6867
extensions: ${{ env.extensions }}
6968
ini-values: date.timezone='UTC'
7069
coverage: pcov
7170

72-
- name: Update composer
71+
- name: Update composer.
7372
run: composer self-update
7473

75-
- name: Install db-mysql
76-
run: composer require yiisoft/db-mysql ${{ env.composer_flag }}
74+
- name: Install db-mysql.
75+
run: composer config preferred-install.yiisoft/db-mysql source && composer require yiisoft/db-mysql --no-interaction --no-progress --optimize-autoloader --ansi
7776

78-
- name: Run tests with phpunit
77+
- name: Run Mssql tests with phpunit and code coverage.
7978
run: vendor/bin/phpunit --testsuite Mysql --coverage-clover=coverage.xml --colors=always
8079

81-
- name: Upload coverage to Codecov
80+
- name: Upload coverage to Codecov.
8281
if: matrix.php == '8.0'
8382
uses: codecov/codecov-action@v3
8483
with:

.github/workflows/db-oracle.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727

2828
env:
2929
COMPOSER_ROOT_VERSION: dev-master
30-
composer_flag: "${{ matrix.php == '8.2' && '--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi --ignore-platform-reqs' || '--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi' }}"
3130
extensions: pdo, pdo_oci
3231

3332
runs-on: ${{ matrix.os }}
@@ -53,10 +52,10 @@ jobs:
5352
options: --name=oci
5453

5554
steps:
56-
- name: Checkout
55+
- name: Checkout.
5756
uses: actions/checkout@v3
5857

59-
- name: Install PHP with extensions
58+
- name: Install PHP with extensions.
6059
uses: shivammathur/setup-php@v2
6160
with:
6261
php-version: ${{ matrix.php }}
@@ -65,16 +64,16 @@ jobs:
6564
coverage: pcov
6665
tools: composer:v2, pecl
6766

68-
- name: Update composer
67+
- name: Update composer.
6968
run: composer self-update
7069

71-
- name: Install db-oracle
72-
run: composer require yiisoft/db-oracle ${{ env.composer_flag }}
70+
- name: Install db-oracle.
71+
run: composer config preferred-install.yiisoft/db-oracle source && composer require yiisoft/db-oracle --no-interaction --no-progress --optimize-autoloader --ansi
7372

74-
- name: Run oracle tests with phpunit
73+
- name: Run oracle tests with phpunit and code coverage.
7574
run: vendor/bin/phpunit --testsuite Oracle --coverage-clover=coverage.xml --colors=always
7675

77-
- name: Upload coverage to Codecov
76+
- name: Upload coverage to Codecov.
7877
if: matrix.php == '8.0'
7978
uses: codecov/codecov-action@v3
8079
with:

.github/workflows/db-pgsql.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727

2828
env:
2929
COMPOSER_ROOT_VERSION: dev-master
30-
composer_flag: "${{ matrix.php == '8.2' && '--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi --ignore-platform-reqs' || '--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi' }}"
3130
extensions: pdo, pdo_pgsql
3231

3332
runs-on: ${{ matrix.os }}
@@ -62,27 +61,27 @@ jobs:
6261
options: --name=postgres --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
6362

6463
steps:
65-
- name: Checkout
64+
- name: Checkout.
6665
uses: actions/checkout@v3
6766

68-
- name: Install PHP with extensions
67+
- name: Install PHP with extensions.
6968
uses: shivammathur/setup-php@v2
7069
with:
7170
php-version: ${{ matrix.php }}
7271
extensions: ${{ env.extensions }}
7372
ini-values: date.timezone='UTC'
7473
coverage: pcov
7574

76-
- name: Update composer
75+
- name: Update composer.
7776
run: composer self-update
7877

79-
- name: Install db-pgsql
80-
run: composer require yiisoft/db-pgsql ${{ env.composer_flag }}
78+
- name: Install db-pgsql.
79+
run: composer config preferred-install.yiisoft/db-pgsql source && composer require yiisoft/db-pgsql --no-interaction --no-progress --optimize-autoloader --ansi
8180

82-
- name: Run pgsql tests with phpunit
81+
- name: Run pgsql tests with phpunit and code coverage.
8382
run: vendor/bin/phpunit --testsuite Pgsql --coverage-clover=coverage.xml --colors=always
8483

85-
- name: Upload coverage to Codecov
84+
- name: Upload coverage to Codecov.
8685
if: matrix.php == '8.0'
8786
uses: codecov/codecov-action@v3
8887
with:

.github/workflows/db-sqlite.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727

2828
env:
2929
COMPOSER_ROOT_VERSION: dev-master
30-
composer_flag: "${{ matrix.php == '8.2' && '--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi --ignore-platform-reqs' || '--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi' }}"
3130
extensions: pdo, pdo_sqlite
3231

3332
runs-on: ${{ matrix.os }}
@@ -44,10 +43,10 @@ jobs:
4443
- 8.2
4544

4645
steps:
47-
- name: Checkout
46+
- name: Checkout.
4847
uses: actions/checkout@v3
4948

50-
- name: Install PHP with extensions
49+
- name: Install PHP with extensions.
5150
uses: shivammathur/setup-php@v2
5251
with:
5352
php-version: ${{ matrix.php }}
@@ -56,16 +55,16 @@ jobs:
5655
coverage: pcov
5756
tools: composer:v2, pecl
5857

59-
- name: Update composer
58+
- name: Update composer.
6059
run: composer self-update
6160

62-
- name: Install db-sqlite
63-
run: composer require yiisoft/db-sqlite ${{ env.composer_flag }}
61+
- name: Install db-sqlite.
62+
run: composer config preferred-install.yiisoft/db-sqlite source && composer require yiisoft/db-sqlite --no-interaction --no-progress --optimize-autoloader --ansi
6463

65-
- name: Run sqlite tests with phpunit
64+
- name: Run sqlite tests with phpunit and code coverage.
6665
run: vendor/bin/phpunit --testsuite Sqlite --coverage-clover=coverage.xml --colors=always
6766

68-
- name: Upload coverage to Codecov
67+
- name: Upload coverage to Codecov.
6968
if: matrix.os == 'ubuntu-latest' && matrix.php == '8.0'
7069
uses: codecov/codecov-action@v3
7170
with:

.github/workflows/static.yml

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,45 +22,10 @@ on:
2222
name: static analysis
2323

2424
jobs:
25-
mutation:
26-
name: PHP ${{ matrix.php }}-${{ matrix.os }}
27-
28-
env:
29-
COMPOSER_ROOT_VERSION: dev-master
30-
composer_flag: "${{ matrix.php == '8.2' && '--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi --ignore-platform-reqs' || '--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi' }}"
31-
extensions: dom, json, libxml, mbstring, pdo, pdo_mysql, pdo_pgsql, pdo_sqlite, pdo_sqlsrv-5.10.1, tokenizer
32-
33-
runs-on: ${{ matrix.os }}
34-
35-
strategy:
36-
matrix:
37-
os:
38-
- ubuntu-latest
39-
40-
php:
41-
- 8.0
42-
- 8.1
43-
- 8.2
44-
45-
steps:
46-
- name: Checkout
47-
uses: actions/checkout@v3
48-
49-
- name: Install PHP
50-
uses: shivammathur/setup-php@v2
51-
with:
52-
php-version: "${{ matrix.php }}"
53-
extensions: ${{ env.extensions }}
54-
tools: composer:v2, cs2pr
55-
coverage: pcov
56-
env:
57-
update: true
58-
59-
- name: Update composer
60-
run: composer self-update
61-
62-
- name: Install dependencies with composer
63-
run: composer update ${{ env.composer_flag }}
64-
65-
- name: Static analysis with psalm
66-
run: vendor/bin/psalm --shepherd --stats --output-format=checkstyle | cs2pr --graceful-warnings --colorize
25+
psalm:
26+
uses: yiisoft/actions/.github/workflows/psalm.yml@master
27+
with:
28+
os: >-
29+
['ubuntu-latest']
30+
php: >-
31+
['8.0', '8.1', '8.2']

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ It is used in [Yii Framework] but is supposed to be usable separately.
1414
[![Latest Stable Version](https://poser.pugx.org/yiisoft/db/v/stable.png)](https://packagist.org/packages/yiisoft/db)
1515
[![Total Downloads](https://poser.pugx.org/yiisoft/db/downloads.png)](https://packagist.org/packages/yiisoft/db)
1616
[![Build status](https://github.com/yiisoft/db/workflows/build/badge.svg)](https://github.com/yiisoft/db/actions?query=workflow%3Abuild)
17-
[![codecov](https://codecov.io/gh/yiisoft/db/branch/dev/graph/badge.svg?token=pRr4gci2qj)](https://codecov.io/gh/yiisoft/db)
17+
[![codecov](https://codecov.io/gh/yiisoft/db/branch/master/graph/badge.svg?token=pRr4gci2qj)](https://codecov.io/gh/yiisoft/db)
1818
[![static analysis](https://github.com/yiisoft/db/actions/workflows/static.yml/badge.svg?branch=dev)](https://github.com/yiisoft/db/actions/workflows/static.yml)
1919
[![type-coverage](https://shepherd.dev/github/yiisoft/db/coverage.svg)](https://shepherd.dev/github/yiisoft/db)
2020

@@ -26,6 +26,14 @@ The package is tested with [PHPUnit](https://phpunit.de/). To run tests:
2626
./vendor/bin/phpunit
2727
```
2828

29+
### Mutation testing
30+
31+
The package tests are checked with [Infection](https://infection.github.io/) mutation framework. To run it:
32+
33+
```shell
34+
./vendor/bin/infection
35+
```
36+
2937
### Static analysis
3038

3139
The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:
@@ -34,6 +42,25 @@ The code is statically analyzed with [Psalm](https://psalm.dev/). To run static
3442
./vendor/bin/psalm
3543
```
3644

45+
### Rector
46+
47+
Use [Rector](https://github.com/rectorphp/rector) to make codebase follow some specific rules or
48+
use either newest or any specific version of PHP:
49+
50+
```shell
51+
./vendor/bin/rector
52+
```
53+
54+
### Composer require checker
55+
56+
This package uses [composer-require-checker](https://github.com/maglnet/ComposerRequireChecker) to check if all dependencies are correctly defined in `composer.json`.
57+
58+
To run the checker, execute the following command:
59+
60+
```shell
61+
./vendor/bin/composer-require-checker
62+
```
63+
3764
### Support the project
3865

3966
[![Open Collective](https://img.shields.io/badge/Open%20Collective-sponsor-7eadf1?logo=open%20collective&logoColor=7eadf1&labelColor=555555)](https://opencollective.com/yiisoft)

composer.dev.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"autoload-dev": {
3+
"psr-4": {
4+
"Yiisoft\\ActiveRecord\\Tests\\": "vendor/yiisoft/active-record/tests",
5+
"Yiisoft\\Db\\Mssql\\Tests\\": "vendor/yiisoft/db-mssql/tests",
6+
"Yiisoft\\Db\\Mysql\\Tests\\": "vendor/yiisoft/db-mysql/tests",
7+
"Yiisoft\\Db\\Oracle\\Tests\\": "vendor/yiisoft/db-oracle/tests",
8+
"Yiisoft\\Db\\Pgsql\\Tests\\": "vendor/yiisoft/db-pgsql/tests",
9+
"Yiisoft\\Db\\Sqlite\\Tests\\": "vendor/yiisoft/db-sqlite/tests"
10+
}
11+
}
12+
}

composer.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"roave/infection-static-analysis-plugin": "^1.16",
3737
"spatie/phpunit-watcher": "^1.23",
3838
"vimeo/psalm": "^4.18",
39+
"wikimedia/composer-merge-plugin": "^2.0",
3940
"yiisoft/aliases": "^1.1|^2.0",
4041
"yiisoft/di": "^1.0",
4142
"yiisoft/event-dispatcher": "^1.0",
@@ -48,25 +49,26 @@
4849
},
4950
"autoload-dev": {
5051
"psr-4": {
51-
"Yiisoft\\Db\\Tests\\": "tests",
52-
"Yiisoft\\ActiveRecord\\Tests\\": "vendor/yiisoft/active-record/tests",
53-
"Yiisoft\\Db\\Mssql\\Tests\\": "vendor/yiisoft/db-mssql/tests",
54-
"Yiisoft\\Db\\Mysql\\Tests\\": "vendor/yiisoft/db-mysql/tests",
55-
"Yiisoft\\Db\\Oracle\\Tests\\": "vendor/yiisoft/db-oracle/tests",
56-
"Yiisoft\\Db\\Pgsql\\Tests\\": "vendor/yiisoft/db-pgsql/tests",
57-
"Yiisoft\\Db\\Sqlite\\Tests\\": "vendor/yiisoft/db-sqlite/tests"
52+
"Yiisoft\\Db\\Tests\\": "tests"
5853
}
5954
},
6055
"extra": {
6156
"branch-alias": {
6257
"dev-master": "3.0.x-dev"
58+
},
59+
"merge-plugin": {
60+
"include": [
61+
"composer.dev.json"
62+
],
63+
"merge-dev": true
6364
}
6465
},
6566
"config": {
6667
"sort-packages": true,
6768
"allow-plugins": {
6869
"infection/extension-installer": true,
69-
"composer/package-versions-deprecated": true
70+
"composer/package-versions-deprecated": true,
71+
"wikimedia/composer-merge-plugin": true
7072
}
7173
},
7274
"scripts": {

0 commit comments

Comments
 (0)