Skip to content

Commit 3d8284e

Browse files
sanmaikeradus
authored andcommitted
Prep work to migrate to PHPUnit 9.x
1 parent d333104 commit 3d8284e

File tree

76 files changed

+334
-297
lines changed

Some content is hidden

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

76 files changed

+334
-297
lines changed

.appveyor.yml

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

.circleci/config.yml

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

.composer-require-checker.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"PHPUnit\\Framework\\Constraint\\IsIdentical",
77
"PHPUnit\\Framework\\TestCase",
88
"PHPUnit\\Runner\\Version",
9+
"PHPUnitGoodPractices\\Polyfill\\PolyfillTrait",
910
"PHPUnitGoodPractices\\Traits\\ExpectationViaCodeOverAnnotationTrait",
1011
"PHPUnitGoodPractices\\Traits\\ExpectOverSetExceptionTrait",
1112
"PHPUnitGoodPractices\\Traits\\IdentityOverEqualityTrait",

.github/workflows/ci.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: CI
2+
3+
on:
4+
- pull_request
5+
- push
6+
7+
jobs:
8+
tests:
9+
strategy:
10+
matrix:
11+
include:
12+
- operating-system: 'ubuntu-20.04'
13+
php-version: '5.6'
14+
composer-flags: '--prefer-stable --prefer-lowest' # should be checked on lowest supported PHP version
15+
16+
- operating-system: 'ubuntu-20.04'
17+
php-version: '7.0'
18+
job-description: 'with Sf ^3'
19+
execute-flex-with-symfony-version: '^3' # Explicit check for Sf 3.x compatibility
20+
21+
- operating-system: 'ubuntu-20.04'
22+
php-version: '7.1'
23+
job-description: 'with Sf ^4'
24+
execute-flex-with-symfony-version: '^4' # Explicit check for Sf 4.x compatibility
25+
26+
- operating-system: 'ubuntu-20.04'
27+
php-version: '7.2'
28+
job-description: 'with Sf ^5'
29+
execute-flex-with-symfony-version: '^5' # Explicit check for Sf 5.x compatibility
30+
31+
- operating-system: 'ubuntu-20.04'
32+
php-version: '7.3'
33+
job-description: 'with legacy Tokenizer' # should be checked on any job, one is enough
34+
PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER: 1
35+
SYMFONY_DEPRECATIONS_HELPER: 'disabled'
36+
37+
- operating-system: 'ubuntu-20.04'
38+
php-version: '7.4'
39+
job-description: 'with migration rules'
40+
execute-migration-rules: 'yes' # should be checked on highest supported PHP version
41+
42+
- operating-system: 'ubuntu-20.04'
43+
php-version: '8.0'
44+
composer-flags: '--ignore-platform-req=php' # as this is a version not yet officially supported by PHP CS Fixer
45+
PHP_CS_FIXER_IGNORE_ENV: 1
46+
47+
- operating-system: 'windows-latest'
48+
php-version: '7.4'
49+
job-description: 'on Windows'
50+
FAST_LINT_TEST_CASES: 1
51+
52+
- operating-system: 'macos-latest'
53+
php-version: '7.4'
54+
job-description: 'on macOS'
55+
56+
name: PHP ${{ matrix.php-version }} ${{ matrix.job-description }}
57+
58+
runs-on: ${{ matrix.operating-system }}
59+
60+
steps:
61+
- name: Checkout code
62+
uses: actions/checkout@v2
63+
64+
- name: Setup PHP
65+
uses: shivammathur/setup-php@v2
66+
with:
67+
php-version: ${{ matrix.php-version }}
68+
coverage: none
69+
tools: flex
70+
env:
71+
fail-fast: false # disabled as old PHP version cannot run flex
72+
73+
- name: Get Composer cache directory
74+
id: composer-cache
75+
run: echo "::set-output name=dir::$(composer config cache-dir)"
76+
77+
- name: Cache dependencies
78+
uses: actions/cache@v2
79+
with:
80+
path: ${{ steps.composer-cache.outputs.dir }}
81+
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}-${{ matrix.composer-flags }}
82+
restore-keys: |
83+
composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}-
84+
composer-${{ runner.os }}-${{ matrix.php-version }}-
85+
composer-${{ runner.os }}-
86+
composer-
87+
88+
- name: Configure Symfony Flex
89+
run: |
90+
composer config extra.symfony.require ${{ matrix.execute-flex-with-symfony-version }}
91+
if: "matrix.execute-flex-with-symfony-version"
92+
93+
- name: Install dependencies
94+
uses: nick-invision/retry@v2
95+
with:
96+
timeout_minutes: 5
97+
max_attempts: 5
98+
retry_wait_seconds: 30
99+
command: |
100+
composer update --optimize-autoloader --no-interaction --no-progress ${{ matrix.composer-flags }}
101+
composer info -D | sort
102+
103+
- name: Execute migration rules
104+
run: |
105+
php php-cs-fixer fix --rules @PHP73Migration,@PHP71Migration:risky,blank_line_after_opening_tag -q
106+
if: "matrix.execute-migration-rules == 'yes'"
107+
108+
- name: Run tests
109+
continue-on-error: ${{ matrix.php-version == '8.0' }}
110+
env:
111+
PHP_CS_FIXER_IGNORE_ENV: ${{ matrix.PHP_CS_FIXER_IGNORE_ENV }}
112+
FAST_LINT_TEST_CASES: ${{ matrix.FAST_LINT_TEST_CASES }}
113+
PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER: ${{ matrix.PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER }}
114+
SYMFONY_DEPRECATIONS_HELPER: ${{ matrix.SYMFONY_DEPRECATIONS_HELPER }}
115+
run: |
116+
vendor/bin/phpunit
117+
118+
- name: Run PHP CS Fixer
119+
env:
120+
PHP_CS_FIXER_IGNORE_ENV: ${{ matrix.PHP_CS_FIXER_IGNORE_ENV }}
121+
PHP_CS_FIXER_FUTURE_MODE: 1
122+
run: |
123+
php php-cs-fixer --diff --dry-run -v fix

