<?php
-require_once 'CiviTest/CiviUnitTestCase.php';
-require_once 'CiviTest/Contact.php';
-require_once 'CiviTest/Custom.php';
/**
* Class CRM_Core_TransactionTest
+ * @group headless
*/
class CRM_Core_TransactionTest extends CiviUnitTestCase {
$this->cids = array();
}
+ /**
+ * @return array
+ */
public function dataCreateStyle() {
return array(
array('sql-insert'),
);
}
+ /**
+ * @return array
+ */
public function dataCreateAndCommitStyles() {
return array(
array('sql-insert', 'implicit-commit'),
}
/**
- * Test in which an outer function makes multiple calls to inner functions
+ * Test in which an outer function makes multiple calls to inner functions.
* but then rolls back the entire set.
*
* @param string $createStyle
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_COMMIT, array($this, '_preCommit'), array(
'qwe',
- 'rty'
+ 'rty',
));
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, array($this, '_postCommit'), array(
'uio',
- 'p[]'
+ 'p[]',
));
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_ROLLBACK, array(
$this,
- '_preRollback'
+ '_preRollback',
), array('asd', 'fgh'));
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_ROLLBACK, array(
$this,
- '_postRollback'
+ '_postRollback',
), array('jkl', ';'));
CRM_Core_DAO::executeQuery('UPDATE civicrm_contact SET id = 100 WHERE id = 100');
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_COMMIT, array($this, '_preCommit'), array(
'ewq',
- 'ytr'
+ 'ytr',
));
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, array($this, '_postCommit'), array(
'oiu',
- '][p'
+ '][p',
));
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_ROLLBACK, array(
$this,
- '_preRollback'
+ '_preRollback',
), array('dsa', 'hgf'));
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_ROLLBACK, array(
$this,
- '_postRollback'
+ '_postRollback',
), array('lkj', ';'));
CRM_Core_DAO::executeQuery('UPDATE civicrm_contact SET id = 100 WHERE id = 100');
}
/**
- * Perform a series of operations within smaller transactions
+ * Perform a series of operations within smaller transactions.
*
* @param string $nesting
* 'reuse-tx'|'nest-tx' how to construct transaction.
* See assertContactsMix.
* @param string $outcome
* 'rollback'|'implicit-commit'|'explicit-commit' how to finish transaction.
- * @return int
- * cid
+ * @return void
*/
public function runBatch($nesting, $callbacks, $existsByOffset, $outcome) {
if ($nesting != 'reuse-tx' && $nesting != 'nest-tx') {
} // else: implicit-commit
}
+ /**
+ * @param $arg1
+ * @param $arg2
+ */
public function _preCommit($arg1, $arg2) {
$this->callbackLog[] = array('_preCommit', $arg1, $arg2);
}
+ /**
+ * @param $arg1
+ * @param $arg2
+ */
public function _postCommit($arg1, $arg2) {
$this->callbackLog[] = array('_postCommit', $arg1, $arg2);
}
+ /**
+ * @param $arg1
+ * @param $arg2
+ */
public function _preRollback($arg1, $arg2) {
$this->callbackLog[] = array('_preRollback', $arg1, $arg2);
}
+ /**
+ * @param $arg1
+ * @param $arg2
+ */
public function _postRollback($arg1, $arg2) {
$this->callbackLog[] = array('_postRollback', $arg1, $arg2);
}
+
}