You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am writing a library that use pspell for some functionality, but pspell is not a requirement. Therefore I do not want to assume that pspell is available, and particularly not in my tests. I am patching the functions pspell_new and pspell_check in my tests.
Since the functions may not be available, I define the functions if they do not exist:
When pspell is not available, however, patchwork.json must look like this:
{
}
But since I don't know whether pspell will be available on the system, I cannot determine what patchwork.json should look like. How can I patch functions that may either be internal or user-defined?
The text was updated successfully, but these errors were encountered:
Stadly
changed the title
Patching function that may not exist
Patching function that may be both internal and user-defined
Nov 28, 2018
I have a similar issue depending on what PHP modules are/not involved in local environment vs CI/CD build server where the tests may run. In particular the php_ldap module and trying to provide stubs for ldap_bind, ldap_connect, etc.
The closest I have come while keeping the patchwork.json with contents is have my bootstrap.php file include a function exists check before defining a version that patching could override. But that still nets a "Patchwork\Exceptions\DefinedTooEarly: The file that defines ldap_bind() was included earlier than Patchwork." error.
Might there be some config option that can be set to let internal functions that do not exist still be defined via patchwork?
I am writing a library that use pspell for some functionality, but pspell is not a requirement. Therefore I do not want to assume that pspell is available, and particularly not in my tests. I am patching the functions
pspell_new
andpspell_check
in my tests.Since the functions may not be available, I define the functions if they do not exist:
This issue is what should
patchwork.json
look like?When pspell is available, it works when
patchwork.json
looks like this:When pspell is not available, however,
patchwork.json
must look like this:But since I don't know whether pspell will be available on the system, I cannot determine what
patchwork.json
should look like. How can I patch functions that may either be internal or user-defined?The text was updated successfully, but these errors were encountered: