コード例 #1
0
 function testCustomLazyFieldsInFindFirst()
 {
     $object = new TestOneTableObject();
     $object->setAnnotation($annotation = "Annotation");
     $object->setContent($content = "Content");
     $object->save();
     $object2 = lmbActiveRecord::findFirst('TestOneTableObject', array('fields' => array('annotation')));
     $fields = $object2->exportRaw();
     //checking which props were actually loaded
     $this->assertEqual($fields, array('id' => $object->getId(), 'annotation' => $annotation));
     //lazy loading in action
     $this->assertEqual($object2->getAnnotation(), $annotation);
     $this->assertEqual($object2->getContent(), $content);
 }
コード例 #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());
 }