burnbright/silverstripe-shop — pull request #252 by chillu (2014-05-27 01:24:27+00:00)
Title: API Fixed CartCleanupTask, define time in mins rather than relative

Relative time is prone to errors. Case in point:

With a current date of 2014-05-27 13:05:21

php -r 'var_dump(date("Y-m-d H:m:i",strtotime("-2 hours")));'
string(19) "2014-05-27 11:05:21"

php -r 'var_dump(date("Y-m-d H:m:i",strtotime("-2 hrs")));'
string(19) "2014-05-28 03:05:21"

This would delete ALL of your pending orders because of a typo.

Also fixed the task itself, it plainly wasn't working (undefined $cart etc).
Didn't want to introduce a mocking library into the project, so written
a small fake as a simple subclass in unit tests.