Can I change Mysql current time CURTIME() in query for testing purposes? -


i have unit test, , want curtime() return same time, can somehow ?

i can set timezone:

set time_zone = 'america/new_york'; select curtime(); 

but there way set time ?

part of query is:

(curtime() between time(convert_tz(opening_time, timezone, "utc")) , time(convert_tz(closing_time, timezone, "utc"))) 

i want test more timezones , different times

curtime() based on server timezone, way make change directly changing server timezone:

set time_zone = 'france/paris'; 

in debugging purposes, use @juergend idea use static time string make tests.

edit: didn't read well, knew part. still, don't understand why don't use static time string in query, no matter how many times have in query

 ('12:34:56' between time(convert_tz(opening_time, timezone, "utc")) , time(convert_tz(closing_time, timezone, "utc"))) 

Comments

Popular posts from this blog

testing - Detect whether test has failed within fixture -

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

android - Create single AAR file from multiple modules using Gradle -