コード例 #1
0
 function initPerson()
 {
     $person = new PersonForTest();
     $person->setName('Person_' . rand(0, 1000));
     return $person;
 }
コード例 #2
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'));
 }
コード例 #3
0
 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());
 }
コード例 #4
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());
 }