.github/workflows/sca.yaml renamed to .github/workflows/sca.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# yamllint disable rule:line-length
2-
31
name: Static Code Analysis
42

53
on:
@@ -11,7 +9,7 @@ jobs:
119
strategy:
1210
matrix:
1311
operating-system:
14-
- ubuntu-latest
12+
- ubuntu-20.04
1513
php-version:
1614
- 7.4
1715

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
# yamllint disable rule:line-length
2-
31
name: YAML Validation
42

53
on:
64
pull_request:
5+
paths:
6+
- '**.y?ml'
77
push:
8+
paths:
9+
- '**.y?ml'
810

911
jobs:
1012
validate-yaml:
1113
name: Validate YAML
12-
runs-on: ubuntu-latest
14+
runs-on: ubuntu-20.04
1315

1416
steps:
1517
- name: Checkout code
1618
uses: actions/checkout@v2
1719

18-
- name: Run YAMLlint
20+
- name: Run yamllint
1921
run: |
20-
find . -path \*/vendor -prune -false -o -name \*.y*ml | xargs yamllint -d relaxed
21-
22+
find . -path \*/vendor -prune -false -o -name \*.y*ml | xargs yamllint

.php_cs.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $config = PhpCsFixer\Config::create()
2323
->setRiskyAllowed(true)
2424
->setRules([
2525
'@PHP56Migration' => true,
26-
'@PHPUnit60Migration:risky' => true,
26+
'@PHPUnit75Migration:risky' => true,
2727
'@PhpCsFixer' => true,
2828
'@PhpCsFixer:risky' => true,
2929
'header_comment' => ['header' => $header],

.travis.yml

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -22,50 +22,7 @@ before_install:
2222

2323
jobs:
2424
include:
25-
- &STANDARD_TEST_JOB
26-
stage: Fast Test
27-
php: 7.0
28-
install:
29-
# Composer: enforce given Symfony components version
30-
- if [ "$SYMFONY_VERSION" != "" ]; then composer global show symfony/flex -q || travis_retry composer global require $DEFAULT_COMPOSER_FLAGS symfony/flex; fi
31-
- if [ "$SYMFONY_VERSION" != "" ]; then composer config extra.symfony.require $SYMFONY_VERSION || true; fi
32-
33-
- travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
34-
- composer info -D | sort
35-
script:
36-
- vendor/bin/phpunit || travis_terminate 1
37-
- PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix
38-
39-
-
40-
<<: *STANDARD_TEST_JOB
41-
stage: Test
42-
php: 5.6
43-
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
44-
45-
-
46-
<<: *STANDARD_TEST_JOB
47-
stage: Test
48-
php: 7.1
49-
name: 7.1 | Symfony ~4.1.0
50-
env: SYMFONY_DEPRECATIONS_HELPER=disabled PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER=1 SYMFONY_VERSION="~4.1.0"
51-
52-
-
53-
<<: *STANDARD_TEST_JOB
54-
stage: Test
55-
php: 7.2
56-
name: 7.2 | Symfony ^5.0
57-
env: SYMFONY_DEPRECATIONS_HELPER=disabled PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER=1 SYMFONY_VERSION="^5.0"
58-
5925
-
60-
<<: *STANDARD_TEST_JOB
61-
stage: Test
62-
php: 7.3
63-
name: 7.3 | With migration rules
64-
before_script:
65-
- php php-cs-fixer fix --rules @PHP73Migration,@PHP71Migration:risky,blank_line_after_opening_tag -q || travis_terminate 1
66-
67-
-
68-
<<: *STANDARD_TEST_JOB
6926
stage: Test
7027
php: 7.4
7128
name: 7.4 | Collect coverage
@@ -82,19 +39,16 @@ jobs:
8239

8340
# Install PCOV
8441
- pecl install pcov
42+
install:
43+
- travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
44+
- composer info -D | sort
8545
before_script:
8646
# Make code compatible with PHPUnit 8
8747
- PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer fix --rules=void_return -q tests || return 0
8848
script:
8949
- vendor/bin/phpunit --testsuite coverage --exclude-group covers-nothing --coverage-clover build/logs/clover.xml || travis_terminate 1
9050
- php vendor/bin/php-coveralls -v
9151

92-
-
93-
<<: *STANDARD_TEST_JOB
94-
stage: Test
95-
php: nightly
96-
env: COMPOSER_FLAGS="--ignore-platform-reqs" PHP_CS_FIXER_IGNORE_ENV=1 SYMFONY_DEPRECATIONS_HELPER=weak
97-
9852
-
9953
stage: Deployment
10054
php: 7.4
@@ -116,6 +70,3 @@ jobs:
11670
tags: true
11771
after_deploy:
11872
- ./dev-tools/trigger-website.sh ${TRAVIS_TOKEN} ${TRAVIS_TAG}
119-
120-
allow_failures:
121-
- php: nightly

.yamllint.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extends: relaxed
2+
3+
rules:
4+
line-length:
5+
max: 180
6+
level: warning

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2",
4242
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1",
4343
"phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1",
44+
"phpunitgoodpractices/polyfill": "^1.5",
4445
"phpunitgoodpractices/traits": "^1.9.1",
4546
"symfony/phpunit-bridge": "^5.1",
4647
"symfony/yaml": "^3.0 || ^4.0 || ^5.0"

0 commit comments

Comments
 (0)