Skip to content

Commit c758753

Browse files
authored
Merge pull request #133 from Yoast/2.x
Release version 2.0.0
2 parents 3b59ade + cf3c4bf commit c758753

File tree

68 files changed

+2108
-2303
lines changed

Some content is hidden

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

68 files changed

+2108
-2303
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/.remarkignore export-ignore
1515
/.remarkrc export-ignore
1616
/phpunit.xml.dist export-ignore
17+
/phpunit10.xml.dist export-ignore
1718
/tests/ export-ignore
1819

1920
#

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ updates:
1515
prefix: "GH Actions:"
1616
labels:
1717
- "Type: chores/QA"
18+
reviewers:
19+
- "jrfnl"
1820

1921
# Maintain dependencies for Composer.
2022
- package-ecosystem: "composer"
@@ -27,3 +29,5 @@ updates:
2729
prefix: "Composer:"
2830
labels:
2931
- "Type: chores/QA"
32+
reviewers:
33+
- "jrfnl"

.github/workflows/lint.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
strategy:
2222
matrix:
23-
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
23+
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
2424

2525
continue-on-error: ${{ matrix.php == '8.3' }}
2626

@@ -36,6 +36,7 @@ jobs:
3636
php-version: ${{ matrix.php }}
3737
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
3838
coverage: none
39+
tools: cs2pr
3940

4041
- name: 'Composer: remove PHPUnit (not needed for lint)'
4142
run: composer remove phpunit/phpunit --no-update --no-interaction
@@ -59,12 +60,12 @@ jobs:
5960

6061
- name: "Lint PHP files against parse errors - PHP < 7.0"
6162
if: ${{ matrix.php < 7.0 }}
62-
run: composer lint-lt70
63+
run: composer lint-lt70 -- --checkstyle | cs2pr
6364

6465
- name: "Lint PHP files against parse errors - PHP 7.x"
6566
if: ${{ startsWith( matrix.php, '7' ) }}
6667
run: composer lint7
6768

6869
- name: "Lint PHP files against parse errors - PHP >= 8.0"
6970
if: ${{ matrix.php >= 8.0 }}
70-
run: composer lint-gte80
71+
run: composer lint-gte80 -- --checkstyle | cs2pr

.github/workflows/markdown.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ jobs:
8484
remark-preset-lint-markdown-style-guide
8585
remark-lint-checkbox-content-indent
8686
remark-lint-linebreak-style
87+
remark-lint-no-dead-urls
8788
remark-lint-no-empty-url
8889
remark-lint-no-heading-like-paragraph
8990
remark-lint-no-reference-like-url
@@ -94,7 +95,6 @@ jobs:
9495
remark-lint-list-item-punctuation
9596
remark-lint-match-punctuation
9697
remark-lint-no-hr-after-heading
97-
remark-lint-are-links-valid-alive
9898
remark-lint-are-links-valid-duplicate
9999
remark-validate-links
100100

.github/workflows/test.yml

Lines changed: 101 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,64 +20,92 @@ jobs:
2020

2121
strategy:
2222
matrix:
23-
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
23+
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
2424
phpunit: ['auto']
25+
coverage: [true]
2526
experimental: [false]
2627

