Issue with using timecop constructor
daveamol opened this issue · comments
I have the following date class which I use just to represent dates by extending the datetime object.
Code in Date.php
class Date extends \DateTime
{
public function __construct($time='now', \DateTimeZone $timezone=null)
{
parent::__construct($time, $timezone);
$this->setTime(0, 0, 0);
}
public function __toString() {
return $this->format('Y-m-d');
}
}
While trying to use timecop in my test cases it throws the following error -
PHP Fatal error: Class entry requested for an object without PHP class in
Date.php
Basically when calling the constructor with the timezone parameter as null does not work.
This bug has been fixed in php-timecop 1.1.3. Thanks for your report.