Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release version 1.2.0 #67

Merged
merged 39 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
16eb1a8
GH Actions: minor simplification
jrfnl Dec 19, 2022
ca588d6
GH Actions: improve performance of the CS step
jrfnl Dec 19, 2022
5996652
GH Actions: enable linting and testing against PHP 8.3
jrfnl Dec 19, 2022
12287f2
Merge pull request #48 from Yoast/feature/ghactions-tweaks
jrfnl Dec 19, 2022
65e3ffd
Composer: update YoastCS and dependencies
jrfnl Jan 9, 2023
b194794
Merge pull request #49 from Yoast/JRF/update-yoastcs-dependencies
jrfnl Jan 9, 2023
b4d180a
CI/QA: start recording code coverage
jrfnl May 1, 2023
7da5034
Merge pull request #50 from Yoast/JRF/start-recording-code-coverage
jrfnl May 1, 2023
22aaa65
Dependabot: add reviewer config
jrfnl May 1, 2023
0ca5f3a
Composer: update dependencies
jrfnl May 1, 2023
8a2874b
BrainMonkey/YoastTestCase: rename parameter for mocked function
jrfnl May 1, 2023
6f76e88
BrainMonkey/YoastTestCase: rename parameter for mocked function
jrfnl May 1, 2023
e754c95
Merge pull request #51 from Yoast/JRF/dependabot-set-reviewer
jrfnl May 1, 2023
481111b
Merge pull request #52 from Yoast/JRF/composer-update-dependencies
jrfnl May 1, 2023
fb95b46
Merge pull request #53 from Yoast/JRF/QA/rename-parameters-for-mocked…
jrfnl May 1, 2023
bd82e6b
GH Actions: only run tests for PRs and merges
jrfnl May 1, 2023
12ad78c
Merge pull request #54 from Yoast/JRF/ghactions-only-run-tests-on-pr-…
jrfnl May 1, 2023
bc4b32f
GH Actions: Bump actions/checkout from 3 to 4
dependabot[bot] Sep 11, 2023
98d7f2c
Composer/PHPCS: update for YoastCS 2.3.1
jrfnl Sep 16, 2023
1762945
Merge pull request #58 from Yoast/JRF/composer-update-for-yoastcs-2.3.1
jrfnl Sep 23, 2023
1215209
Composer: normalize the file
jrfnl Sep 21, 2023
31e00ef
Composer: add script descriptions
jrfnl Sep 21, 2023
aac1095
Merge pull request #59 from Yoast/JRF/composer-tweaks
jrfnl Sep 23, 2023
f0b500d
.gitattributes: minor clean up
jrfnl Sep 21, 2023
7d83656
Merge pull request #60 from Yoast/JRF/gitattributes-minor-tweaks
jrfnl Sep 23, 2023
a3f1bea
Docs: improve type specificity
jrfnl Sep 21, 2023
9f0dd80
Docs: add missing return type void annotations
jrfnl Sep 22, 2023
1aaf094
CS/QA: all test classes should be either abstract or final
jrfnl Sep 21, 2023
153072e
Tests: make dataproviders `static`
jrfnl Jun 6, 2023
88ec1b8
Merge pull request #61 from Yoast/JRF/docs-various-updates
jrfnl Sep 23, 2023
55643b9
Merge pull request #62 from Yoast/JRF/tests-class-should-be-final
jrfnl Sep 23, 2023
6de43fc
Merge pull request #63 from Yoast/JRF/tests-static-dataproviders
jrfnl Sep 23, 2023
b0a3817
Backport support for the `AssertObjectProperty` polyfill
jrfnl Sep 12, 2023
d80ec93
.gitattributes: minor clean up
jrfnl Sep 26, 2023
9484959
Merge pull request #65 from Yoast/JRF/gitattributes-minor-tweaks
jrfnl Sep 26, 2023
b65370b
Merge pull request #64 from Yoast/JRF/update-for-phpunit-polyfills-1.1.0
jrfnl Sep 27, 2023
57693fe
Merge pull request #57 from Yoast/dependabot/github_actions/actions/c…
jrfnl Sep 27, 2023
7e1629b
Changelog for release 1.2.0
jrfnl Sep 23, 2023
b7e1f7b
Merge pull request #66 from Yoast/JRF/changelog-1.2.0
jrfnl Sep 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
# https://www.reddit.com/r/PHP/comments/2jzp6k/i_dont_need_your_tests_in_my_production
# https://blog.madewithlove.be/post/gitattributes/
#
/.gitattributes export-ignore
/.gitignore export-ignore
/.cache/ export-ignore
/.github/ export-ignore
/.phpcs.xml.dist export-ignore
/phpunit.xml.dist export-ignore
/tests/ export-ignore
/.cache/ export-ignore
/.github/ export-ignore
/tests/ export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.phpcs.xml.dist export-ignore
phpunit.xml.dist export-ignore

