I wanna test testcase for PhalconDB error.
But I cannot operate source code for generating ones error.
I wanna generate error about Database(fx: connection error, transaction is not active....) without operating Source.
And more, I wanna generate error when my own timing(fx: If I am operating five table in database, generating error in index 3 table only.)
How solve this test? Is there something appropriate test tool??
Tell me both.
ExampleSource:(below)
$table_list =
[
'tableOne' => "table_one",
'tableTwo' => "table_two",
'tableThree' => "table_three",
'tableFour' => "table_four",
'tableFive' => "table_five"
];
foreach($table_list as $key => $table_name) {
try {
// transaction:start
$this->db->begin();
$this->db
->delete(
$table_name,
"post_date < '{$dead_line_date}' and perms_flg = 1"
);
} catch (\PDOException $e) {
$this->logger->error($this->formatExceptionMessage($this, $e, $log = $key."is failed."));
}
// Transaction:commit
$this->db->commit();
}
Aucun commentaire:
Enregistrer un commentaire