54 require_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
55 ilUnitUtil::performInitialisation();
56 require_once(
'./Services/Database/classes/Atom/class.ilAtomQueryBase.php');
57 require_once(
'./Services/Database/classes/Atom/class.ilAtomQueryTransaction.php');
58 require_once(
'./Services/Database/classes/Atom/class.ilAtomQueryLock.php');
59 require_once(
'./Services/Database/classes/class.ilDBWrapperFactory.php');
61 global $ilClientIniFile;
63 $this->ilDBInterfaceGalera->initFromIniFile($ilClientIniFile);
64 $this->ilDBInterfaceGalera->connect();
67 $this->ilDBInterfaceInnoDB->initFromIniFile($ilClientIniFile);
68 $this->ilDBInterfaceInnoDB->connect();
73 $ilAtomQueryTransaction = $this->ilDBInterfaceGalera->buildAtomQuery();
77 $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
117 $ilAtomQuery = $this->ilDBInterfaceGalera->buildAtomQuery();
118 $ilAtomQuery->addTableLock(
'object_data');
119 $this->assertEquals(
array(), $ilAtomQuery->getRisks());
124 require_once(
'./Services/Database/classes/PDO/class.ilDBPdoMySQL.php');
125 require_once(
'./Services/Database/test/Atom/data/class.ilAtomQueryTestHelper.php');
127 $ilAtomQuery = $this->ilDBInterfaceGalera->buildAtomQuery();
129 $this->assertTrue($ilAtomQuery->checkCallable(function (
ilDBInterface $ilDBInterface) { }));
133 $this->assertFalse($ilAtomQuery->checkCallable(function () { }));
134 $this->assertFalse($ilAtomQuery->checkCallable(function (
ilDBInterface $ilDBInterface, $someOtherParameter) { }));
135 $this->assertFalse($ilAtomQuery->checkCallable(function ($someOtherParameter,
ilDBInterface $ilDBInterface) { }));
136 $this->assertFalse($ilAtomQuery->checkCallable(function (
ilDBPdoMySQL $ilDBInterface) { }));
137 $this->assertFalse($ilAtomQuery->checkCallable(function ($ilDBInterface) { }));
138 function noClosure() { }
140 $this->assertFalse($ilAtomQuery->checkCallable(
'noClosure'));
146 $this->setExpectedException(
'ilDatabaseException');
148 $ilAtomQuery->addTableLock(
'il_db_tests_atom');
165 $result = $ilDBInterface->listTables();
168 $ilAtomQuery = $this->ilDBInterfaceGalera->buildAtomQuery();
169 $ilAtomQuery->addQueryCallable(
$query);
170 $ilAtomQuery->addTableLock(
'object_data');
172 $this->assertTrue(is_array(
$result));
186 $result = $ilDBInterface->listTables();
189 $ilAtomQuery = $this->ilDBInterfaceGalera->buildAtomQuery();
190 $ilAtomQuery->addQueryCallable(
$query);
191 $ilAtomQuery->addTableLock(
'object_data');
195 $this->assertTrue(is_null(
$result));
201 $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
208 $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
209 $ilAtomQuery->addTableLock(
'object_data');
216 $ilAtomQuery = $this->ilDBInterfaceGalera->buildAtomQuery();
217 $ilAtomQuery->addTableLock(
'object_data');
218 $ilAtomQuery->addQueryCallable(
function (
ilDBInterface $ilDBInterface) { });
219 $ilAtomQuery->addQueryCallable(
function (
ilDBInterface $ilDBInterface) { });
225 $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
226 $ilAtomQuery->addTableLock(
'il_db_tests_atom');
227 $ilAtomQuery->addTableLock(
'il_db_tests_atom');
228 $ilAtomQuery->addQueryCallable(
function (
ilDBInterface $ilDBInterface) { });
235 $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
236 $ilAtomQuery->addTableLock(
'il_db_tests_atom')->aliasName(
'alias_one');
237 $ilAtomQuery->addTableLock(
'il_db_tests_atom')->aliasName(
'alias_one');
238 $ilAtomQuery->addQueryCallable(
function (
ilDBInterface $ilDBInterface) { });
const DB_ATOM_CLOSURE_NONE
Class ilAtomQueryTransaction.
const ISOLATION_SERIALIZABLE
static checkAnomaly($anomalie)
TestCase for the ilDatabaseAtomBaseTest.
testWrongIsolationLevel()
const ISOLATION_READ_COMMITED
Class ilDatabaseException.
const ISOLATION_REPEATED_READ
const TYPE_PDO_MYSQL_INNODB
testQueryWithTenException()
const DB_ATOM_CLOSURE_ALREADY_SET
const DB_ATOM_ISO_WRONG_LEVEL
const DB_ATOM_LOCK_NO_TABLE
Create styles array
The data for the language used.
const DB_ATOM_ANO_NOT_AVAILABLE
testLockSameTableWithAlias()
const ISOLATION_READ_UNCOMMITED
static checkIsolationLevel($isolation_level)
Class ilAtomQueryTestHelper.
const DB_ATOM_IDENTICAL_TABLES
testQueryWithFiveException()