I have a PHP application and I want to test the functionality where it records each login attempt in the database, including the time of the login attempt. The SQL statement that I'm trying to test is "INSERT INTO logins VALUES {$email}, {$user_id}, NOW(), {$_SERVER['REMOTE_ADDR']}, {$login_successful}". The problem is, I can't figure out how to use PHPUnit to accomplish this. The issue is that PHPUnit seems to require that I write up my expected data set in an XML file and then compare that file to what's in the database --- but since the value of NOW() depends on when I'm running the test, I can't have a pre-written file to compare against. Has anybody else run into this issue, and what's the best way to work around it? Thanks.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.