[testbox-2.6.0] Mocking dates and Times

Is there a way in our test to define or mock the system timezone, date or time?

I have functions that format timestamps based on the difference between the server and UTC.
I am struggling to have assertions that can reliably match.

As an example I have a webservice that I interact with that requires timestamps to be in UTC with a custom format.
I have a method that properly converts and formats the source timestamp but since the result varies depending on the location
of machine running the test, I cannot reliably predict the result in an assertion.

If I am in Portugal and within the seven hour difference the day changes since it can be the 27th here while still the 26th in the MDT, so my test will fail.

If I could mock the system time for those calls I could say run this test at this specific day and time and get back a consistent result.

I can create test that always work in a specific timezone but If I then run the test form a different timezone or too close to midnight they will fail.

Thank you

What functions are you using for this timezone logic? If it’s built in CFML functions then I’m not sure what options you have. Have you tried this?
https://cfdocs.org/settimezone

You should also be able to set the timezone for the server in the JVM settings.