Pheasant\Tests\TypeMarshallingTest::testDateTimeTypesAreRoundTripped PHP Method

testDateTimeTypesAreRoundTripped() public method

    public function testDateTimeTypesAreRoundTripped()
    {
        $ts = new \DateTime();
        $object = new DomainObject(array('type' => 'Llama'));
        $object->timecreated = $ts;
        $object->save();
        $this->assertRowCount(1, "SELECT * FROM domainobject WHERE timecreated='" . $ts->format('c') . "'");
        $llamaById = DomainObject::byId(1);
        $this->assertSame($llamaById->id, 1);
        $this->assertSame($llamaById->type, 'Llama');
        $this->assertSame($llamaById->timecreated->getTimestamp(), $ts->getTimestamp());
    }