Reputation: 2428
I have this class
class DateTimeHelper
{
public static function getDateTimeNow()
{
return new \DateTime('now');
}
}
And I want in tests redefine output to date that I want:
So I do:
$r = runkit_method_redefine(
DateTimeHelper::class,
'getDateTimeNow',
'',
'return new \DateTime(\'2016-01-01\');',
(RUNKIT_ACC_PUBLIC | RUNKIT_ACC_STATIC)
);
var_dump($r);
var_dump(DateTimeHelper::getDateTimeNow());
But runkit always returns false. So method is not redefined I get current datetime and can't get more info about what is wrong.
Is there way to to get more information wht is wrong or am I doing something wrong?
Upvotes: 1
Views: 135