ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilDatabaseImplementationBaseTest Class Reference

TestCase for the ilDatabaseCommonTest. More...

+ Inheritance diagram for ilDatabaseImplementationBaseTest:
+ Collaboration diagram for ilDatabaseImplementationBaseTest:

Public Member Functions

 testInstance ()
 Test instance implements ilDBInterface and is ilDBInnoDB. More...
 
 testConnection ()
 
 testCreateDatabase ()
 testConnection More...
 
 testInsertNative ()
 testConnection More...
 
 testQueryUtils ()
 
 testUpdateNative ()
 testConnection More...
 
 testInsertSQL ()
 testConnection More...
 
 testSelectUsrData ()
 
 testIndices ()
 testConnection More...
 
 testTableColums ()
 testConnection More...
 
 testSequences ()
 testConnection More...
 
 testDBAnalyser ()
 testConnection More...
 
 testDropSequence ()
 testConnection More...
 
 testConstraints ()
 
 testChangeTableName ()
 testConnection More...
 
 testRenameTableColumn ()
 testConnection More...
 
 testModifyTableColumn ()
 testConnection More...
 
 testLockTables ()
 testConnection More...
 
 testTransactions ()
 testConnection More...
 
 testDropTable ()
 testConnection More...
 

Data Fields

const INDEX_NAME = 'i1'
 
const TABLE_NAME = 'il_ut_en'
 
const CREATE_TABLE_ARRAY_KEY = 'create table'
 

Protected Member Functions

 setUp ()
 
 getIniFile ()
 
 connect (ilDBInterface $ilDBInterface, $missing_ini=false)
 
 getTableName ()
 
 tearDown ()
 
 getDBInstance ()
 
 changeGlobal (ilDBInterface $ilDBInterface)
 
 changeBack ()
 
 normalizeSQL ($sql)
 
 normalizetableName ($sql)
 

Protected Attributes

 $error_reporting_backup = 0
 
 $backupGlobals = false
 
 $db
 
 $mock
 
 $outputs
 
 $ildb_backup
 
 $type = ''
 
 $ini_file = '/var/www/ilias/data/trunk/client.ini.php'
 
 $set_up = false
 

Detailed Description

TestCase for the ilDatabaseCommonTest.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

Definition at line 30 of file ilDatabaseImplementationBaseTest.php.

Member Function Documentation

◆ changeBack()

ilDatabaseImplementationBaseTest::changeBack ( )
protected

Definition at line 613 of file ilDatabaseImplementationBaseTest.php.

References $ilDB, and $ildb_backup.

Referenced by testModifyTableColumn(), and testRenameTableColumn().

614  {
615  global $ilDB;
616  $ilDB = $this->ildb_backup;
617  }
global $ilDB
+ Here is the caller graph for this function:

◆ changeGlobal()

ilDatabaseImplementationBaseTest::changeGlobal ( ilDBInterface  $ilDBInterface)
protected
Parameters
\ilDBInterface$ilDBInterface

Definition at line 605 of file ilDatabaseImplementationBaseTest.php.

References $ilDB.

Referenced by testModifyTableColumn(), and testRenameTableColumn().

606  {
607  global $ilDB;
608  $this->ildb_backup = $ilDB;
609  $ilDB = $ilDBInterface;
610  }
global $ilDB
+ Here is the caller graph for this function:

◆ connect()

ilDatabaseImplementationBaseTest::connect ( ilDBInterface  $ilDBInterface,
  $missing_ini = false 
)
finalprotected
Parameters
\ilDBInterface$ilDBInterface
Returns
bool

Definition at line 127 of file ilDatabaseImplementationBaseTest.php.

References ilDBInterface\connect(), getIniFile(), and ilDBInterface\initFromIniFile().

Referenced by setUp(), and testConnection().

128  {
129  require_once('./Services/Init/classes/class.ilIniFile.php');
130  require_once('./Services/Init/classes/class.ilErrorHandling.php');
131  $ilClientIniFile = new ilIniFile($this->getIniFile());
132  $ilClientIniFile->read();
133  $this->type = $ilClientIniFile->readVariable("db", "type");
134  if ($missing_ini) {
135  $ilClientIniFile = new ilIniFile('');
136  }
137  $ilDBInterface->initFromIniFile($ilClientIniFile);
138  $return = $ilDBInterface->connect($missing_ini);
139 
140  return $return;
141  }
initFromIniFile($tmpClientIniFile=null)
connect($return_false_on_error=false)
INIFile Parser.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDBInstance()

