示例#1
0
 /**
  * Testing that the saveHistory() method is automatically invoked when it should be.
  *
  * @since 1.2.1
  * @dataProvider getActiveRecordProviders
  */
 public function testSaveHistory($provider)
 {
     $config = ConfigProvider::getInstance();
     $config->set('db.provider.name', $provider);
     $this->person->setMaintainHistory(true);
     $this->person->rebuildTable();
     // this should result in the _history table being created
     $this->person->set('password', 'passwordhist1');
     $this->person->save();
     $this->assertEquals(1, $this->person->getHistoryCount(), 'Testing that a normal save is propegated to the history table for this class');
     $this->person->saveAttribute('password', 'passwordhist2');
     $this->assertEquals(2, $this->person->getHistoryCount(), 'Testing that an attribute save is propegated to the history table for this class');
     $this->person->dropTable('Person_history');
 }