#
# Auto detect text files and perform LF normalization
Expand Down
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ updates:
prefix: "GH Actions:"
labels:
- "yoastcs/qa"
reviewers:
- "jrfnl"

# Maintain dependencies for Composer.
- package-ecosystem: "composer"
Expand All @@ -27,3 +29,5 @@ updates:
prefix: "Composer:"
labels:
- "yoastcs/qa"
reviewers:
- "jrfnl"
8 changes: 4 additions & 4 deletions .github/workflows/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

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

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

- name: Show PHPCS results in PR
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
Expand Down
75 changes: 68 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: Test

on:
# Run on all pushes and on all pull requests.
# Run on pushes to `main` and `develop` and on all pull requests.
push:
branches:
- main
- develop
paths-ignore:
- '**.md'
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:
Expand All @@ -14,31 +19,87 @@ jobs:

strategy:
matrix:
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.3']
coverage: [false]

# Run code coverage only on high/low PHP.
include:
- php: 5.6
coverage: true
- php: 8.2
coverage: true

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

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

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: error_reporting=E_ALL, display_errors=On
coverage: none
coverage: ${{ matrix.coverage == true && 'xdebug' || 'none' }}

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies
- name: Install Composer dependencies - normal
if: matrix.php != '8.3'
uses: "ramsey/composer-install@v2"
with:
# Bust the cache at least once a month - output format: YYYY-MM-DD.
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")

- name: Install Composer dependencies - ignore PHP restrictions
if: matrix.php == '8.3'
uses: "ramsey/composer-install@v2"
with:
composer-options: --ignore-platform-req=php+
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")

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

- name: Run the unit tests
if: ${{ matrix.coverage == false }}
run: composer test

- name: Run the unit tests with code coverage
if: ${{ matrix.coverage == true }}
run: composer coverage

# PHP Coveralls doesn't fully support PHP 8.x yet, so switch the PHP version.
- name: Switch to PHP 7.4
if: ${{ success() && matrix.coverage == true && startsWith( matrix.php, '8' ) }}
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none

# Global install is used to prevent a conflict with the local composer.lock in PHP 8.0+.
- name: Install Coveralls
if: ${{ success() && matrix.coverage == true }}
run: composer global require php-coveralls/php-coveralls:"^2.5.3" --no-interaction

- name: Upload coverage results to Coveralls
if: ${{ success() && matrix.coverage == true }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: php-${{ matrix.php }}
run: php-coveralls -v -x build/logs/clover.xml

coveralls-finish:
needs: test
runs-on: ubuntu-latest

steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.COVERALLS_TOKEN }}
parallel-finished: true
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/) and uses

_Nothing yet._

## [1.2.0] - 2023-09-27

### Added

* Support for the new PHPUnit `assertObjectHasProperty()` and `assertObjectNotHasProperty()` assertions, as polyfilled via the PHPUnit Polyfills in all test cases. PR [#64]
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.

### Changed
* `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]
* 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]
* Verified PHP 8.3 compatibility.
* General housekeeping.

[#52]: https://github.com/Yoast/wp-test-utils/pull/52
[#53]: https://github.com/Yoast/wp-test-utils/pull/53
[#64]: https://github.com/Yoast/wp-test-utils/pull/64


## [1.1.1] - 2022-11-17

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


Thanks [Pierre Gordon] and [Pascal Birchler] for making feature suggestions for this version.

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


[Unreleased]: https://github.com/Yoast/wp-test-utils/compare/main...HEAD
[1.2.0]: https://github.com/Yoast/wp-test-utils/compare/1.1.1...1.2.0
[1.1.1]: https://github.com/Yoast/wp-test-utils/compare/1.1.0...1.1.1
[1.1.0]: https://github.com/Yoast/wp-test-utils/compare/1.0.0...1.1.0
[1.0.0]: https://github.com/Yoast/wp-test-utils/compare/0.2.2...1.0.0
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ WP Test Utils
[![Version](https://poser.pugx.org/yoast/wp-test-utils/version)](https://packagist.org/packages/yoast/wp-test-utils)
[![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)
[![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)
[![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)

[![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)
[![License: BSD3](https://poser.pugx.org/yoast/wp-test-utils/license)](https://github.com/Yoast/wp-test-utils/blob/main/LICENSE)

Expand Down Expand Up @@ -33,7 +35,7 @@ Requirements
* PHP 5.6 or higher.

The following packages will be automatically required via Composer:
* [PHPUnit Polyfills] 1.0.4 or higher.
* [PHPUnit Polyfills] 1.1.0 or higher.
* [PHPUnit] 5.7 - 9.x.
* [BrainMonkey] 2.6.1 or higher.

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

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

> :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.

##### Why you may need to create test doubles for unavailable classes

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