ilDatabaseImplementationBaseTest::getDBInstance ( )
abstractprotected
Returns
Exceptions

Referenced by setUp(), tearDown(), and testConnection().

+ Here is the caller graph for this function:

◆ getIniFile()

ilDatabaseImplementationBaseTest::getIniFile ( )
protected
Returns
string

Definition at line 117 of file ilDatabaseImplementationBaseTest.php.

References $ini_file.

Referenced by connect().

+ Here is the caller graph for this function:

◆ getTableName()

ilDatabaseImplementationBaseTest::getTableName ( )
protected
Returns
string

Definition at line 147 of file ilDatabaseImplementationBaseTest.php.

Referenced by normalizetableName(), testChangeTableName(), testConnection(), testCreateDatabase(), testDBAnalyser(), testDropSequence(), testDropTable(), testIndices(), testInsertNative(), testInsertSQL(), testModifyTableColumn(), testRenameTableColumn(), testSequences(), testTableColums(), and testUpdateNative().

148  {
149  return strtolower(self::TABLE_NAME . '_' . $this->db->getDBType());
150  }
+ Here is the caller graph for this function:

◆ normalizeSQL()

ilDatabaseImplementationBaseTest::normalizeSQL (   $sql)
protected
Parameters
$sql
Returns
string

Definition at line 624 of file ilDatabaseImplementationBaseTest.php.

Referenced by testConnection(), testCreateDatabase(), testModifyTableColumn(), and testRenameTableColumn().

625  {
626  return preg_replace('/[ \t]+/', ' ', preg_replace('/\s*$^\s*/m', " ", preg_replace("/\n/", "", preg_replace("/`/", "", $sql))));
627  }
+ Here is the caller graph for this function:

◆ normalizetableName()

ilDatabaseImplementationBaseTest::normalizetableName (   $sql)
protected
Parameters
$sql
Returns
string

Definition at line 634 of file ilDatabaseImplementationBaseTest.php.

References getTableName().

635  {
636  return preg_replace("/" . $this->getTableName() . "|" . $this->getTableName() . "/", "table_name_replaced", $sql);
637  }
+ Here is the call graph for this function:

◆ setUp()

ilDatabaseImplementationBaseTest::setUp ( )
protected

Definition at line 73 of file ilDatabaseImplementationBaseTest.php.

References $db, $DIC, $ilDB, connect(), getDBInstance(), ilDBConstants\TYPE_PDO_POSTGRE, and ilDBConstants\TYPE_POSTGRES.

74  {
75  if ($this->set_up) {
76  return;
77  }
78  // echo phpversion() . "\n";
79  $this->error_reporting_backup = error_reporting();
80 
81  PHPUnit_Framework_Error_Notice::$enabled = false;
82  PHPUnit_Framework_Error_Deprecated::$enabled = false;
83 
84  require_once('./libs/composer/vendor/autoload.php');
85  if (!defined('DEVMODE')) {
86  define('DEVMODE', true);
87  }
88  require_once('./Services/Database/classes/class.ilDBWrapperFactory.php');
89  $this->db = $this->getDBInstance();
90  global $DIC, $ilDB;
91  $DIC['ilDB'] = $this->db;
92  $ilDB = $this->db;
93  $this->connect($this->db);
94 
95  switch ($this->type) {
96  default:
97  require_once('./Services/Database/test/Implementations/data/MySQL/class.ilDatabaseMySQLTestMockData.php');
98  require_once('./Services/Database/test/Implementations/data/MySQL/class.ilDatabaseMySQLTestsDataOutputs.php');
99  $this->mock = new ilDatabaseMySQLTestMockData();
100  $this->outputs = new ilDatabaseMySQLTestsDataOutputs();
101  break;
104  require_once('./Services/Database/test/Implementations/data/Postgres/class.ilDatabasePostgresTestMockData.php');
105  require_once('./Services/Database/test/Implementations/data/Postgres/class.ilDatabasePostgresTestsDataOutputs.php');
106  $this->mock = new ilDatabasePostgresTestMockData();
107  $this->outputs = new ilDatabasePostgresTestsDataOutputs();
108  break;
109  }
110  $this->set_up = true;
111  }
global $DIC
Definition: saml.php:7
Class ilDatabaseCommonTestMockData.
connect(ilDBInterface $ilDBInterface, $missing_ini=false)
Class ilDatabaseCommonTestMockData.
Class ilDatabaseCommonTestsDataOutputs.
global $ilDB
+ Here is the call graph for this function:

