-
Notifications
You must be signed in to change notification settings - Fork 41
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
A "LIKE" specification #29
Conversation
My apologies, I pushed an extra commit (668ce73) here for something else. I didn't expect it to also add it to this pull request. |
Thank you @AndyBursh for your PR. I think the PHPSpec looks good. @cakper is really the expert there =) I would like you to add a factory function for the Like spec. Just ad a function in this class. |
Of course, not a problem. The factory method is implemented in a040cf5. |
👍 thanks for your work :) specs are good :) nothing to add there, I'm happy that you managed to write them even tho you never used PhpSpec @Nyholm I'm fine with this PR, mergning |
👍 |
Nyholm, cakper
I really like your library. I've evaluated it for use at work, and it seems really easy to use and extend. Whilst using it, though, I found a couple of little things I thought were missing.
This pull request is for the first of the missing things I identified: a "like" specification. It's pretty simple and builds on your existing work with other types of comparison. I'm not sure how I feel about taking a pattern as the format and calling
sprintf($format, $value)
, but I think it works for a first iteration.I'm also not sure about the order of the parameters. I think it'd be more readable to take the format between field and value parameters (ie
new S\Like("baz", S\Like::CONTAINS, "bing")
), but that wouldn't match the signature of the other specifications and wouldn't allow a default parameter. What do you think?Usage example:
Regards,
Andy
P.S. Do the spec tests look OK? I've not used PHPSpec before.