示例#1
0
 function testUnsettingOneToOneChildObjectMakesPropertyDirty()
 {
     $person = new PersonForTest();
     $person->setName('Jim');
     $number = new SocialSecurityForTest();
     $number->setCode('099123');
     $person->setSocialSecurity($number);
     $person->save();
     $person->setSocialSecurity(null);
     $this->assertTrue($person->isDirtyProperty('social_security'));
 }
 function testDontResetParentIfChildImport()
 {
     $person = $this->creator->initPerson();
     $number = $this->creator->initSocialSecurity();
     $person->setSocialSecurity($number);
     $person->save();
     $source = array('name' => $person->getName());
     $person2 = new PersonForTest($person->getid());
     $person2->save();
     $this->assertEqual($person2->getName(), $person->getName());
     $this->assertEqual($person2->getSocialSecurity()->getCode(), $number->getCode());
 }
示例#3
0
 function testImportNullEntityEmptyString()
 {
     $person = new PersonForTest();
     $person->setName('Jim');
     $number = new SocialSecurityForTest();
     $number->setCode('099123');
     $person->setSocialSecurity($number);
     $person->save();
     $source = array('name' => $person->getName(), 'social_security' => '');
     $person2 = clone $person;
     $person2->import($source);
     $this->assertEqual($person2->getName(), $person->getName());
     $this->assertNull($person2->getSocialSecurity());
 }