我围绕 laravel 4 的查询构建器构建了一些功能,为了测试某个部分,我需要执行以下操作:
$dateTimeObject = new DateTime; // some other stuff with this object
$q->shouldReceive('where')->once()->with('baz', '>=', $dateTimeObject);
问题是,每当我这样做时,嘲弄试图将其转换为字符串,我得到错误:
Object of class DateTime could not be converted to string
我该如何解决这个问题?
(我正在使用phpunit和mockery进行测试)