Skip to content

Release version 1.0.3#68

Merged
jrfnl merged 12 commits into
mainfrom
develop
Nov 23, 2021
Merged

Release version 1.0.3#68
jrfnl merged 12 commits into
mainfrom
develop

Conversation

@jrfnl

@jrfnl jrfnl commented Nov 23, 2021

Copy link
Copy Markdown
Collaborator

Functional:

  • Confirm that the most recent PHPUnit changelogs have been checked and that the library is still feature complete for those versions supported within the PHPUnit version constraints.
  • Update the VERSION constant in the phpunitpolyfills-autoload.php file. - PR Changelog for release 1.0.3 #67
  • Composer: check if any dependencies/version constraints need updating.

Release:

  • Add changelog for the release - PR Changelog for release 1.0.3 #67
    Verify that a release link at the bottom of the CHANGELOG.md file has been added.
  • Merge this PR.
  • Make sure all CI builds are green.
  • Tag the release (careful, GH defaults to develop!).
  • Create a release from the tag (careful, GH defaults to develop!) & copy & paste the changelog to it.
    Make sure to copy the links to the issues and the links to the GH usernames from the bottom of the changelog!
  • Close the milestone.
  • Open a new milestone for the next release.
  • If any open PRs/issues which were milestoned for the release did not make it into the release, update their milestone.

Announce:

  • Tweet about the release.

jrfnl and others added 12 commits November 3, 2021 15:29
Execute linting in a separate workflow from running the tests.
* `E_ALL` does not really contain **ALL** PHP notices across all PHP versions, in some `E_STRICT`, for instance, is excluded from `E_ALL`, so using `-1` is the better choice as that will always contain everything.
* While assertions are (as far as I'm aware) not currently used in the code base, it's still a good idea to enable `zend_assertions` in case something would be changed in the test tooling used.
    This is one of the other ini settings which is not turned on by default in the `setup-php` action.
    Ref: https://www.php.net/manual/en/ini.core.php#ini.zend.assertions
In Travis, when the same branch was pushed again and the "Auto cancellation" option on the "Settings" page had been turned on (as it was for most repos), any still running builds for the same branch would be stopped in favour of starting the build for the newly pushed version of the branch.

To enable this behaviour in GH Actions, a `concurrency` configuration needs to be added to each workflow for which this should applied to.

More than anything, this is a way to be kind to GitHub by not wasting resources which they so kindly provide to us for free.

Refs:
* https://github.blog/changelog/2021-04-19-github-actions-limit-workflow-run-or-job-concurrency/
* https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#concurrency
Initial tweaks to make the tests compatible with PHPUnit 10.x, which enforces a `mixed` return type for the `TestCase::runTest()` method.

To test the TestListener, prior to PHPUnit 7.0, overloading the `runTest()` method works best, but as of PHPUnit 10.0, the `runTest()` method has a `mixed` return type declaration (PHP 8.0+).
However, since PHPUnit 7.0, testing the TestListener also works when the test name with which the `TestCase` is instantiated is not `runTest()`.

So either way, the fixtures used for the TestListener tests need to be duplicated and have two variations.

Now the choice was which option to choose:
* Duplicate the classes and add a return type to the `runTest()` method.
* Duplicate the classes and rename the test method.

I investigated both options and have decided to implement option 2 as `void` is not accepted as covariant with `mixed` and these methods are all `void` methods, so adding `mixed` as the return type would be misrepresenting the functionality.

The toggle for which test class to load for the various tests has been implemented with a helper method.
Tests: tweaks for PHPUnit 10.x compatibility
The `sebastian/exporter` package has been a dependency of PHPUnit from before PHPUnit 4.8.x (minimum supported version by this library), so it is safe to use the same variable export methodology as PHPUnit itself uses.

The class is prefixed via PHP_Scoper when it is includes as part of a PHPUnit Phar file and the toggle added will make sure the class can be loaded both when run via a Composer install, as well as when run via a Phar file.

Also note that the Exporter reports closed resources as `NULL`. This has been reported upstream via sebastianbergmann/exporter#36 and for the polyfill a fix has been put in place to work around this.

**Important**:
While the `sebastian/exporter` package has , in effect, now become a direct dependency of the Polyfills, I'm not going to declare it as such in the `composer.json` file as for all supported PHPUnit versions, the package will already be available via PHPUnit itself, whether installed via Composer or as a PHAR.
This prevent potential version conflicts when tests are run via the PHAR, while the Polyfills have been installed via Composer and saves hassle of having to take care of autoloading the Exporter file, while it will be loaded for PHPUnit itself anyway.
…e-error-message

AssertClosedResource: improve error messages
This constant signals to PHPUnit that the tests themselves may run other tests and will prevent tests on older PHPUnit versions from being marked as "risky" for "closing more than just their own buffers".
Test bootstrap: declare the `PHPUNIT_TESTSUITE` constant
Includes updating the `VERSION` constant in the `Autoload` class.
@jrfnl jrfnl added this to the 1.0.3 milestone Nov 23, 2021
@jrfnl jrfnl merged commit 5ea3536 into main Nov 23, 2021
@jrfnl

jrfnl commented Nov 23, 2021

Copy link
Copy Markdown
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant