Skip to content

Issue with using timecop constructor #9

Closed
@daveamol

Description

@daveamol

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions