コード例 #1
0
 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());
 }
コード例 #2
0
 function testSettingSameTablePropertyValueDoesntMakeObjectDirty()
 {
     $object = new TestOneTableObject();
     $object->setContent('whatever');
     $object->save();
     $this->assertFalse($object->isDirty());
     $object->setContent($object->getContent());
     $this->assertFalse($object->isDirty());
     $object->setContent('whatever else');
     $this->assertTrue($object->isDirty());
 }