示例#1
0
 /**
  * Testing that we can load dirty and new objects post commit.
  *
  * @since 1.0
  */
 public function testPostCommitLoad()
 {
     $this->person->set('email', '*****@*****.**');
     $this->controller->markDirty($this->person);
     $person = $this->createPersonObject('newuser');
     $person->set('email', '*****@*****.**');
     $this->controller->markNew($person);
     try {
         $this->controller->commit();
     } catch (FailedUnitCommitException $e) {
         $this->fail('Failed to commit the unit of work transaction for new and dirty objects');
     }
     $newPerson = new Person();
     try {
         $newPerson->loadByAttribute('email', '*****@*****.**');
     } catch (RecordNotFoundException $e) {
         $this->fail('Failed to load the new person that we commited in the unit of work');
     }
     $dirtyPerson = new Person();
     try {
         $dirtyPerson->loadByAttribute('email', '*****@*****.**');
     } catch (RecordNotFoundException $e) {
         $this->fail('Failed to load the dirty person that we commited in the unit of work');
     }
 }