merefield is facing an issue while writing a Front End test for the Locations Plugin. They are attempting to override the Site object with a custom fixture, but the data is not persisting. The test fails due to a missing country_codes attribute.
After investigation, merefield found that the Site object is set by the core test helper and cannot be overridden directly. They tried modifying the fixture in core, but that’s not the desired solution.
Finally, merefield solved the issue by using the needs method to specify the custom fixture for the Site object. The solution involves adding needs.site(cloneJSON(siteFixtures["country_codes.json"])); to the test code. This allows the custom fixture to be used for the scope of the test, resolving the issue.
but when the User Card is clicked, the data is not what you’d expect and critically, the country_codes attribute is missing, so the test grinds to a halt, here:
But I don’t want that, I want to override it in my plugin test with a fixture stored in my plugin.
To re-iterate, I’m able to do that for the scope of the test code but once the plugin code is running, the scope appears to pick up the site object that relates to the fixture loaded by the core test helper …