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
FOLIO: more flexible hold exclusion configuration #2683
FOLIO: more flexible hold exclusion configuration #2683
Conversation
…er based on substring match
Rookie mistake! I'm working on cleaning up the format issues and I'll make another commit tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @meganschanz -- I'm happy to merge this as is, but a suggestion for your consideration first: what if, instead of a binary excludeHoldLocationsBySubString setting, we had a excludeHoldLocationsCompareMode setting, with "exact" or "substring" options? This would open the way to adding additional options (like a "regex" mode) if we need them, without having to further redesign the configuration. Or we could implement regex mode now, and make "substring" a special case of regex (we could just add /.* ... .*/
around each value. Case sensitivity is another question: do we want to offer case-sensitive and case-insensitive versions? Using regular expressions makes it easier to configure this without having to add lots of different modes, since you can control it with regex switches.
Good idea. I much prefer that. I took your suggested and made a commit that has a setting with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great, @meganschanz! A few minor suggestions for finishing touches. It might also be nice to add some test coverage for the new behavior. If you'd like to try that and are not yet familiar with VuFind's test suite, I can point you to some resources and make some suggestions. If you don't have time, I can probably add a quick test myself before merging this.
Those suggestions look good. I just started in on writing the unit tests and ran into a problem, the
|
Thanks, @meganschanz! If you need to test a protected method, and there's not a straightforward way to test it via a public method, you can mix in the ReflectionTrait and use $this->callMethod(). |
I learned so much about the testing today... that Let me know if you have suggestions for any rework that could be done to the tests. When working on the tests, I also added in a small change to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the ongoing progress, @meganschanz -- this is looking great, and could nearly be merged as it is... but since you asked about test style, I provided some suggestions that I think will make this even better. I also had one small stylistic comment which you can use or ignore as you see fit. The only thing that I think we absolutely must do is fix the order of parameters in the assertions; the rest is a matter of taste.
One other tool in the PHPUnit test kit that I find very useful is the @dataProvider
annotation, which lets you separate your test logic from your test data in a useful way. You could use that for some of the tests here, though I think it's probably overkill. If you're interested in learning more about it, though, feel free to experiment.
Let me know if there's anything more I can do to help!
module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/FolioTest.php
Outdated
Show resolved
Hide resolved
module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/FolioTest.php
Outdated
Show resolved
Hide resolved
I spent some time playing around with the I made the other corrections and suggestions to the tests and removed the unnecessary else statement in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, @meganschanz -- thanks for taking the time to put it all together!
This adds a new config in the FOLIO driver to optionally exclude hold location matches by substrings instead of full string matches. This config is set to false by default for backwards compatibility.
This was useful for us because we have a dozens of locations we need to exclude that either start with or contain a string (such as "Reserve" or "Special Collection") but the full location have more specific qualifiers in them like the floor and the list would be quite long and difficult to maintain anytime a new location was added or changed.