Skip to content

Commit 5d563b3

Browse files
committed
Quality of life
1 parent 96353e5 commit 5d563b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3245
-1617
lines changed

.gitattributes

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
/.github export-ignore
12
/tests export-ignore
2-
phpunit.xml.dist export-ignore
3-
behat.yml export-ignore
43
.gitignore export-ignore
54
.gitattributes export-ignore
6-
composer.lock export-ignore
75
.scrutinizer.yml export-ignore
8-
.travis.yml export-ignore
6+
phpunit.xml.dist export-ignore
7+
behat.yml export-ignore
8+
composer.lock export-ignore
9+
phpcs.xml export-ignore
10+
psalm.xml export-ignore

.github/workflows/behat.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Integration Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
pull_request:
8+
- '*'
9+
10+
jobs:
11+
integrationtest:
12+
runs-on: ubuntu-latest
13+
14+
name: Behat
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Install PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: 8.1
23+
24+
- name: Cache Composer packages
25+
id: composer-cache
26+
uses: actions/cache@v2
27+
with:
28+
path: vendor
29+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
30+
restore-keys: |
31+
${{ runner.os }}-php-
32+
33+
- name: Install dependencies
34+
run: composer install --prefer-dist --no-progress
35+
36+
- name: Run test suite
37+
run: ./vendor/bin/behat

.github/workflows/static.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Static Code Analysis
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
psalm:
7+
name: Psalm
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v2
12+
13+
- name: Psalm
14+
uses: docker://vimeo/psalm-github-actions
15+
with:
16+
security_analysis: true
17+
report_file: results.sarif
18+
composer_ignore_platform_reqs: true
19+
20+
- name: Upload Security Analysis results to GitHub
21+
uses: github/codeql-action/upload-sarif@v1
22+
with:
23+
sarif_file: results.sarif
24+
25+
# we may use whatever way to install phpcs, just specify the path on the next step
26+
# however, curl seems to be the fastest
27+
- name: Install PHP_CodeSniffer
28+
run: |
29+
curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
30+
php phpcs.phar --version
31+
- uses: tinovyatkin/action-php-codesniffer@v1
32+
with:
33+
files: "**.php" # you may customize glob as needed
34+
phpcs_path: php phpcs.phar
35+
standard: phpcs.xml
36+

