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); }
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()); }