コード例 #1
0
 function testUpdateOnlyDirtyFieldsInDbForNotNewObject()
 {
     $object = new TestOneTableObject();
     $object->setAnnotation('some annotation');
     $object->setContent($initial_content = 'some content');
     $object->save();
     $object->setAnnotation('some other annotation');
     $object->setContent('some other content');
     $object->resetPropertyDirtiness('content');
     // suppose we don't want to save this field
     $object->save();
     $loaded_object = lmbActiveRecord::findById('TestOneTableObject', $object->getId());
     $this->assertEqual($loaded_object->getAnnotation(), $object->getAnnotation());
     $this->assertEqual($loaded_object->getContent(), $initial_content);
 }
コード例 #2
0
 function testPassingArrayToConstructorCallsImport()
 {
     $source = array('id' => 1000, 'annotation' => 'Some annotation', 'content' => 'Some content');
     $object = new TestOneTableObject($source);
     $this->assertEqual($object->getId(), 1000);
     $this->assertEqual($object->getAnnotation(), 'Some annotation');
     $this->assertEqual($object->getContent(), 'Some content');
 }