◆ tearDown()

ilDatabaseImplementationBaseTest::tearDown ( )
protected

Definition at line 153 of file ilDatabaseImplementationBaseTest.php.

References getDBInstance().

154  {
155  $this->db = null;
156  $this->mock = null;
157  $this->outputs = null;
158  $this->type = null;
159  $this->set_up = false;
160  error_reporting($this->error_reporting_backup);
161  }
+ Here is the call graph for this function:

◆ testChangeTableName()

ilDatabaseImplementationBaseTest::testChangeTableName ( )

testConnection

Definition at line 500 of file ilDatabaseImplementationBaseTest.php.

References getTableName().

501  {
502  $this->db->dropTable($this->getTableName() . '_a', false);
503  $this->db->renameTable($this->getTableName(), $this->getTableName() . '_a');
504  $this->assertTrue($this->db->tableExists($this->getTableName() . '_a'));
505  $this->db->renameTable($this->getTableName() . '_a', $this->getTableName());
506  }
+ Here is the call graph for this function:

◆ testConnection()

ilDatabaseImplementationBaseTest::testConnection ( )

Definition at line 180 of file ilDatabaseImplementationBaseTest.php.

References $query, connect(), getDBInstance(), getTableName(), ilDBConstants\MODULE_MANAGER, and normalizeSQL().

181  {
182  $this->assertTrue($this->connect($this->getDBInstance()));
183  }
connect(ilDBInterface $ilDBInterface, $missing_ini=false)
+ Here is the call graph for this function:

◆ testConstraints()

ilDatabaseImplementationBaseTest::testConstraints ( )

Definition at line 492 of file ilDatabaseImplementationBaseTest.php.

493  {
494  }

◆ testCreateDatabase()

ilDatabaseImplementationBaseTest::testCreateDatabase ( )

testConnection

Definition at line 200 of file ilDatabaseImplementationBaseTest.php.

References $data, $res, getTableName(), normalizeSQL(), ilDBConstants\TYPE_PDO_POSTGRE, and ilDBConstants\TYPE_POSTGRES.

201  {
202  $fields = $this->mock->getDBFields();
203  $this->db->createTable($this->getTableName(), $fields, true);
204  $this->db->addPrimaryKey($this->getTableName(), array( 'id' ));
205  $this->assertTrue($this->db->tableExists($this->getTableName()));
206 
207  if (in_array($this->type, array( ilDBConstants::TYPE_PDO_POSTGRE, ilDBConstants::TYPE_POSTGRES ))) {
208  return; // SHOW CREATE TABLE CURRENTLY NOT SUPPORTED IN POSTGRES
209  }
210 
211  $res = $this->db->query('SHOW CREATE TABLE ' . $this->getTableName());
212  $data = $this->db->fetchAssoc($res);
213 
214  $data = array_change_key_case($data, CASE_LOWER);
215 
216  $create_table = $this->normalizeSQL($data[self::CREATE_TABLE_ARRAY_KEY]);
217  $create_table_mock = $this->normalizeSQL($this->mock->getTableCreateSQL($this->getTableName(), $this->db->getStorageEngine()));
218 
219  $this->assertEquals($create_table_mock, $create_table);
220  }
foreach($_POST as $key=> $value) $res
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ testDBAnalyser()

ilDatabaseImplementationBaseTest::testDBAnalyser ( )

testConnection

Definition at line 446 of file ilDatabaseImplementationBaseTest.php.

References $def, getTableName(), and ilDBConstants\MODULE_REVERSE.

447  {
448  require_once('./Services/Database/classes/class.ilDBAnalyzer.php');
449  $analyzer = new ilDBAnalyzer($this->db);
450 
451  // Field info
452  // $this->assertEquals(ilDatabaseCommonTestsDataOutputs::$analyzer_field_info, $analyzer_pdo->getFieldInformation($this->getTableName())); // FSX
453 
454  // getBestDefinitionAlternative
455  $def = $this->db->loadModule(ilDBConstants::MODULE_REVERSE)->getTableFieldDefinition($this->getTableName(), 'comment_mob_id');
456  $this->assertEquals(0, $analyzer->getBestDefinitionAlternative($def)); // FSX
457 
458  // getAutoIncrementField
459  $this->assertEquals(false, $analyzer->getAutoIncrementField($this->getTableName()));
460 
461  // getPrimaryKeyInformation
462  $this->assertEquals($this->outputs->getPrimaryInfo($this->getTableName()), $analyzer->getPrimaryKeyInformation($this->getTableName()));
463 
464  // getIndicesInformation
465  if ($this->db->supportsFulltext()) {
466  $this->assertEquals($this->outputs->getIndexInfo(true, $this->getTableName()), $analyzer->getIndicesInformation($this->getTableName()));
467  } else {
468  $this->assertEquals($this->outputs->getIndexInfo(false, $this->getTableName()), $analyzer->getIndicesInformation($this->getTableName()));
469  }
470 
471  // getConstraintsInformation
472  $this->assertEquals(array(), $analyzer->getConstraintsInformation($this->getTableName())); // TODO
473 
474  // hasSequence
475  $this->assertEquals(59, $analyzer->hasSequence($this->getTableName()));
476  }
$def
Definition: croninfo.php:21
This class gives all kind of DB information using the database manager and reverse module...
+ Here is the call graph for this function:

◆ testDropSequence()

ilDatabaseImplementationBaseTest::testDropSequence ( )

testConnection

Definition at line 482 of file ilDatabaseImplementationBaseTest.php.

References getTableName().

483  {
484  $this->assertTrue($this->db->sequenceExists($this->getTableName()));
485  if ($this->db->sequenceExists($this->getTableName())) {
486  $this->db->dropSequence($this->getTableName());
487  }
488  $this->assertFalse($this->db->sequenceExists($this->getTableName()));
489  }
+ Here is the call graph for this function:

◆ testDropTable()

ilDatabaseImplementationBaseTest::testDropTable ( )

testConnection

Definition at line 592 of file ilDatabaseImplementationBaseTest.php.

References getTableName().

593  {
594  $this->db->dropTable($this->getTableName());
595  $this->assertTrue(!$this->db->tableExists($this->getTableName()));
596  }
+ Here is the call graph for this function:

◆ testIndices()

ilDatabaseImplementationBaseTest::testIndices ( )

testConnection

Definition at line 329 of file ilDatabaseImplementationBaseTest.php.

References getTableName().

330  {
331  // Add index
332  $this->db->addIndex($this->getTableName(), array( 'init_mob_id' ), self::INDEX_NAME);
333  $this->assertTrue($this->db->indexExistsByFields($this->getTableName(), array( 'init_mob_id' )));
334 
335  // Drop index
336  $this->db->dropIndex($this->getTableName(), self::INDEX_NAME);
337  $this->assertFalse($this->db->indexExistsByFields($this->getTableName(), array( 'init_mob_id' )));
338 
339  // FullText
340  $this->db->addIndex($this->getTableName(), array( 'address' ), 'i2', true);
341  if ($this->db->supportsFulltext()) {
342  $this->assertTrue($this->db->indexExistsByFields($this->getTableName(), array( 'address' )));
343  } else {
344  $this->assertFalse($this->db->indexExistsByFields($this->getTableName(), array( 'address' )));
345  }
346 
347  // Drop By Fields
348  $this->db->addIndex($this->getTableName(), array( 'elevation' ), 'i3');
349  $this->assertTrue($this->db->indexExistsByFields($this->getTableName(), array( 'elevation' )));
350 
351  $this->db->dropIndexByFields($this->getTableName(), array( 'elevation' ));
352  $this->assertFalse($this->db->indexExistsByFields($this->getTableName(), array( 'elevation' )));
353  }
+ Here is the call graph for this function:

◆ testInsertNative()

ilDatabaseImplementationBaseTest::testInsertNative ( )

testConnection

Definition at line 226 of file ilDatabaseImplementationBaseTest.php.

References $id, ilDatabaseCommonTestsDataOutputs\$output_after_native_input, $values, and getTableName().

227  {
228  $values = $this->mock->getInputArray(false, false);
229  $id = $values['id'][1];
230 
231  // PDO
232  $this->db->insert($this->getTableName(), $values);
233  $this->db->setLimit(1);
234  $res_pdo = $this->db->query("SELECT * FROM " . $this->getTableName() . " WHERE id = $id");
235  $data_pdo = $this->db->fetchAssoc($res_pdo);
236  $this->assertEquals(ilDatabaseCommonTestsDataOutputs::$output_after_native_input, $data_pdo);
237  }
if(!array_key_exists('StateId', $_REQUEST)) $id
$values
+ Here is the call graph for this function:

