상속: extends Model_Person
예제 #1
0
 public function testSaveAndUnload()
 {
     $a = ['user' => [1 => ['name' => 'John', 'surname' => 'Smith', 'gender' => 'M'], 2 => ['name' => 'Sarah', 'surname' => 'Jones', 'gender' => 'F']]];
     $p = new Persistence_Array($a);
     $m = new Model_Male($p, 'user');
     $m->load(1);
     $this->assertTrue($m->loaded());
     $m['gender'] = 'F';
     $m->saveAndUnload();
     $this->assertFalse($m->loaded());
     $m = new Model_Female($p, 'user');
     $m->load(1);
     $this->assertTrue($m->loaded());
     $this->assertEquals(['user' => [1 => ['name' => 'John', 'surname' => 'Smith', 'gender' => 'F'], 2 => ['name' => 'Sarah', 'surname' => 'Jones', 'gender' => 'F']]], $a);
 }