24use PHPUnit\Framework\TestCase;
 
   59    protected function setUp() : void
 
   61        ilUnitUtil::performInitialisation();
 
   63        global $ilClientIniFile;
 
   65        $this->ilDBInterfaceGalera->initFromIniFile($ilClientIniFile);
 
   66        $this->ilDBInterfaceGalera->connect();
 
   69        $this->ilDBInterfaceGaleraSecond->initFromIniFile($ilClientIniFile);
 
   70        $this->ilDBInterfaceGaleraSecond->connect();
 
   73        $this->ilDBInterfaceInnoDB->initFromIniFile($ilClientIniFile);
 
   74        $this->ilDBInterfaceInnoDB->connect();
 
   77        $this->ilDBInterfaceInnoDBSecond->initFromIniFile($ilClientIniFile);
 
   78        $this->ilDBInterfaceInnoDBSecond->connect();
 
   86        $this->ilDBInterfaceGalera->dropSequence(
'il_db_tests_atom');
 
   87        $this->ilDBInterfaceGalera->dropTable(
'il_db_tests_atom');
 
   93        $this->assertTrue($this->ilDBInterfaceGalera->connect(
true));
 
   94        $this->assertTrue($this->ilDBInterfaceGaleraSecond->connect(
true));
 
   95        $this->assertTrue($this->ilDBInterfaceInnoDB->connect(
true));
 
  101        if ($this->ilDBInterfaceGalera->sequenceExists(
'il_db_tests_atom')) {
 
  102            $this->ilDBInterfaceGalera->dropSequence(
'il_db_tests_atom');
 
  104        $this->ilDBInterfaceGalera->createTable(
'il_db_tests_atom', $fields = array(
 
  110            'is_online' => array(
 
  116        $this->ilDBInterfaceGalera->addPrimaryKey(
'il_db_tests_atom', array( 
'id' ));
 
  117        $this->ilDBInterfaceGalera->createSequence(
'il_db_tests_atom');
 
  123        $this->assertTrue($this->ilDBInterfaceGalera->tableExists(
'il_db_tests_atom'));
 
  129        $ilAtomQuery = $this->ilDBInterfaceGalera->buildAtomQuery();
 
  130        $ilAtomQuery->addTableLock(
'il_db_tests_atom')->lockSequence(
true);
 
  141        $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
 
  142        $ilAtomQuery->addTableLock(
'il_db_tests_atom')->lockSequence(
true);
 
  153        $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
 
  154        $ilAtomQuery->addTableLock(
'il_db_tests_atom')->lockSequence(
true)->aliasName(
'my_alias');
 
  165        $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
 
  166        $ilAtomQuery->addTableLock(
'il_db_tests_atom')->lockSequence(
true)->aliasName(
'my_alias');
 
  167        $ilAtomQuery->addTableLock(
'il_db_tests_atom')->lockSequence(
true)->aliasName(
'my_second_alias');
 
  178        $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
 
  179        $ilAtomQuery->addTableLock(
'il_db_tests_atom')->lockSequence(
true);
 
  180        $ilAtomQuery->addTableLock(
'il_db_tests_atom')->lockSequence(
true)->aliasName(
'my_alias');
 
  191        $this->setExpectedException(
'ilDatabaseException');
 
  192        $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
 
  201        $this->setExpectedException(
'ilDatabaseException');
 
  202        $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
 
  203        $ilAtomQuery->addTableLock(
'il_db_tests_atom');
 
  211        $this->ilDBInterfaceGalera->insert(
'il_db_tests_atom', array(
 
  212            'id' => array( 
'integer', $this->ilDBInterfaceGalera->nextId(
'il_db_tests_atom') ),
 
  213            'is_online' => array( 
'integer', 1 ),
 
  217        $this->ilDBInterfaceGalera->beginTransaction();
 
  218        $this->ilDBInterfaceGalera->update(
'il_db_tests_atom', array(
 
  219            'is_online' => array( 
'integer', 5 ),
 
  220        ), array( 
'id' => array( 
'integer', 1 ) ));
 
  228        $this->ilDBInterfaceGalera->commit();
 
  231        $query = 
'SELECT is_online FROM il_db_tests_atom WHERE id = ' . $this->ilDBInterfaceGalera->quote(1, 
'integer');
 
  232        $res = $this->ilDBInterfaceGalera->query(
$query);
 
  233        $d = $this->ilDBInterfaceGalera->fetchAssoc(
$res);
 
  235        $this->assertEquals(5, 
$d[
'is_online']);
 
  241        $this->ilDBInterfaceInnoDB->insert(
'il_db_tests_atom', array(
 
  242            'id' => array( 
'integer', $this->ilDBInterfaceInnoDB->nextId(
'il_db_tests_atom') ),
 
  243            'is_online' => array( 
'integer', 1 ),
 
  246        $this->ilDBInterfaceInnoDB->lockTables(array( array( 
'name' => 
'il_db_tests_atom', 
'type' => 
ilAtomQuery::LOCK_WRITE ) ));
 
  247        $this->ilDBInterfaceInnoDB->update(
'il_db_tests_atom', array(
 
  248            'is_online' => array( 
'integer', 5 ),
 
  249        ), array( 
'id' => array( 
'integer', 1 ) ));
 
  257        $this->ilDBInterfaceInnoDB->unlockTables();
 
  260        $query = 
'SELECT is_online FROM il_db_tests_atom WHERE id = ' . $this->ilDBInterfaceInnoDB->quote(1, 
'integer');
 
  261        $res = $this->ilDBInterfaceInnoDB->query(
$query);
 
  262        $d = $this->ilDBInterfaceInnoDB->fetchAssoc(
$res);
 
  264        $this->assertEquals(5, 
$d[
'is_online']);
 
  279            $ilDB->insert(
'il_db_tests_atom', array(
 
  280                'id' => array( 
'integer', 
$ilDB->nextId(
'il_db_tests_atom') ),
 
  281                'is_online' => array( 
'integer', 1 ),
 
  283            $ilDB->insert(
'il_db_tests_atom', array(
 
  284                'id' => array( 
'integer', 
$ilDB->nextId(
'il_db_tests_atom') ),
 
  285                'is_online' => array( 
'integer', 0 ),
 
  300                'name' => 
'il_db_tests_atom',
 
  315        $res = $this->ilDBInterfaceGalera->query(
'SELECT * FROM il_db_tests_atom');
 
  317        while (
$d = $this->ilDBInterfaceGalera->fetchAssoc(
$res)) {
 
An exception for terminatinating execution or to throw for unit testing.
const TYPE_PDO_MYSQL_INNODB
static getWrapper($a_type)
TestCase for the ilDatabaseAtomBaseTest.
$ilDBInterfaceInnoDBSecond
$ilDBInterfaceGaleraSecond
testWriteWithMultipleLocksWithAndWithoutAlias()
testWriteWithMultipleLocksAndAlias()
getTableLocksForDbInterface()
testWriteWithLocksAndAlias()
testUpdateDuringTransaction()
testWriteWithTransactions()
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
foreach($_POST as $key=> $value) $res