Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with using timecop constructor #9

Closed
daveamol opened this issue Jul 3, 2015 · 1 comment
Closed

Issue with using timecop constructor #9

daveamol opened this issue Jul 3, 2015 · 1 comment

Comments

@daveamol
Copy link

daveamol commented Jul 3, 2015

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.

@daveamol daveamol changed the title Issue with using timecop with classes which a class extending datetime Issue with using timecop constructor Jul 3, 2015
hnw added a commit that referenced this issue Dec 23, 2016
hnw added a commit that referenced this issue Dec 23, 2016
@hnw
Copy link
Owner

hnw commented Dec 27, 2016

This bug has been fixed in php-timecop 1.1.3. Thanks for your report.

@hnw hnw closed this as completed Dec 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants