コード例 #1
0
 function testImportPreservesIdOfExistingObject()
 {
     $object = new TestOneTableObject();
     $object->setAnnotation('Initial annotation');
     $object->save();
     $id = $object->getId();
     $source = array('id' => 10000, 'annotation' => 'Some annotation', 'content' => 'Some content');
     $object->import($source);
     $this->assertEqual($object->getId(), $id);
     $this->assertNotEqual($object->getId(), 1000);
     // just one extra check
     $this->assertEqual($object->getAnnotation(), 'Some annotation');
     $this->assertEqual($object->getContent(), 'Some content');
 }