hamcrest / hamcrest-php

PHP Hamcrest implementation [Official]
Other
6.95k stars 44 forks source link

Functions not playing well with mockery with() method #1

Closed cordoval closed 10 years ago

cordoval commented 10 years ago

note: transferred from https://github.com/cordoval/hamcrest-php/issues/18

Appears to be isolated to the dev-master version. When using hamcrest functions within mockery with() method, requirements never seem to be satisfied, even when using anything().

This post on stackoverflow explains in more detail: http://stackoverflow.com/questions/18277670/using-hamcrests-haskeyvaluepair-with-laravels-unit-test?answertab=oldest#tab-top

cordoval commented 10 years ago

You're suggesting that anything() function, which internally calls \Hamcrest\Core\IsAnything::anything($description); and returns matcher doesn't work?

Have you checked, that other matchers are affected as well?

cordoval commented 10 years ago

I see, that problem comes from Mockery code https://github.com/padraic/mockery/blob/master/library/Mockery/Expectation.php#L303 where it check for \Hamcrest_Matcher (which is compatible with official Hamcrest 1.1.0 release), but not for \Hamcrest\Matcher, which is new name for same class.

cordoval commented 10 years ago

I've posted issue to Mockery repo: padraic/mockery#225

cordoval commented 10 years ago

ping @aik099 what is the status of this? since we have now fluid communication with @davedevelopment we can perhaps get some feedback?

aik099 commented 10 years ago

I've updated https://github.com/padraic/mockery/pull/170 to make Mockery compatible with Hamcrest 1.1 (with namespaces) and use official repo (this one) as a dependency.

cordoval commented 10 years ago

we should probably tag 1.2 or 2.0 on here so to mark the compatibility support. Also let's note that on the changelog there as i see there is none. @aik099 good job

aik099 commented 10 years ago

we should probably tag 1.2 or 2.0 on here so to mark the compatibility support

The changes, that we made since 1.1.0 release are cosmetic ones and related to repo location/packagist only. No actual code changes really. That's why it's of no big importance to create a release for that, but we can create 1.1.1 if you wish. Repository move to different location isn't really a big code change to create 1.2 or even 2.0 release.

Also let's note that on the changelog there as i see there is none.

You mean, that we don't note changes made in each release here: https://github.com/hamcrest/hamcrest-php/releases

I think we should. Luckily there is a way to edit release notes after release was made too. Would you like to prepare release notes for each of releases? Actually you can put them in place yourself too.

cordoval commented 10 years ago

http://github.com/cordoval/manager-tools

davedevelopment commented 10 years ago

My two cents, I think going forward you should semver, I would have 2.0 the namespaced version.

cordoval commented 10 years ago

bump @aik099 is this still an issue?

aik099 commented 10 years ago

Nope thanks to https://github.com/padraic/mockery/blob/master/library/Mockery/Expectation.php#L309 change.