Skip to content

[PhpUnitBridge] Enable Prophecy integration via env variable #39387

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

Closed
derrabus opened this issue Dec 8, 2020 · 4 comments · Fixed by #40059
Closed

[PhpUnitBridge] Enable Prophecy integration via env variable #39387

derrabus opened this issue Dec 8, 2020 · 4 comments · Fixed by #40059

Comments

@derrabus
Copy link
Member

derrabus commented Dec 8, 2020

Description
PHPUnit's built-in Prophecy integration is deprecated and will be removed soon. The replacement package phpspec/prophecy-phpunit however only works with PHPUnit 9.

Maybe we can have simple-phpunit install that package if we're running PHPUnit 9 and a yet to be defined environment variable is set.

@nicolas-grekas
Copy link
Member

Like SYMFONY_PHPUNIT_REQUIRE to mirror SYMFONY_PHPUNIT_REMOVE?

@derrabus
Copy link
Member Author

derrabus commented Dec 8, 2020

Yes something like that. But with the extra constraint that phpspec/prophecy-phpunit will only be installed for PHPUnit 9.1 and above and assumed to be present if we're on a lower PHPUnit version.

@nicolas-grekas
Copy link
Member

We do remove prophecy by default in the bridge...
I'd better not do any fancy logic here...

@acasademont
Copy link
Contributor

acasademont commented Jan 16, 2021

This would be great! Right now we have a ton of deprecation messages when using phpunit 9.4 provided by the bridge that we can't really fix.

PS: Unless we require phpspec/prophecy-phpunit directly on our composer, which is not really desirable as it will install phpunit as a dependency

acasademont added a commit to acasademont/symfony that referenced this issue Feb 1, 2021
acasademont added a commit to acasademont/symfony that referenced this issue Feb 1, 2021
@fabpot fabpot closed this as completed Feb 5, 2021
fabpot added a commit that referenced this issue Feb 5, 2021
…le (acasademont)

This PR was merged into the 5.3-dev branch.

Discussion
----------

[PhpUnitBridge] Add SYMFONY_PHPUNIT_REQUIRE env variable

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #39387
| License       | MIT
| Doc PR        | symfony/symfony-docs#14913

As discussed on #39387, this PR adds a new `SYMFONY_PHPUNIT_REQUIRE` env variable to add packages to the phpunit bridge installation. This is useful for adding phpunit plugins (ie: https://github.com/phpspec/prophecy-phpunit) without having to add them directly to the main app composer.json.

On my `phpunit.xml.dist` file I can now add

```xml
<server name="SYMFONY_PHPUNIT_REQUIRE" value="phpspec/prophecy-phpunit"/>
```

And the `phpspec/prophecy-phpunit` will be installed along the rest of the phpunit packages

Commits
-------

94e1d87 Add SYMFONY_PHPUNIT_REQUIRE env variable Fixes #39387
nlhommet pushed a commit to nlhommet/symfony that referenced this issue Feb 18, 2021
junaidbinfarooq pushed a commit to junaidbinfarooq/symfony that referenced this issue Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants