示例#1
0
 public function Test_of_afterDestroy_and_beforeDestroy()
 {
     $TodoItems = new TodoItem(10);
     $TodoItems->transactionStart();
     $TodoItems->destroy();
     $this->assertFalse($TodoItems->list->isInList());
     $todo_list = $this->_getTodoList();
     $this->assertEqual($todo_list[10], 'Task number 11');
     $this->assertEqual($todo_list[14], 'Task number 15');
     $TodoItems->destroy(array(15, 16));
     $todo_list = $this->_getTodoList();
     $this->assertEqual($todo_list[13], 'Task number 14');
     $this->assertEqual($todo_list[14], 'Task number 17');
     $this->assertEqual($todo_list[15], 'Task number 18');
     $TodoItems->transactionFail();
     $TodoItems->transactionComplete();
     $todo_list = $this->_getTodoList();
     $this->assertEqual($todo_list[10], 'Task number 10', 'Test failed because a database transaction was not performed correctly');
 }