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

add support for phpunit 11 #157

Merged
merged 4 commits into from
Apr 26, 2024
Merged

add support for phpunit 11 #157

merged 4 commits into from
Apr 26, 2024

Conversation

wickedOne
Copy link
Contributor

allow installation of phpunit 11
removed conflict section as well as it won't install phpunit <9.6 anyway?

requires SymfonyTest/SymfonyConfigTest#79 to be merged & tagged

@ju1ius
Copy link

ju1ius commented Feb 15, 2024

Unfortunately, just tweaking the version constraints won't be enough to make it work, because PhpUnit 11 removes features that are currently used by this library (like the Constraint::exporter() method).

@@ -4,13 +4,15 @@

use PHPUnit\Framework\Constraint\Constraint;
use PHPUnit\Framework\Constraint\IsEqual;
use SebastianBergmann\Exporter\Exporter;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break when using the phpunit phar release, see #158.

Copy link
Contributor Author

@wickedOne wickedOne Feb 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i just noticed your merge request and was wondering whether it isn't a phar problem when a class is incorrectly vendored?

phpunit 11 does no longer include the exporter so not adding this dependency isn't really an option for this pr

Copy link

@ju1ius ju1ius Feb 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpunit 11 does no longer include the exporter

Nope, it's definitely there in the composer.json for v11, and also in the v11 phar release (still vendored as PHPUnit\SebastianBergmann\Exporter\Exporter).

was wondering whether it isn't a phar problem when a class is incorrectly vendored

I'm pretty sure that's the way it's supposed to be. The phpunit phar release basically vendors all it's dependencies under the PhpUnit root namespace.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not adding this dependency isn't really an option for this pr

You could add a compatibility factory, i.e. something like this:

use PhpUnit\SebastianBergmann\Exporter\Exporter as VendoredExporter;
use SebastianBergmann\Exporter\Exporter;

class PhpUnitCompatFactory {
  public static function exporter(): Exporter|VendoredExporter {
    return class_exists(VendoredExporter::class) ? new VendoredExporter() : new Exporter();
  }
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah wait, I just noticed that you explicitely require sebastian/exporter in this PR, so this will probably work fine as long as the Exporter instances stay private.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i assume the phar vendors the exporter differently to prevent conflicts with a different version explicitly being installed in the repository so the actual fix is adding the sebastian/exporter to the composer requirements

@wickedOne
Copy link
Contributor Author

piepline fails due to phpunit config.
should be an easy fix, but perhaps better to know upfront about the update stragety: will you release a new major for phpunt 11 or do you want phpunit 10 & 11 support in one release?

composer.json Outdated
@@ -15,16 +15,12 @@
"require": {
"php": "^8.1",
"matthiasnoback/symfony-config-test": "^5.0",
"phpunit/phpunit": "^10.0 || ^11.0",
Copy link
Contributor

@Chris53897 Chris53897 Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it fix the lowest run, if you change it to ^10.5.11 || ^11.0

@dgriffiths-lanentech
Copy link

Do we have a rough idea of when this is going to be released? It’s preventing our application from being upgraded to PHPUnit 11.

@wickedOne
Copy link
Contributor Author

Do we have a rough idea of when this is going to be released? It’s preventing our application from being upgraded to PHPUnit 11.

ping @matthiasnoback @Nyholm

@matthiasnoback
Copy link
Collaborator

@wickedOne Sorry, I'm not personally involved in these libraries anymore.

@simPod
Copy link

simPod commented Apr 26, 2024

seems it's @stloyd now

@wickedOne
Copy link
Contributor Author

@matthiasnoback sorry, i wasn't aware of that :|

@matthiasnoback
Copy link
Collaborator

@wickedOne No problem :)

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR.
And thank you for the reviews.

I think this looks correct. I'll merge this PR and hope that you will test it before we tag a new major version.

@Nyholm Nyholm merged commit 0fcb91f into SymfonyTest:master Apr 26, 2024
13 checks passed
@wickedOne wickedOne deleted the phpunit-11 branch April 26, 2024 08:38
@wickedOne
Copy link
Contributor Author

@Nyholm here's one of my repos running succesfully with phpunit 10.5.11 and phpunit 11.1.3 (both php 8.2 & 8.3) and the dev-master of this repo

be aware that SymfonyTest/SymfonyConfigTest#79 still needs to be merged & tagged and added to the composer.json of this repo

@alexander-schranz
Copy link
Contributor

Is currently a released of this blocked by symfony/symfony#53812 ?

@Nyholm
Copy link
Member

Nyholm commented Jul 5, 2024

No, not what I know

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.

8 participants