◆ testInsertSQL()

ilDatabaseImplementationBaseTest::testInsertSQL ( )

testConnection

Definition at line 282 of file ilDatabaseImplementationBaseTest.php.

References ilDatabaseCommonTestsDataOutputs\$insert_sql_output, and getTableName().

283  {
284  // PDO
285  $this->db->manipulate($this->mock->getInsertQuery($this->getTableName()));
286  $this->db->setLimit(1, 0);
287  $res_pdo = $this->db->query("SELECT * FROM " . $this->getTableName() . " WHERE id = 58");
288  $data_pdo = $this->db->fetchObject($res_pdo);
289 
290  $this->assertEquals((object) ilDatabaseCommonTestsDataOutputs::$insert_sql_output, $data_pdo);
291  }
+ Here is the call graph for this function:

◆ testInstance()

ilDatabaseImplementationBaseTest::testInstance ( )

Test instance implements ilDBInterface and is ilDBInnoDB.

Definition at line 174 of file ilDatabaseImplementationBaseTest.php.

175  {
176  $this->assertTrue($this->db instanceof ilDBInterface);
177  }

◆ testLockTables()

ilDatabaseImplementationBaseTest::testLockTables ( )

testConnection

Definition at line 562 of file ilDatabaseImplementationBaseTest.php.

References ilDBConstants\LOCK_WRITE.

563  {
564  $locks = array(
565  0 => array( 'name' => 'usr_data', 'type' => ilDBConstants::LOCK_WRITE ),
566  // 1 => array( 'name' => 'object_data', 'type' => ilDBConstants::LOCK_READ ),
567  );
568 
569  $this->db->lockTables($locks);
570  $this->db->manipulate('DELETE FROM usr_data WHERE usr_id = -1');
571  $this->db->unlockTables();
572  }

◆ testModifyTableColumn()

ilDatabaseImplementationBaseTest::testModifyTableColumn ( )

testConnection

Definition at line 533 of file ilDatabaseImplementationBaseTest.php.

References $data, $res, changeBack(), changeGlobal(), getTableName(), normalizeSQL(), ilDBConstants\TYPE_PDO_POSTGRE, and ilDBConstants\TYPE_POSTGRES.

534  {
535  $changes = array(
536  "type" => "text",
537  "length" => 250,
538  "notnull" => false,
539  'fixed' => false,
540  );
541 
542  $this->changeGlobal($this->db);
543 
544  $this->db->modifyTableColumn($this->getTableName(), 'comment_mob_id_altered', $changes);
545  if (in_array($this->type, array( ilDBConstants::TYPE_PDO_POSTGRE, ilDBConstants::TYPE_POSTGRES ))) {
546  return; // SHOW CREATE TABLE CURRENTLY NOT SUPPORTED IN POSTGRES
547  }
548  $res = $this->db->query('SHOW CREATE TABLE ' . $this->getTableName());
549  $data = $this->db->fetchAssoc($res);
550 
551  $data = array_change_key_case($data, CASE_LOWER);
552 
553  $this->changeBack();
554 
555  $this->assertEquals($this->normalizeSQL($this->mock->getTableCreateSQLAfterAlter($this->getTableName(), $this->db->getStorageEngine(), $this->db->supportsFulltext())), $this->normalizeSQL($data[self::CREATE_TABLE_ARRAY_KEY]));
556  }
foreach($_POST as $key=> $value) $res
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ testQueryUtils()

ilDatabaseImplementationBaseTest::testQueryUtils ( )

Definition at line 240 of file ilDatabaseImplementationBaseTest.php.

241  {
242  $this->assertEquals($this->mock->getLike(), $this->db->like('column', 'text', 22));
243 
244  $this->assertEquals($this->mock->getNow(), $this->db->now());
245 
246  $this->assertEquals($this->mock->getLocate(), $this->db->locate('needle', 'mystring', 5));
247 
248  $this->assertEquals($this->mock->getConcat(false), $this->db->concat(array( 'one', 'two', 'three' ), false));
249 
250  $this->assertEquals($this->mock->getConcat(true), $this->db->concat(array( 'one', 'two', 'three' ), true));
251  }

◆ testRenameTableColumn()

ilDatabaseImplementationBaseTest::testRenameTableColumn ( )

testConnection

Definition at line 512 of file ilDatabaseImplementationBaseTest.php.

References $data, $res, changeBack(), changeGlobal(), getTableName(), normalizeSQL(), ilDBConstants\TYPE_PDO_POSTGRE, and ilDBConstants\TYPE_POSTGRES.

513  {
514  $this->changeGlobal($this->db);
515 
516  $this->db->renameTableColumn($this->getTableName(), 'comment_mob_id', 'comment_mob_id_altered');
517  if (in_array($this->type, array( ilDBConstants::TYPE_PDO_POSTGRE, ilDBConstants::TYPE_POSTGRES ))) {
518  return; // SHOW CREATE TABLE CURRENTLY NOT SUPPORTED IN POSTGRES
519  }
520  $res = $this->db->query('SHOW CREATE TABLE ' . $this->getTableName());
521  $data = $this->db->fetchAssoc($res);
522  $data = array_change_key_case($data, CASE_LOWER);
523 
524  $this->assertEquals($this->normalizeSQL($this->mock->getTableCreateSQLAfterRename($this->getTableName(), $this->db->getStorageEngine(), $this->db->supportsFulltext())), $this->normalizeSQL($data[self::CREATE_TABLE_ARRAY_KEY]));
525 
526  $this->changeBack();
527  }
foreach($_POST as $key=> $value) $res
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ testSelectUsrData()

ilDatabaseImplementationBaseTest::testSelectUsrData ( )
Exceptions

Definition at line 298 of file ilDatabaseImplementationBaseTest.php.

References $data, Sabre\VObject\$output, $query, $result, ilDatabaseCommonTestsDataOutputs\$select_usr_data_2_output, ilDatabaseCommonTestsDataOutputs\$select_usr_data_output, and ilDBPdoFieldDefinition\T_INTEGER.

299  {
301 
302  $query = 'SELECT usr_id, login, is_self_registered FROM usr_data WHERE usr_id = 6';
303  // PDO
304  $this->db->setLimit(1, 0);
305  $result = $this->db->query($query);
306  $data = $this->db->fetchObject($result);
307  $this->assertEquals($output, $data);
308 
309  $result = $this->db->queryF('SELECT usr_id, login, is_self_registered FROM usr_data WHERE usr_id = %s', array( ilDBPdoFieldDefinition::T_INTEGER ), array( 6 ));
310  $this->db->setLimit(1, 0);
311  $data = $this->db->fetchObject($result);
312  $this->assertEquals($output, $data);
313 
314  $query = 'SELECT usr_id, login, is_self_registered FROM usr_data WHERE ' . $this->db->in('usr_id', array( 6, 13 ), false, 'integer');
315  $this->db->setLimit(2, 0);
316  $result = $this->db->query($query);
317  $data = $this->db->fetchAll($result);
319  $this->assertTrue(in_array($item, $data));
320  }
321 
322  $this->assertEquals(2, $this->db->numRows($result));
323  }
$result
$query
$data
Definition: bench.php:6

◆ testSequences()

ilDatabaseImplementationBaseTest::testSequences ( )

testConnection

Definition at line 374 of file ilDatabaseImplementationBaseTest.php.

References ilDatabaseCommonTestsDataOutputs\$table_constraint_definition_output, ilDatabaseCommonTestsDataOutputs\$table_index_definition_output, getTableName(), ilDBConstants\MODULE_MANAGER, and ilDBConstants\MODULE_REVERSE.

375  {
376  if ($this->db->sequenceExists($this->getTableName())) {
377  $this->db->dropSequence($this->getTableName());
378  }
379  $this->db->createSequence($this->getTableName(), 10);
380  $this->assertEquals(10, $this->db->nextId($this->getTableName()));
381  $this->assertEquals(11, $this->db->nextId($this->getTableName()));
382  }
+ Here is the call graph for this function:

◆ testTableColums()

ilDatabaseImplementationBaseTest::testTableColums ( )

testConnection

Definition at line 359 of file ilDatabaseImplementationBaseTest.php.

References getTableName().

360  {
361  $this->assertTrue($this->db->tableColumnExists($this->getTableName(), 'init_mob_id'));
362 
363  $this->db->addTableColumn($this->getTableName(), "export", array( "type" => "text", "length" => 1024 ));
364  $this->assertTrue($this->db->tableColumnExists($this->getTableName(), 'export'));
365 
366  $this->db->dropTableColumn($this->getTableName(), "export");
367  $this->assertFalse($this->db->tableColumnExists($this->getTableName(), 'export'));
368  }
+ Here is the call graph for this function:

◆ testTransactions()

ilDatabaseImplementationBaseTest::testTransactions ( )

testConnection

Definition at line 578 of file ilDatabaseImplementationBaseTest.php.

579  {
580  // PDO
581  // $this->db->beginTransaction();
582  // $this->db->insert($this->getTableName(), $this->mock->getInputArrayForTransaction());
583  // $this->db->rollback();
584  // $st = $this->db->query('SELECT * FROM ' . $this->getTableName() . ' WHERE id = ' . $this->db->quote(123456, 'integer'));
585  // $this->assertEquals(0, $this->db->numRows($st));
586  }

◆ testUpdateNative()

ilDatabaseImplementationBaseTest::testUpdateNative ( )

testConnection

Definition at line 257 of file ilDatabaseImplementationBaseTest.php.

References $id, ilDatabaseCommonTestsDataOutputs\$output_after_native_update, and getTableName().

258  {
259  // With / without clob
260  $with_clob = $this->mock->getInputArray(2222, true);
261  $without_clob = $this->mock->getInputArray(2222, true, false);
262  $id = $with_clob['id'][1];
263 
264  // PDO
265  $this->db->update($this->getTableName(), $with_clob, array( 'id' => array( 'integer', $id ) ));
266  $this->db->setLimit(1, 0);
267  $res_pdo = $this->db->query("SELECT * FROM " . $this->getTableName() . " WHERE id = $id ");
268  $data_pdo = $this->db->fetchAssoc($res_pdo);
270 
271  $this->db->update($this->getTableName(), $without_clob, array( 'id' => array( 'integer', $id ) ));
272  $this->db->setLimit(1, 0);
273  $res_pdo = $this->db->query("SELECT * FROM " . $this->getTableName() . " WHERE id = $id ");
274  $data_pdo = $this->db->fetchAssoc($res_pdo);
276  }
if(!array_key_exists('StateId', $_REQUEST)) $id
+ Here is the call graph for this function:

Field Documentation

◆ $backupGlobals

ilDatabaseImplementationBaseTest::$backupGlobals = false
protected

Definition at line 42 of file ilDatabaseImplementationBaseTest.php.

◆ $db

ilDatabaseImplementationBaseTest::$db
protected

Definition at line 46 of file ilDatabaseImplementationBaseTest.php.

Referenced by setUp().

◆ $error_reporting_backup

ilDatabaseImplementationBaseTest::$error_reporting_backup = 0
protected

Definition at line 38 of file ilDatabaseImplementationBaseTest.php.

◆ $ildb_backup

ilDatabaseImplementationBaseTest::$ildb_backup
protected

Definition at line 58 of file ilDatabaseImplementationBaseTest.php.

Referenced by changeBack().

◆ $ini_file

ilDatabaseImplementationBaseTest::$ini_file = '/var/www/ilias/data/trunk/client.ini.php'
protected

Definition at line 66 of file ilDatabaseImplementationBaseTest.php.

Referenced by getIniFile().

◆ $mock

ilDatabaseImplementationBaseTest::$mock
protected

Definition at line 50 of file ilDatabaseImplementationBaseTest.php.

◆ $outputs

ilDatabaseImplementationBaseTest::$outputs
protected

Definition at line 54 of file ilDatabaseImplementationBaseTest.php.

◆ $set_up

ilDatabaseImplementationBaseTest::$set_up = false
protected

Definition at line 70 of file ilDatabaseImplementationBaseTest.php.

◆ $type

ilDatabaseImplementationBaseTest::$type = ''
protected

Definition at line 62 of file ilDatabaseImplementationBaseTest.php.

◆ CREATE_TABLE_ARRAY_KEY

const ilDatabaseImplementationBaseTest::CREATE_TABLE_ARRAY_KEY = 'create table'

Definition at line 34 of file ilDatabaseImplementationBaseTest.php.

◆ INDEX_NAME

const ilDatabaseImplementationBaseTest::INDEX_NAME = 'i1'

Definition at line 32 of file ilDatabaseImplementationBaseTest.php.

◆ TABLE_NAME

const ilDatabaseImplementationBaseTest::TABLE_NAME = 'il_ut_en'

Definition at line 33 of file ilDatabaseImplementationBaseTest.php.


The documentation for this class was generated from the following file: