function pg($t) { global $pdo; $tm = new TransactionManager($pdo); $txn1 = $tm->txn_scope(); $pdo->query("INSERT INTO job (func) VALUES ('baz')"); $txn2 = $tm->txn_scope(); $pdo->query("INSERT INTO job (func) VALUES ('bab')"); $txn2->commit(); $txn1->commit(); $stmt = $pdo->query('SELECT * FROM job'); $rows = $stmt->fetch(PDO::FETCH_ASSOC); $t->is(sizeof($rows), 2); $stmt->closeCursor(); }
function pass_arbitrary_caller_info($t) { $pdo = Utils::setup(); $tm = new TransactionManager($pdo); $caller = array('file' => 'hoge.php', 'line' => 1); $txn = $tm->txn_scope($caller); set_error_handler('_error_handler2'); $txn = null; restore_error_handler(); }