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
[RFC] Make Hamcrest A Required Dependency #435
Comments
Yeah, too many
|
I'd be up for using them internal to our own API. I think the BC break might be too far for 1.0.0 though clearly I should not have run afoul of NIH syndrome to start with! |
We're unlikely to change anything prior to 1.0.0, if even then so suddenly, so unless there are any objections, I'll commit it as a require tomorrow. |
Assuming no objections, I'll commit this change later. |
👎 This makes Mockery installation a lot heavier. |
👎 Since this has been introducued all my test fails because of #464 Mockery is perfectly functional without Hamcrest, so Hamcrest is not a dependency. Why force it to be? |
@Giuseppe-Mazzapica #464 has already been fixed. |
@GrahamCampbell where? If I require via Composer Mockery 0.9.4 (last one) and last PHPunit and I manually load all the PHP functions file during PHPUnit bootstrap (I need that because my tests uses PHPUnit functions) I still get the "function already defined" error. |
The very latest releases of phpunit and hamcrest should work. |
The hamcrest release only came out yesterday mind you. ;) |
@GrahamCampbell I don't require hamcrest, because I don't use it. Mockery 0.9.4 requires it for me. If I composer-require
and I do (in the PHPUnit bootstrap file): require_once 'path/to/vendor/autoload.php';
require_once 'path/to/vendor/phpunit/phpunit/src/Framework/Assert/Functions.php'; When I run tests I get:
On the countrary, if I composer-require
Everything works well. |
try
then reverse the order of those includes require_once 'path/to/vendor/phpunit/phpunit/src/Framework/Assert/Functions.php';
require_once 'path/to/vendor/autoload.php'; |
Thanks @davedevelopment
|
@Giuseppe-Mazzapica yes and no. You'd still have the problem if you didn't reverse the order of those includes (I think), which we can't do anything about. PHPUnit dumps those functions in the global namespace without consideration for anything that might already exist. |
Ok, actually 0.9.4 version of Mockery already requires the last version of hamcrest. The solution was just to reverse the order of includes. My opition:
The latter point was the reason I decided to comment here instead on #464 ... |
Closing this as it's done and I don't want to confuse issues with old ones. While recognising there is fragility, we've mitigated it as best we can short of reversing the RFC, and I'm not leaning towards a reversal. Mockery only has basic matchers, and we rely on Hamcrest to extend those. Most of the fragility isn't ours, and could be solved by PHPUnit putting some basic checks in place before loading functions into the global namespace. If it remains a concern, please feel free to bring up in a separate issue. |
Should end the debate over adding more matchers directly to Mockery, and also promote using the Hamcrest ones more consistently since everyone should now have it installed.
This assumes there are no other options we should be considering. Are there?
The text was updated successfully, but these errors were encountered: