Skip to content

Commit 2e0f62e

Browse files
authored
Merge pull request #67 from Yoast/develop
Release version 1.2.0
2 parents f955f6a + b7e1f7b commit 2e0f62e

16 files changed

+316
-143
lines changed

.gitattributes

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
# https://www.reddit.com/r/PHP/comments/2jzp6k/i_dont_need_your_tests_in_my_production
66
# https://blog.madewithlove.be/post/gitattributes/
77
#
8-
/.gitattributes export-ignore
9-
/.gitignore export-ignore
10-
/.cache/ export-ignore
11-
/.github/ export-ignore
12-
/.phpcs.xml.dist export-ignore
13-
/phpunit.xml.dist export-ignore
14-
/tests/ export-ignore
8+
/.cache/ export-ignore
9+
/.github/ export-ignore
10+
/tests/ export-ignore
11+
.gitattributes export-ignore
12+
.gitignore export-ignore
13+
.phpcs.xml.dist export-ignore
14+
phpunit.xml.dist export-ignore
1515

1616
#
1717
# Auto detect text files and perform LF normalization

.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
- "yoastcs/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
- "yoastcs/qa"
32+
reviewers:
33+
- "jrfnl"

.github/workflows/cs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818

1919
- name: Install PHP
2020
uses: shivammathur/setup-php@v2
@@ -28,8 +28,8 @@ jobs:
2828
- name: Install Composer dependencies
2929
uses: "ramsey/composer-install@v2"
3030
with:
31-
# Bust the cache at least once a month - output format: YYYY-MM-DD.
32-
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")
31+
# Bust the cache at least once a month - output format: YYYY-MM.
32+
custom-cache-suffix: $(date -u "+%Y-%m")
3333

3434
# Validate the composer.json file.
3535
# @link https://getcomposer.org/doc/03-cli.md#validate
@@ -39,7 +39,7 @@ jobs:
3939
# Check the code-style consistency of the PHP files.
4040
- name: Check PHP code style
4141
id: phpcs
42-
run: composer check-cs -- --report-full --report-checkstyle=./phpcs-report.xml
42+
run: composer check-cs -- --no-cache --report-full --report-checkstyle=./phpcs-report.xml
4343

4444
- name: Show PHPCS results in PR
4545
if: ${{ always() && steps.phpcs.outcome == 'failure' }}

.github/workflows/test.yml

Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
name: Test
22

33
on:
4-
# Run on all pushes and on all pull requests.
4+
# Run on pushes to `main` and `develop` and on all pull requests.
55
push:
6+
branches:
7+
- main
8+
- develop
9+
paths-ignore:
10+
- '**.md'
611
pull_request:
712
# Allow manually triggering the workflow.
813
workflow_dispatch:
@@ -14,31 +19,87 @@ jobs:
1419

1520
strategy:
1621
matrix:
17-
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
22+
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.3']
23+
coverage: [false]
24+
25+
# Run code coverage only on high/low PHP.
26+
include:
27+
- php: 5.6
28+
coverage: true
29+
- php: 8.2
30+
coverage: true
31+
32+
continue-on-error: ${{ matrix.php == '8.3' }}
1833

1934
name: "Tests: PHP ${{ matrix.php }}"
2035

2136
steps:
2237
- name: Checkout code
23-
uses: actions/checkout@v3
38+
uses: actions/checkout@v4
2439

2540
- name: Install PHP
2641
uses: shivammathur/setup-php@v2
2742
with:
2843
php-version: ${{ matrix.php }}
2944
ini-values: error_reporting=E_ALL, display_errors=On
30-
coverage: none
45+
coverage: ${{ matrix.coverage == true && 'xdebug' || 'none' }}
3146

3247
# Install dependencies and handle caching in one go.
3348
# @link https://github.com/marketplace/actions/install-composer-dependencies
34-
- name: Install Composer dependencies
49+
- name: Install Composer dependencies - normal
50+
if: matrix.php != '8.3'
3551
uses: "ramsey/composer-install@v2"
3652
with:
37-
# Bust the cache at least once a month - output format: YYYY-MM-DD.
38-
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")
53+
# Bust the cache at least once a month - output format: YYYY-MM.
54+
custom-cache-suffix: $(date -u "+%Y-%m")
55+
56+
- name: Install Composer dependencies - ignore PHP restrictions
57+
if: matrix.php == '8.3'
58+
uses: "ramsey/composer-install@v2"
59+
with:
60+
composer-options: --ignore-platform-req=php+
61+
# Bust the cache at least once a month - output format: YYYY-MM.
62+
custom-cache-suffix: $(date -u "+%Y-%m")
3963

4064
- name: Lint PHP files against parse errors
4165
run: composer lint
4266

4367
- name: Run the unit tests
68+
if: ${{ matrix.coverage == false }}
4469
run: composer test
70+
71+
- name: Run the unit tests with code coverage
72+
if: ${{ matrix.coverage == true }}
73+
run: composer coverage
74+
75+
# PHP Coveralls doesn't fully support PHP 8.x yet, so switch the PHP version.
76+
- name: Switch to PHP 7.4
77+
if: ${{ success() && matrix.coverage == true && startsWith( matrix.php, '8' ) }}
78+
uses: shivammathur/setup-php@v2
79+
with:
80+
php-version: 7.4
81+
coverage: none
82+
83+
# Global install is used to prevent a conflict with the local composer.lock in PHP 8.0+.
84+
- name: Install Coveralls
85+
if: ${{ success() && matrix.coverage == true }}
86+
run: composer global require php-coveralls/php-coveralls:"^2.5.3" --no-interaction
87+
88+
- name: Upload coverage results to Coveralls
89+
if: ${{ success() && matrix.coverage == true }}
90+
env:
91+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
92+
COVERALLS_PARALLEL: true
93+
COVERALLS_FLAG_NAME: php-${{ matrix.php }}
94+
run: php-coveralls -v -x build/logs/clover.xml
95+
96+
coveralls-finish:
97+
needs: test
98+
runs-on: ubuntu-latest
99+
100+
steps:
101+
- name: Coveralls Finished
102+
uses: coverallsapp/github-action@v2
103+
with:
104+
github-token: ${{ secrets.COVERALLS_TOKEN }}
105+
parallel-finished: true

CHANGELOG.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,24 @@ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/) and uses
99

1010
_Nothing yet._
1111

12+
## [1.2.0] - 2023-09-27
13+
14+
### Added
15+
16+
* Support for the new PHPUnit `assertObjectHasProperty()` and `assertObjectNotHasProperty()` assertions, as polyfilled via the PHPUnit Polyfills in all test cases. PR [#64]
17+
This means that the `assertObjectHasProperty()` and `assertObjectNotHasProperty()` assertions can now safely be used in all tests in classes which extend one of the WP Test Utils TestCases.
18+
19+
### Changed
20+
* `Yoast\WPTestUtils\BrainMonkey\YoastTestCase`: the parameter names used in a few of the stubs for WP Core functions have been updated to stay in line with the names used in WP Core. PR [#53]
21+
* The [PHPUnit Polyfills] dependency has been updated to require [version `^1.1.0`](https://github.com/Yoast/PHPUnit-Polyfills/releases/tag/1.1.0) (was `^1.0.5`). PRs [#52], [#64]
22+
* Verified PHP 8.3 compatibility.
23+
* General housekeeping.
24+
25+
[#52]: https://github.com/Yoast/wp-test-utils/pull/52
26+
[#53]: https://github.com/Yoast/wp-test-utils/pull/53
27+
[#64]: https://github.com/Yoast/wp-test-utils/pull/64
28+
29+
1230
## [1.1.1] - 2022-11-17
1331

1432
### Fixed
@@ -68,7 +86,6 @@ See the [Make Core dev-note](https://make.wordpress.org/core/2021/09/27/changes-
6886
### Fixes
6987
* The [PHPUnit Polyfills] dependency introduced three new polyfills in the `1.0.0` version. These are now supported in all test cases. [#17]
7088

71-
7289
Thanks [Pierre Gordon] and [Pascal Birchler] for making feature suggestions for this version.
7390

7491
[#16]: https://github.com/Yoast/wp-test-utils/pull/16
@@ -118,6 +135,7 @@ Initial release.
118135

119136

120137
[Unreleased]: https://github.com/Yoast/wp-test-utils/compare/main...HEAD
138+
[1.2.0]: https://github.com/Yoast/wp-test-utils/compare/1.1.1...1.2.0
121139
[1.1.1]: https://github.com/Yoast/wp-test-utils/compare/1.1.0...1.1.1
122140
[1.1.0]: https://github.com/Yoast/wp-test-utils/compare/1.0.0...1.1.0
123141
[1.0.0]: https://github.com/Yoast/wp-test-utils/compare/0.2.2...1.0.0

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ WP Test Utils
44
[![Version](https://poser.pugx.org/yoast/wp-test-utils/version)](https://packagist.org/packages/yoast/wp-test-utils)
55
[![CS Build Status](https://github.com/Yoast/wp-test-utils/actions/workflows/cs.yml/badge.svg)](https://github.com/Yoast/wp-test-utils/actions/workflows/cs.yml)
66
[![Test Build Status](https://github.com/Yoast/wp-test-utils/actions/workflows/test.yml/badge.svg)](https://github.com/Yoast/wp-test-utils/actions/workflows/test.yml)
7+
[![Coverage Status](https://coveralls.io/repos/github/Yoast/wp-test-utils/badge.svg?branch=develop)](https://coveralls.io/github/Yoast/wp-test-utils?branch=develop)
8+
79
[![Minimum PHP Version](https://img.shields.io/packagist/php-v/yoast/wp-test-utils.svg?maxAge=3600)](https://packagist.org/packages/yoast/wp-test-utils)
810
[![License: BSD3](https://poser.pugx.org/yoast/wp-test-utils/license)](https://github.com/Yoast/wp-test-utils/blob/main/LICENSE)
911

@@ -33,7 +35,7 @@ Requirements
3335
* PHP 5.6 or higher.
3436

3537
The following packages will be automatically required via Composer:
36-
* [PHPUnit Polyfills] 1.0.4 or higher.
38+
* [PHPUnit Polyfills] 1.1.0 or higher.
3739
* [PHPUnit] 5.7 - 9.x.
3840
* [BrainMonkey] 2.6.1 or higher.
3941

@@ -172,6 +174,8 @@ To tell PHPUnit to use this bootstrap file, use `--bootstrap tests/bootstrap.php
172174

173175
#### Helpers to create test doubles for unavailable classes
174176

177+
> :bulb: The problem this feature solves has been fixed in Mockery 1.6.0, so if you use Mockery 1.6.0 or higher for test runs against PHP 8.2 or higher, you should no longer need this solution.
178+
175179
##### Why you may need to create test doubles for unavailable classes
176180

177181
Typically a mock for an unavailable class is created using `Mockery::mock()` or `Mockery::mock( 'Unavailable' )`.

0 commit comments

Comments
 (0)