2728
include:
2829
# Test against a version on the low-end of the PHPUnit versions supported for each PHP version.
29-
# On PHP 5.4 and 5.5, only PHPUnit 4.x is supported and the lowest and the
30-
# highest supported version would be the same.
3130
# Using the Composer `--prefer-lowest` option is, unfortunately, not viable, as
32-
# PHPUnit 4.8.36 doesn't have proper PHP restrictions, which means that it
33-
# would always be installed as "low", which would break the builds for PHP 7.2+.
31+
# it would result PHP 5.6 - 7.4 all using PHPUnit 5.7.21, which is not the intention.
32+
# It also would run into trouble with PHP 8.5.12 being used on PHP 8.0+, while the
33+
# 8.5.12 release still contained a bug which makes it incompatible with PHP 8.1+,
34+
# even though it officially allows for it..
3435
- php: '5.6'
3536
phpunit: '5.7.21'
37+
coverage: true
3638
experimental: false
3739
- php: '7.0'
3840
phpunit: '5.7.27'
41+
coverage: true
3942
experimental: false
4043
- php: '7.1'
4144
phpunit: '5.7.21'
45+
coverage: true
4246
experimental: false
4347
- php: '7.2'
4448
phpunit: '6.3.1'
49+
coverage: true
4550
experimental: false
4651
- php: '7.3'
4752
phpunit: '7.2.7'
53+
coverage: true
4854
experimental: false
4955
- php: '7.4'
5056
phpunit: '8.1.6'
57+
coverage: true
5158
experimental: false
5259
- php: '8.0'
5360
phpunit: '8.5.16'
61+
# PHPUnit 8.x does not support code coverage on PHP 8.x.
62+
coverage: false
5463
experimental: false
5564
- php: '8.0'
5665
phpunit: '9.3.0'
66+
coverage: true
5767
experimental: false
5868
- php: '8.1'
5969
phpunit: '9.3.0'
70+
coverage: true
71+
experimental: false
72+
- php: '8.1'
73+
# Specifically set at 10.0.12 minimum to prevent needing a toggle in the tests for something
74+
# related to the ArrayIsList polyfill, but not necessarily relevant.
75+
phpunit: '10.0.12'
76+
coverage: true
6077
experimental: false
6178
- php: '8.2'
6279
phpunit: '9.3.0'
80+
coverage: true
81+
experimental: false
82+
- php: '8.2'
83+
phpunit: '10.1.0'
84+
coverage: true
6385
experimental: false
6486

6587
# Experimental builds.
6688
- php: '8.3'
67-
phpunit: 'auto' # PHPUnit 9.x.
89+
phpunit: '^9.6'
90+
coverage: false
6891
experimental: true
69-
70-
- php: '8.1'
71-
phpunit: '^10.0'
92+
- php: '8.3'
93+
phpunit: 'auto' # PHPUnit 10.x.
94+
coverage: false
7295
experimental: true
96+
7397
- php: '8.2'
74-
phpunit: '^10.0'
98+
phpunit: 'dev-main'
99+
coverage: false
75100
experimental: true
76101

77102
name: "Tests: PHP ${{ matrix.php }} - PHPUnit: ${{matrix.phpunit}}"
78103

79104
continue-on-error: ${{ matrix.experimental }}
80105

106+
env:
107+
EXTRA_PHPUNIT_CLIARGS: '--fail-on-deprecation --fail-on-notice'
108+
81109
steps:
82110
- name: Checkout code
83111
uses: actions/checkout@v3
@@ -87,7 +115,7 @@ jobs:
87115
with:
88116
php-version: ${{ matrix.php }}
89117
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
90-
coverage: none
118+
coverage: ${{ matrix.coverage == true && 'xdebug' || 'none' }}
91119

92120
- name: 'Composer: set PHPUnit version for tests'
93121
if: ${{ matrix.phpunit != 'auto' }}
@@ -110,11 +138,68 @@ jobs:
110138
# Bust the cache at least once a month - output format: YYYY-MM.
111139
custom-cache-suffix: $(date -u "+%Y-%m")
112140

113-
- name: Run the unit tests
114-
if: ${{ matrix.phpunit != '^10.0' }}
141+
- name: Grab PHPUnit version
142+
id: phpunit_version
143+
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT
144+
145+
- name: "DEBUG: Show grabbed version"
146+
run: echo ${{ steps.phpunit_version.outputs.VERSION }}
147+
148+
- name: "Run the unit tests (PHPUnit < 10)"
149+
if: ${{ matrix.coverage == false && ! startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
115150
run: composer test
116151

117-
- name: Trial run the unit tests against PHPUnit 10.0
118-
if: ${{ matrix.phpunit == '^10.0' }}
152+
- name: "Run the unit tests with code coverage (PHPUnit < 10)"
153+
if: ${{ matrix.coverage == true && ! startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
154+
run: composer coverage
155+
156+
# Migrate PHPUnit configuration to deal with changes in the coverage/source setting across PHPUnit 10.x
157+
# versions as otherwise the warning about these would fail the build (which to me, feels like a bug).
158+
- name: "Migrate configuration (PHPUnit 10.0+)"
119159
continue-on-error: true
120-
run: composer test
160+
if: ${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) && steps.phpunit_version.outputs.VERSION != '10.0' }}
161+
run: vendor/bin/phpunit -c phpunit10.xml.dist --migrate-configuration
162+
163+
- name: "Run the unit tests (PHPUnit 10.0+)"
164+
if: ${{ matrix.coverage == false && startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
165+
# Don't fail the build on a test run failure against a future PHPUnit version.
166+
continue-on-error: ${{ matrix.phpunit == 'dev-main' }}
167+
run: composer test10 -- ${{ steps.phpunit_version.outputs.VERSION != '10.0' && env.EXTRA_PHPUNIT_CLIARGS || '' }}
168+
169+
- name: "Run the unit tests with code coverage (PHPUnit 10.0+)"
170+
if: ${{ matrix.coverage == true && startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
171+
# Don't fail the build on a test run failure against a future PHPUnit version.
172+
continue-on-error: ${{ matrix.phpunit == 'dev-main' }}
173+
run: composer coverage10 -- ${{ steps.phpunit_version.outputs.VERSION != '10.0' && env.EXTRA_PHPUNIT_CLIARGS || '' }}
174+
175+
# PHP Coveralls doesn't fully support PHP 8.x yet, so switch the PHP version.
176+
- name: Switch to PHP 7.4
177+
if: ${{ success() && matrix.coverage == true && startsWith( matrix.php, '8' ) }}
178+
uses: shivammathur/setup-php@v2
179+
with:
180+
php-version: 7.4
181+
coverage: none
182+
183+
# Global install is used to prevent a conflict with the local composer.lock in PHP 8.0+.
184+
- name: Install Coveralls
185+
if: ${{ success() && matrix.coverage == true }}
186+
run: composer global require php-coveralls/php-coveralls:"^2.5.3" --no-interaction
187+
188+
- name: Upload coverage results to Coveralls
189+
if: ${{ success() && matrix.coverage == true }}
190+
env:
191+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
192+
COVERALLS_PARALLEL: true
193+
COVERALLS_FLAG_NAME: php-${{ matrix.php }}-phpunit-${{ matrix.phpunit }}
194+
run: php-coveralls -v -x build/logs/clover.xml
195+
196+
coveralls-finish:
197+
needs: test
198+
runs-on: ubuntu-latest
199+
200+
steps:
201+
- name: Coveralls Finished
202+
uses: coverallsapp/github-action@v2
203+
with:
204+
github-token: ${{ secrets.COVERALLS_TOKEN }}
205+
parallel-finished: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ vendor/
55
/phpcs.xml
66
.cache/phpcs.cache
77
/phpunit.xml
8+
/phpunit10.xml
89
/.phpunit.result.cache
910
/build/

.phpcs.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,6 @@
130130
<exclude-pattern>/src/TestListeners/TestListenerDefaultImplementationPHPUnitGte7\.php$</exclude-pattern>
131131
</rule>
132132

133-
<!-- The @throws tags in the docblocks are correct, but the sniff can't analyse this correctly. -->
134-
<rule ref="Squiz.Commenting.FunctionCommentThrowTag.Missing">
135-
<exclude-pattern>/src/Polyfills/AssertFileDirectory\.php$</exclude-pattern>
136-
<exclude-pattern>/src/Polyfills/ExpectException\.php$</exclude-pattern>
137-
</rule>
138-
139133
<!-- Make some allowances for test files. -->
140134
<rule ref="WordPress.PHP.DevelopmentFunctions">
141135
<exclude-pattern>/tests/*\.php$</exclude-pattern>

.remarkrc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
["remark-lint-linebreak-style", "unix"],
99
["remark-lint-link-title-style", "\""],
1010
["remark-lint-ordered-list-marker-style", "."],
11+
[
12+
"remark-lint-no-dead-urls",
13+
{
14+
"skipUrlPatterns": [
15+
"^https?://github\\.com/Yoast/PHPUnit-Polyfills/compare/[0-9\\.]+?\\.{3}[0-9\\.]+"
16+
]
17+
}
18+
],
1119
"remark-lint-no-duplicate-definitions",
1220
"remark-lint-no-empty-url",
1321
"remark-lint-no-file-name-consecutive-dashes",
@@ -28,7 +36,6 @@
2836
"remark-lint-list-item-punctuation",
2937
"remark-lint-match-punctuation",
3038
"remark-lint-no-hr-after-heading",
31-
"remark-lint-are-links-valid-alive",
3239
"remark-lint-are-links-valid-duplicate",
3340
"remark-validate-links"
3441
]

0 commit comments

Comments
 (0)