Skip to content

Commit

Permalink
Add DbHelper::class. (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed May 3, 2023
1 parent cc1d47d commit 789d6d0
Show file tree
Hide file tree
Showing 42 changed files with 1,404 additions and 729 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/composer-require-checker.yml
@@ -0,0 +1,33 @@
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'
- 'psalm.xml'

push:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'
- 'psalm.xml'

name: Composer require checker

jobs:
composer-require-checker:
uses: yiisoft/actions/.github/workflows/composer-require-checker.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.0', '8.1', '8.2']
27 changes: 12 additions & 15 deletions .github/workflows/db-mssql.yml → .github/workflows/mssql.yml
Expand Up @@ -19,7 +19,7 @@ on:
- 'infection.json.dist'
- 'psalm.xml'

name: db-mssql
name: mssql

jobs:
tests:
Expand All @@ -41,20 +41,19 @@ jobs:
- 8.2

mssql:
- server:2017-latest
- server:2019-latest
- server:2022-latest

services:
mssql:
image: mcr.microsoft.com/mssql/${{ matrix.mssql }}
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
image: mcr.microsoft.com/mssql/${{ matrix.mssql }}
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

steps:
- name: Checkout.
Expand All @@ -71,17 +70,15 @@ jobs:
ini-values: date.timezone='UTC'
coverage: pcov
tools: composer:v2, pecl
env:
update: true

- name: Update composer.
run: composer self-update

- name: Install db-mssql.
run: composer require yiisoft/db-mssql --no-interaction --no-progress --optimize-autoloader --ansi
run: composer require yiisoft/db-mssql --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

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

- name: Upload coverage to Codecov.
if: matrix.php == '8.1'
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/mutation.yml
Expand Up @@ -24,7 +24,7 @@ jobs:
name: PHP ${{ matrix.php }}-${{ matrix.os }}

env:
extensions: json, pdo, pdo_mysql
extensions: pdo, pdo_pgsql

runs-on: ${{ matrix.os }}

Expand All @@ -34,10 +34,20 @@ jobs:
- ubuntu-latest

php:
- 8.0
- 8.1
- 8.2

services:
postgres:
image: postgres:15
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: yiitest
ports:
- 5432:5432
options: --name=postgres --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Checkout.
uses: actions/checkout@v3
Expand All @@ -54,11 +64,11 @@ jobs:
- name: Update composer.
run: composer self-update

- name: Install db-sqlite.
run: composer require yiisoft/db-sqlite --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 -j2 --ignore-msi-with-no-mutations --only-covered --test-framework-options="--testsuite=Sqlite"
vendor/bin/roave-infection-static-analysis-plugin -j2 --ignore-msi-with-no-mutations --only-covered --test-framework-options="--testsuite=Pgsql"
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
Expand Up @@ -19,7 +19,7 @@ on:
- 'infection.json.dist'
- 'psalm.xml'

name: db-mysql
name: mysql

jobs:
tests:
Expand Down Expand Up @@ -73,15 +73,16 @@ jobs:
extensions: ${{ env.extensions }}
ini-values: date.timezone='UTC'
coverage: pcov
tools: composer:v2

- name: Update composer.
run: composer self-update

- name: Install db-mysql.
run: composer require yiisoft/db-mysql --no-interaction --no-progress --optimize-autoloader --ansi
run: composer require yiisoft/db-mysql --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

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

- name: Upload coverage to Codecov.
if: matrix.php == '8.1'
Expand Down
89 changes: 89 additions & 0 deletions .github/workflows/oracle.yml
@@ -0,0 +1,89 @@
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'

push:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'

name: oracle

jobs:
tests:
name: PHP ${{ matrix.php }}-oracle-${{ matrix.oracle }}

env:
extensions: pdo, pdo_oci, oci8

runs-on: ${{ matrix.os }}

strategy:
matrix:
os:
- ubuntu-latest

php:
- 8.0
- 8.1
- 8.2

oracle:
- 18
- 21

services:
oci:
image: gvenzl/oracle-xe:${{ matrix.oracle }}
ports:
- 1521:1521
env:
ORACLE_DATABASE : yiitest
ORACLE_PASSWORD : root
options: >-
--name=oci
--health-cmd healthcheck.sh
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- name: Checkout.
uses: actions/checkout@v3

- name: Install PHP with extensions.
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions }}
ini-values: date.timezone='UTC'
coverage: pcov
tools: composer:v2

