function testPassingActiveRecordToConstructorCallsImport() { $object1 = new TestOneTableObject(); $object1->setAnnotation($annotation = 'Some annotation'); $object1->save(); $object2 = new TestOneTableObject($object1); $this->assertEqual($object2->getId(), $object1->getId()); $this->assertEqual($object2->getAnnotation(), $annotation); $this->assertFalse($object2->isNew()); $this->assertTrue($object2->isDirty()); }
function testPassingIntToConstructorLoadsObject() { $object1 = $this->creator->createOneTableObject(); $object2 = new TestOneTableObject($object1->getId()); $this->assertEqual($object2->export(), $object1->export()); $this->assertFalse($object2->isNew()); }