Пример #1
0
 function testCopySystemStatus()
 {
     $objAspect = new class_module_system_aspect();
     $objAspect->setStrName("copytest");
     $objAspect->updateObjectToDb();
     $strSysid = $objAspect->getSystemid();
     $objAspect->setIntRecordStatus(0);
     $objAspect->updateObjectToDb();
     $objAspect->copyObject();
     $strCopyId = $objAspect->getSystemid();
     $objAspect = new class_module_system_aspect($strSysid);
     $objCopy = new class_module_system_aspect($strCopyId);
     $this->assertEquals($objAspect->getStrName(), $objCopy->getStrName());
     $this->assertEquals($objAspect->getStrPrevId(), $objCopy->getStrPrevId());
     $this->assertEquals($objAspect->getIntRecordStatus(), $objCopy->getIntRecordStatus());
     $this->assertEquals($objAspect->getStrRecordClass(), $objCopy->getStrRecordClass());
     $this->assertNotEquals($objAspect->getSystemid(), $objCopy->getSystemid());
 }
Пример #2
0
 public function testCopyRecordWithTag()
 {
     $objAspect = new class_module_system_aspect();
     $objAspect->setStrName("autotest");
     $objAspect->updateObjectToDb();
     $objTag = new class_module_tags_tag();
     $objTag->setStrName("demo tag");
     $objTag->updateObjectToDb();
     $objTag->assignToSystemrecord($objAspect->getStrSystemid());
     $objFirstAspect = new class_module_system_aspect($objAspect->getSystemid());
     $objAspect->copyObject();
     $this->assertNotEquals($objFirstAspect->getSystemid(), $objAspect->getSystemid());
     $this->assertEquals(count(class_module_tags_tag::getTagsForSystemid($objFirstAspect->getSystemid())), count(class_module_tags_tag::getTagsForSystemid($objAspect->getSystemid())));
     $arrTagsFirst = class_module_tags_tag::getTagsForSystemid($objFirstAspect->getSystemid());
     $objFirstTag = $arrTagsFirst[0];
     $arrTagsCopy = class_module_tags_tag::getTagsForSystemid($objAspect->getSystemid());
     $objSecondTag = $arrTagsCopy[0];
     $this->assertEquals($objFirstTag->getSystemid(), $objSecondTag->getSystemid());
     $objFirstAspect->deleteObjectFromDatabase();
     $objAspect->deleteObjectFromDatabase();
     $objSecondTag->deleteObjectFromDatabase();
 }