- name: Update composer.
run: composer self-update

- name: Install db-oracle.
run: composer require yiisoft/db-oracle --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Run tests with phpunit.
run: vendor/bin/phpunit --testsuite=Oracle --coverage-clover=coverage.xml --colors=always

- name: Upload coverage to Codecov.
if: matrix.php == '8.1'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
Expand Up @@ -19,7 +19,7 @@ on:
- 'infection.json.dist'
- 'psalm.xml'

name: db-pgsql
name: pgsql

jobs:
tests:
Expand Down Expand Up @@ -71,15 +71,16 @@ jobs:
extensions: ${{ env.extensions }}
ini-values: date.timezone='UTC'
coverage: pcov
tools: composer:v2

- name: Update composer.
run: composer self-update

- name: Install db-pgsql.
run: composer require yiisoft/db-pgsql --no-interaction --no-progress --optimize-autoloader --ansi
run: composer require yiisoft/db-pgsql --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

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

- name: Upload coverage to Codecov.
if: matrix.php == '8.1'
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/rector.yml
@@ -0,0 +1,21 @@
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'

name: rector

jobs:
rector:
uses: yiisoft/actions/.github/workflows/rector.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.0']
20 changes: 10 additions & 10 deletions .github/workflows/db-sqlite.yml → .github/workflows/sqlite.yml
Expand Up @@ -19,15 +19,14 @@ on:
- 'infection.json.dist'
- 'psalm.xml'

name: db-sqlite
name: sqlite

jobs:
tests:
name: PHP ${{ matrix.php }}-${{ matrix.os }}

env:
extensions: pdo, pdo_sqlite
key: cache-v1

runs-on: ${{ matrix.os }}

Expand All @@ -43,10 +42,10 @@ jobs:
- 8.2

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout.
uses: actions/checkout@v2

- name: Install PHP with extensions
- name: Install PHP with extensions.
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
Expand All @@ -55,16 +54,17 @@ jobs:
coverage: pcov
tools: composer:v2

- name: Update composer
- name: Update composer.
run: composer self-update

- name: Install db-sqlite.
run: composer require yiisoft/db-sqlite --no-interaction --no-progress --optimize-autoloader --ansi
run: composer require yiisoft/db-sqlite --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Run tests with phpunit
run: vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always --testsuite=Sqlite
- name: Run tests with phpunit.
run: vendor/bin/phpunit --testsuite=Sqlite --coverage-clover=coverage.xml --colors=always

- name: Upload coverage to Codecov
- name: Upload coverage to Codecov.
if: matrix.php == '8.1'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
9 changes: 4 additions & 5 deletions composer.json
Expand Up @@ -29,13 +29,12 @@
"yiisoft/translator": "^2.2"
},
"require-dev": {
"phpunit/phpunit": "^9.6|^10.0",
"maglnet/composer-require-checker": "^4.2",
"phpunit/phpunit": "^9.6|^10.1",
"rector/rector": "^0.15.20",
"roave/infection-static-analysis-plugin": "^1.25|^1.29",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.8|^5.8",
"yiisoft/di": "^1.0",
"yiisoft/psr-dummy-provider": "^1.0",
"yiisoft/yii-db-migration": "dev-better-naming-classes as 1.0.x-dev"
"vimeo/psalm": "^4.8|^5.8"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 789d6d0

Please sign in to comment.