-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Right now, BrainMonkey already covers all those functions that you have to stubs in 90% of the cases, when you write enough unit tests for your code.
However, there are many functions that are not used so often, but still they are used quite enough and same enough to avoid duplication in every unit test setup.
Here's a link of all the functions I've spotted.
home_url()
Also if this function is very simple and in most of the case the stub only returns a static string, it is used really a lot and in many cases it must be stubbed with a callback usage.
sanitize_text_field()
This is used quite often as well, however I see that sometimes it is aliased with a callback very specific to a single test, so maybe it needs to be called in a separate function?
wp_validate_boolean()
Also if this is one of the less stubbed, I believe we can assume it always will need the same alias, so probably it worth to be centralized as well.
add_query_arg()
This isn't very used neither, but it's very boring to stub if you need to alias it.
wp_slash()
Again, not used so often but very simple to centralize in my opinion.
How to proceed
I think that one of the important things to decide, in addition to specific aliases, is how to "group" the stubs. Right now, the package provides the functions stubTranslationFunctions() and stubEscapeFunctions() and we can assume that if I need one of the functions stubbed there, then I need also the others. However, about the functions named above, I could want a generic alias for certain functions but some specific alias created by me for others, and I am not sure that the package allows to "override" the alias in some way.