Exemplo n.º 1
0
 /**
  * @testdox A record can be deleted, and it's history along with it.
  */
 public function delete()
 {
     $testTypes = $this->db->getTable('test_types');
     $changesets = $this->db->getTable(ChangeTracker::changesets_name());
     // Create two, to make sure only one is deleted.
     $testTypes->saveRecord(array('title' => 'First Type'));
     $testTypes->saveRecord(array('title' => 'Second Type'));
     // Make sure we've got the right number of changesets (one is from the install process).
     $this->assertEquals(2, $testTypes->getRecordCount());
     $this->assertEquals(3, $this->db->query('SELECT COUNT(*) FROM changesets')->fetchColumn());
     $this->assertEquals(3, $changesets->getRecordCount());
     // Delete a record, and both counts should go down by one.
     $testTypes->deleteRecord(2);
     $this->assertEquals(1, $testTypes->getRecordCount());
     $this->assertEquals(2, $this->db->query('SELECT COUNT(*) FROM changesets')->fetchColumn());
     $this->assertEquals(2, $changesets->getRecordCount());
 }