[TEST] dev/core#1572 Unit test environment not working on windows after recent CodeGen updates #16477
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
https://lab.civicrm.org/dev/core/issues/1572
Previously it loaded the database from sql files. Now it does it on the fly compiling the schema xml files, but the path used doesn't work on windows.
Before
Screen fills with errors trying to run a unit test.
After
Works like it used to.
Technical Details
DomDocument->xinclude()
in CRM_Core_CodeGen_Util_Xml is the main problem that doesn't work with backslashes. It's being passed a path that includes backslashes because the process gets started using__DIR__
as the root, which on windows comes through with backslashes, and then it can't find the schema files to include. Except for system calls out to batch files and such where it's windows itself consuming the parameters, php works better on windows using forward slashes same as unix.Comments
Another option if it's desired to have absolute paths is to use
str_replace("\\", '/', $civiRoot)
.