How to set mySql's CURDATE date for tests?

140
October 01, 2018, at 10:10 PM

How can one easily set the date returned by mySql CURDATE() method to an arbitrary one?

Is it defined by the system clock? Can you send an SQL query to tweak it for testing?

We are setting a test environment for our API. We are building regression tests to make sure all endpoints perform the correct side effect and return the correct response.

However, endpoints that return the number of events for the current week will fail unless we change the CURDATE to match the date the test was written. The desired behaviour is to receive the same result even if a test is run in the future.

Rent Charter Buses Company
READ ALSO
Laravel query failed using function query

Laravel query failed using function query

I am trying to get sum of amount of all users group by monthBut if I add sum then query not work

141
Foreign keys not updating when using INSERT to send data [duplicate]

Foreign keys not updating when using INSERT to send data [duplicate]

This question already has an answer here:

135
Using ShellExecute or ShellexecuteEx with redirecting result

Using ShellExecute or ShellexecuteEx with redirecting result

Here is what I am trying to do is extracting a mysql table in a sql file :

120