.github/workflows/unit.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Unit Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
pull_request:
8+
- '*'
9+
10+
jobs:
11+
unittest:
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
php:
17+
- version: 7.4
18+
coverage: false
19+
- version: 8.0
20+
coverage: true
21+
- version: 8.1
22+
coverage: false
23+
prefer-lowest: ['', '--prefer-lowest']
24+
25+
name: Unit Tests - PHP ${{ matrix.php.version }} ${{ matrix.prefer-lowest }}
26+
27+
steps:
28+
- uses: actions/checkout@v2
29+
30+
- name: Install PHP
31+
uses: shivammathur/setup-php@v2
32+
with:
33+
php-version: ${{ matrix.php.version }}
34+
extensions: mbstring
35+
36+
- name: Validate composer.json and composer.lock
37+
run: composer validate --strict
38+
39+
- name: Cache Composer packages
40+
id: composer-cache
41+
uses: actions/cache@v2
42+
with:
43+
path: vendor
44+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
45+
restore-keys: |
46+
${{ runner.os }}-php-
47+
48+
- name: Update dependencies
49+
run: composer update --prefer-dist --no-progress --with-all-dependencies ${{ matrix.prefer-lowest }}
50+
51+
- name: Run test suite
52+
if: ${{ ! matrix.php.coverage }}
53+
run: ./vendor/bin/phpunit --verbose
54+
55+
- name: Run test suite with code coverage
56+
if: ${{ matrix.php.coverage }}
57+
run: ./vendor/bin/phpunit --verbose --coverage-clover=build/logs/clover.xml
58+
env:
59+
XDEBUG_MODE: coverage
60+
61+
- name: Upload code coverage to Scrutinizer
62+
if: ${{ matrix.php.coverage }}
63+
run: |
64+
wget -q https://scrutinizer-ci.com/ocular.phar
65+
php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml || true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
/tests/logs/*
33
!/tests/logs/.gitkeep
44
.phpunit.result.cache
5+
.phpcs-cache
6+
phpunit.xml

.scrutinizer.yml

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
11
imports:
22
- php
33

4+
build:
5+
environment:
6+
php: 8.0.0
7+
nodes:
8+
analysis:
9+
project_setup:
10+
override:
11+
- 'true'
12+
tests:
13+
override:
14+
- php-scrutinizer-run
15+
-
16+
command: phpcs-run
17+
418
filter:
5-
paths:
6-
- src/*
19+
excluded_paths:
20+
- 'tests/*'
21+
- 'bin/*'
722

823
checks:
924
php: true
1025

26+
coding_style:
27+
php:
28+
spaces:
29+
around_operators:
30+
concatenation: true
31+
1132
tools:
12-
php_code_sniffer:
13-
config:
14-
standard: PSR2
15-
php_sim: true
16-
php_cpd: false
17-
php_loc: true
18-
php_hhvm: true
19-
php_mess_detector: true
20-
php_pdepend: true
21-
php_analyzer: false
22-
sensiolabs_security_checker: true
23-
php_changetracking: true
33+
php_cs_fixer: false
2434
external_code_coverage:
25-
runs: 1
26-
timeout: 600
35+
timeout: 300

.travis.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

LICENSE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
Simplified BSD License
22
======================
33

4-
Copyright 2015 Fabian Grutschus.
4+
Copyright 2015-2022 Fabian Grutschus.
55
All rights reserved.
66

77
Redistribution and use in source and binary forms, with or without modification,
88
are permitted provided that the following conditions are met:
99

1010
1. Redistributions of source code must retain the above copyright notice, this
11-
list of conditions and the following disclaimer.
11+
list of conditions and the following disclaimer.
1212

1313
2. Redistributions in binary form must reproduce the above copyright notice,
1414
this list of conditions and the following disclaimer in the documentation
15-
and/or other materials provided with the distribution.
15+
and/or other materials provided with the distribution.
1616

1717
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1818
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ This is useful if you use foreign entities, which you can't change, but you like
77
to add own relations between them and your entities.
88

99
[![Latest Stable Version](https://poser.pugx.org/fabiang/doctrine-dynamic/version)](https://packagist.org/packages/fabiang/doctrine-dynamic)
10-
[![License](https://poser.pugx.org/fabiang/doctrine-dynamic/license)](https://packagist.org/packages/fabiang/doctrine-dynamic)
11-
[![Build Status](https://travis-ci.com/fabiang/doctrine-dynamic.svg?branch=master)](https://travis-ci.com/fabiang/doctrine-dynamic)
12-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/?branch=master)
13-
[![Code Coverage](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/?branch=master)
10+
[![License](https://poser.pugx.org/fabiang/doctrine-dynamic/license)](https://packagist.org/packages/fabiang/doctrine-dynamic)
11+
[![Unit Tests](https://github.com/fabiang/doctrine-dynamic/actions/workflows/unit.yml/badge.svg)](https://github.com/fabiang/doctrine-dynamic/actions/workflows/unit.yml)
12+
[![Integration Tests](https://github.com/fabiang/doctrine-dynamic/actions/workflows/behat.yml/badge.svg)](https://github.com/fabiang/doctrine-dynamic/actions/workflows/behat.yml)
13+
[![Static Code Analysis](https://github.com/fabiang/doctrine-dynamic/actions/workflows/static.yml/badge.svg)](https://github.com/fabiang/doctrine-dynamic/actions/workflows/static.yml)
14+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/?branch=main)
15+
[![Code Coverage](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/badges/coverage.png?b=main)](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/?branch=main)
1416

1517
## Features
1618

@@ -31,7 +33,7 @@ $ composer require fabiang/doctrine-dynamic
3133

3234
## Framework integration
3335

34-
* [Laminas (also Zend Framework 2 & 3)](https://github.com/fabiang/doctrine-dynamic-laminas)
36+
* [Laminas](https://github.com/fabiang/doctrine-dynamic-laminas)
3537

3638
## Usage
3739

composer.json

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,40 @@
2323
},
2424
"minimum-stability": "stable",
2525
"require": {
26-
"php": "^7.4 || ^8.0",
26+
"php": "^7.4 || ~8.0.0 || ~8.1.0",
2727
"doctrine/common": "^3.0",
2828
"doctrine/orm": "^2.5",
29+
"doctrine/persistence": "^3.0",
2930
"laminas/laminas-hydrator": "^3.0 || ^4.0",
3031
"laminas/laminas-stdlib": "^3.0"
3132
},
3233
"require-dev": {
3334
"behat/behat": "^3.8",
34-
"dms/phpunit-arraysubset-asserts": "^0.2.1",
35+
"dms/phpunit-arraysubset-asserts": "^0.4.0",
3536
"phpspec/prophecy-phpunit": "^2.0",
3637
"phpunit/php-invoker": "^3.1",
37-
"phpunit/phpunit": "^9.5"
38+
"phpunit/phpunit": "^9.5",
39+
"symfony/cache": "^5.4 || ^6.0",
40+
"doctrine/annotations": "^1.13",
41+
"laminas/laminas-coding-standard": "^2.3",
42+
"vimeo/psalm": "^4.23"
43+
},
44+
"config": {
45+
"sort-packages": true,
46+
"allow-plugins": {
47+
"dealerdirect/phpcodesniffer-composer-installer": true
48+
}
49+
},
50+
"scripts": {
51+
"phpcs": "phpcs",
52+
"psalm": "psalm --no-cache",
53+
"phpunit": "phpunit",
54+
"behat": "behat",
55+
"test": [
56+
"@phpcs",
57+
"@psalm",
58+
"@phpunit",
59+
"@behat"
60+
]
3861
}
3962
}

0 commit comments

Comments
 (0)