ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ()
 @depends testConnection More...
 
 testInsertNative ()
 @depends testConnection More...
 
 testQueryUtils ()
 
 testUpdateNative ()
 @depends testConnection More...
 
 testInsertSQL ()
 @depends testConnection More...
 
 testSelectUsrData ()
 
 testIndices ()
 @depends testConnection More...
 
 testTableColums ()
 @depends testConnection More...
 
 testSequences ()
 @depends testConnection More...
 
 testDBAnalyser ()
 @depends testConnection More...
 
 testDropSequence ()
 @depends testConnection More...
 
 testConstraints ()
 
 testChangeTableName ()
 @depends testConnection More...
 
 testRenameTableColumn ()
 @depends testConnection More...
 
 testModifyTableColumn ()
 @depends testConnection More...
 
 testLockTables ()
 @depends testConnection More...
 
 testTransactions ()
 @depends testConnection More...
 
 testDropTable ()
 @depends 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 618 of file ilDatabaseImplementationBaseTest.php.

References $ilDB, and $ildb_backup.

Referenced by testModifyTableColumn(), and testRenameTableColumn().

+ Here is the caller graph for this function:

◆ changeGlobal()

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

Definition at line 610 of file ilDatabaseImplementationBaseTest.php.

611 {
612 global $ilDB;
613 $this->ildb_backup = $ilDB;
614 $ilDB = $ilDBInterface;
615 }

References $ilDB.

Referenced by testModifyTableColumn(), and testRenameTableColumn().

+ 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 128 of file ilDatabaseImplementationBaseTest.php.

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

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

Referenced by setUp(), and testConnection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDBInstance()

ilDatabaseImplementationBaseTest::getDBInstance ( )
abstractprotected
Returns
\ilDBPdoMySQLInnoDB
Exceptions

ilDatabaseException

Reimplemented in ilDatabaseMDB2InnodbTest, ilDatabaseMDB2MyISAMTest, ilDatabaseMDB2PostgresTest, ilDatabasePDOGaleraTest, ilDatabasePDOInnodbTest, ilDatabasePDOMyISAMTest, and ilDatabasePDOPostgresTest.

Referenced by setUp(), and testConnection().

+ Here is the caller graph for this function:

◆ getIniFile()

ilDatabaseImplementationBaseTest::getIniFile ( )
protected
Returns
string

Definition at line 118 of file ilDatabaseImplementationBaseTest.php.

References $ini_file.

Referenced by connect().

+ Here is the caller graph for this function:

◆ getTableName()

ilDatabaseImplementationBaseTest::getTableName ( )
protected

◆ normalizeSQL()

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

Definition at line 629 of file ilDatabaseImplementationBaseTest.php.

630 {
631 return preg_replace('/[ \t]+/', ' ', preg_replace('/\s*$^\s*/m', " ", preg_replace("/\n/", "", preg_replace("/`/", "", $sql))));
632 }

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

+ Here is the caller graph for this function:

◆ normalizetableName()

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

Definition at line 639 of file ilDatabaseImplementationBaseTest.php.

640 {
641 return preg_replace("/" . $this->getTableName() . "|" . $this->getTableName() . "/", "table_name_replaced", $sql);
642 }

References getTableName().

+ Here is the call graph for this function:

◆ setUp()

ilDatabaseImplementationBaseTest::setUp ( )
protected

Definition at line 73 of file ilDatabaseImplementationBaseTest.php.

74 {
75 if ($this->set_up) {
76 return;
77 }
78 // echo phpversion() . "\n";
79 $this->error_reporting_backup = error_reporting();
80 error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_WARNING & ~E_STRICT); // Due to PEAR Lib MDB2
81
82 PHPUnit_Framework_Error_Notice::$enabled = false;
83 PHPUnit_Framework_Error_Deprecated::$enabled = false;
84
85 require_once('./libs/composer/vendor/autoload.php');
86 if (!defined('DEVMODE')) {
87 define('DEVMODE', true);
88 }
89 require_once('./Services/Database/classes/class.ilDBWrapperFactory.php');
90 $this->db = $this->getDBInstance();
91 global $DIC, $ilDB;
92 $DIC['ilDB'] = $this->db;
94 $this->connect($this->db);
95
96 switch ($this->type) {
97 default:
98 require_once('./Services/Database/test/Implementations/data/MySQL/class.ilDatabaseMySQLTestMockData.php');
99 require_once('./Services/Database/test/Implementations/data/MySQL/class.ilDatabaseMySQLTestsDataOutputs.php');
100 $this->mock = new ilDatabaseMySQLTestMockData();
101 $this->outputs = new ilDatabaseMySQLTestsDataOutputs();
102 break;
105 require_once('./Services/Database/test/Implementations/data/Postgres/class.ilDatabasePostgresTestMockData.php');
106 require_once('./Services/Database/test/Implementations/data/Postgres/class.ilDatabasePostgresTestsDataOutputs.php');
107 $this->mock = new ilDatabasePostgresTestMockData();
108 $this->outputs = new ilDatabasePostgresTestsDataOutputs();
109 break;
110 }
111 $this->set_up = true;
112 }
connect(ilDBInterface $ilDBInterface, $missing_ini=false)
Class ilDatabaseCommonTestMockData.
Class ilDatabaseCommonTestsDataOutputs.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
global $DIC
Definition: saml.php:7

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

+ Here is the call graph for this function:

◆ tearDown()

ilDatabaseImplementationBaseTest::tearDown ( )
protected

Definition at line 154 of file ilDatabaseImplementationBaseTest.php.

155 {
156 $this->db = null;
157 $this->mock = null;
158 $this->outputs = null;
159 $this->type = null;
160 $this->set_up = false;
161 error_reporting($this->error_reporting_backup);
162 }

◆ testChangeTableName()

ilDatabaseImplementationBaseTest::testChangeTableName ( )

@depends testConnection

Definition at line 505 of file ilDatabaseImplementationBaseTest.php.

506 {
507 $this->db->dropTable($this->getTableName() . '_a', false);
508 $this->db->renameTable($this->getTableName(), $this->getTableName() . '_a');
509 $this->assertTrue($this->db->tableExists($this->getTableName() . '_a'));
510 $this->db->renameTable($this->getTableName() . '_a', $this->getTableName());
511 }

References getTableName().

+ Here is the call graph for this function:

◆ testConnection()

ilDatabaseImplementationBaseTest::testConnection ( )

Definition at line 181 of file ilDatabaseImplementationBaseTest.php.

182 {
183 // $this->assertFalse($this->connect($this->getDBInstance(), true)); // Currently MDB2 Postgres doesn't check if connections possible
184 $this->assertTrue($this->connect($this->getDBInstance()));
185 if ($this->db->supportsEngineMigration()) {
186 // $this->db->migrateAllTablesToEngine($this->db->getStorageEngine());
187 }
188 }

References connect(), and getDBInstance().

+ Here is the call graph for this function:

◆ testConstraints()

ilDatabaseImplementationBaseTest::testConstraints ( )

Definition at line 497 of file ilDatabaseImplementationBaseTest.php.

498 {
499 }

◆ testCreateDatabase()

ilDatabaseImplementationBaseTest::testCreateDatabase ( )

@depends testConnection

Definition at line 205 of file ilDatabaseImplementationBaseTest.php.

206 {
207 $fields = $this->mock->getDBFields();
208 $this->db->createTable($this->getTableName(), $fields, true);
209 $this->db->addPrimaryKey($this->getTableName(), array( 'id' ));
210 $this->assertTrue($this->db->tableExists($this->getTableName()));
211
212 if (in_array($this->type, array( ilDBConstants::TYPE_PDO_POSTGRE, ilDBConstants::TYPE_POSTGRES ))) {
213 return; // SHOW CREATE TABLE CURRENTLY NOT SUPPORTED IN POSTGRES
214 }
215
216 $res = $this->db->query('SHOW CREATE TABLE ' . $this->getTableName());
217 $data = $this->db->fetchAssoc($res);
218
219 $data = array_change_key_case($data, CASE_LOWER);
220
221 $create_table = $this->normalizeSQL($data[self::CREATE_TABLE_ARRAY_KEY]);
222 $create_table_mock = $this->normalizeSQL($this->mock->getTableCreateSQL($this->getTableName(), $this->db->getStorageEngine()));
223
224 $this->assertEquals($create_table_mock, $create_table);
225 }
foreach($_POST as $key=> $value) $res

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

+ Here is the call graph for this function:

◆ testDBAnalyser()

ilDatabaseImplementationBaseTest::testDBAnalyser ( )

@depends testConnection

Definition at line 451 of file ilDatabaseImplementationBaseTest.php.

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

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

+ Here is the call graph for this function:

◆ testDropSequence()

ilDatabaseImplementationBaseTest::testDropSequence ( )

@depends testConnection

Definition at line 487 of file ilDatabaseImplementationBaseTest.php.

488 {
489 $this->assertTrue($this->db->sequenceExists($this->getTableName()));
490 if ($this->db->sequenceExists($this->getTableName())) {
491 $this->db->dropSequence($this->getTableName());
492 }
493 $this->assertFalse($this->db->sequenceExists($this->getTableName()));
494 }

References getTableName().

+ Here is the call graph for this function:

◆ testDropTable()

ilDatabaseImplementationBaseTest::testDropTable ( )

@depends testConnection

Definition at line 597 of file ilDatabaseImplementationBaseTest.php.

598 {
599 $this->db->dropTable($this->getTableName());
600 $this->assertTrue(!$this->db->tableExists($this->getTableName()));
601 }

References getTableName().

+ Here is the call graph for this function:

◆ testIndices()

ilDatabaseImplementationBaseTest::testIndices ( )

@depends testConnection

Definition at line 334 of file ilDatabaseImplementationBaseTest.php.

335 {
336 // Add index
337 $this->db->addIndex($this->getTableName(), array( 'init_mob_id' ), self::INDEX_NAME);
338 $this->assertTrue($this->db->indexExistsByFields($this->getTableName(), array( 'init_mob_id' )));
339
340 // Drop index
341 $this->db->dropIndex($this->getTableName(), self::INDEX_NAME);
342 $this->assertFalse($this->db->indexExistsByFields($this->getTableName(), array( 'init_mob_id' )));
343
344 // FullText
345 $this->db->addIndex($this->getTableName(), array( 'address' ), 'i2', true);
346 if ($this->db->supportsFulltext()) {
347 $this->assertTrue($this->db->indexExistsByFields($this->getTableName(), array( 'address' )));
348 } else {
349 $this->assertFalse($this->db->indexExistsByFields($this->getTableName(), array( 'address' )));
350 }
351
352 // Drop By Fields
353 $this->db->addIndex($this->getTableName(), array( 'elevation' ), 'i3');
354 $this->assertTrue($this->db->indexExistsByFields($this->getTableName(), array( 'elevation' )));
355
356 $this->db->dropIndexByFields($this->getTableName(), array( 'elevation' ));
357 $this->assertFalse($this->db->indexExistsByFields($this->getTableName(), array( 'elevation' )));
358 }

References getTableName().

+ Here is the call graph for this function:

◆ testInsertNative()

ilDatabaseImplementationBaseTest::testInsertNative ( )

@depends testConnection

Definition at line 231 of file ilDatabaseImplementationBaseTest.php.

232 {
233 $values = $this->mock->getInputArray(false, false);
234 $id = $values['id'][1];
235
236 // PDO
237 $this->db->insert($this->getTableName(), $values);
238 $this->db->setLimit(1);
239 $res_pdo = $this->db->query("SELECT * FROM " . $this->getTableName() . " WHERE id = $id");
240 $data_pdo = $this->db->fetchAssoc($res_pdo);
242 }
if(!array_key_exists('StateId', $_REQUEST)) $id

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

+ Here is the call graph for this function:

◆ testInsertSQL()

ilDatabaseImplementationBaseTest::testInsertSQL ( )

@depends testConnection

Definition at line 287 of file ilDatabaseImplementationBaseTest.php.

288 {
289 // PDO
290 $this->db->manipulate($this->mock->getInsertQuery($this->getTableName()));
291 $this->db->setLimit(1, 0);
292 $res_pdo = $this->db->query("SELECT * FROM " . $this->getTableName() . " WHERE id = 58");
293 $data_pdo = $this->db->fetchObject($res_pdo);
294
295 $this->assertEquals((object) ilDatabaseCommonTestsDataOutputs::$insert_sql_output, $data_pdo);
296 }

References ilDatabaseCommonTestsDataOutputs\$insert_sql_output, and getTableName().

+ Here is the call graph for this function:

◆ testInstance()

ilDatabaseImplementationBaseTest::testInstance ( )

Test instance implements ilDBInterface and is ilDBInnoDB.

Definition at line 175 of file ilDatabaseImplementationBaseTest.php.

176 {
177 $this->assertTrue($this->db instanceof ilDBInterface);
178 }
Interface ilDBInterface.

◆ testLockTables()

ilDatabaseImplementationBaseTest::testLockTables ( )

@depends testConnection

Definition at line 567 of file ilDatabaseImplementationBaseTest.php.

568 {
569 $locks = array(
570 0 => array( 'name' => 'usr_data', 'type' => ilDBConstants::LOCK_WRITE ),
571 // 1 => array( 'name' => 'object_data', 'type' => ilDBConstants::LOCK_READ ),
572 );
573
574 $this->db->lockTables($locks);
575 $this->db->manipulate('DELETE FROM usr_data WHERE usr_id = -1');
576 $this->db->unlockTables();
577 }

References ilDBConstants\LOCK_WRITE.

◆ testModifyTableColumn()

ilDatabaseImplementationBaseTest::testModifyTableColumn ( )

@depends testConnection

Definition at line 538 of file ilDatabaseImplementationBaseTest.php.

539 {
540 $changes = array(
541 "type" => "text",
542 "length" => 250,
543 "notnull" => false,
544 'fixed' => false,
545 );
546
547 $this->changeGlobal($this->db);
548
549 $this->db->modifyTableColumn($this->getTableName(), 'comment_mob_id_altered', $changes);
550 if (in_array($this->type, array( ilDBConstants::TYPE_PDO_POSTGRE, ilDBConstants::TYPE_POSTGRES ))) {
551 return; // SHOW CREATE TABLE CURRENTLY NOT SUPPORTED IN POSTGRES
552 }
553 $res = $this->db->query('SHOW CREATE TABLE ' . $this->getTableName());
554 $data = $this->db->fetchAssoc($res);
555
556 $data = array_change_key_case($data, CASE_LOWER);
557
558 $this->changeBack();
559
560 $this->assertEquals($this->normalizeSQL($this->mock->getTableCreateSQLAfterAlter($this->getTableName(), $this->db->getStorageEngine(), $this->db->supportsFulltext())), $this->normalizeSQL($data[self::CREATE_TABLE_ARRAY_KEY]));
561 }

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

+ Here is the call graph for this function:

◆ testQueryUtils()

ilDatabaseImplementationBaseTest::testQueryUtils ( )

Definition at line 245 of file ilDatabaseImplementationBaseTest.php.

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

◆ testRenameTableColumn()

ilDatabaseImplementationBaseTest::testRenameTableColumn ( )

@depends testConnection

Definition at line 517 of file ilDatabaseImplementationBaseTest.php.

518 {
519 $this->changeGlobal($this->db);
520
521 $this->db->renameTableColumn($this->getTableName(), 'comment_mob_id', 'comment_mob_id_altered');
522 if (in_array($this->type, array( ilDBConstants::TYPE_PDO_POSTGRE, ilDBConstants::TYPE_POSTGRES ))) {
523 return; // SHOW CREATE TABLE CURRENTLY NOT SUPPORTED IN POSTGRES
524 }
525 $res = $this->db->query('SHOW CREATE TABLE ' . $this->getTableName());
526 $data = $this->db->fetchAssoc($res);
527 $data = array_change_key_case($data, CASE_LOWER);
528
529 $this->assertEquals($this->normalizeSQL($this->mock->getTableCreateSQLAfterRename($this->getTableName(), $this->db->getStorageEngine(), $this->db->supportsFulltext())), $this->normalizeSQL($data[self::CREATE_TABLE_ARRAY_KEY]));
530
531 $this->changeBack();
532 }

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

+ Here is the call graph for this function:

◆ testSelectUsrData()

ilDatabaseImplementationBaseTest::testSelectUsrData ( )
Exceptions

ilDatabaseException @depends testConnection

Definition at line 303 of file ilDatabaseImplementationBaseTest.php.

304 {
306
307 $query = 'SELECT usr_id, login, is_self_registered FROM usr_data WHERE usr_id = 6';
308 // PDO
309 $this->db->setLimit(1, 0);
310 $result = $this->db->query($query);
311 $data = $this->db->fetchObject($result);
312 $this->assertEquals($output, $data);
313
314 $result = $this->db->queryF('SELECT usr_id, login, is_self_registered FROM usr_data WHERE usr_id = %s', array( ilDBPdoFieldDefinition::T_INTEGER ), array( 6 ));
315 $this->db->setLimit(1, 0);
316 $data = $this->db->fetchObject($result);
317 $this->assertEquals($output, $data);
318
319 $query = 'SELECT usr_id, login, is_self_registered FROM usr_data WHERE ' . $this->db->in('usr_id', array( 6, 13 ), false, 'integer');
320 $this->db->setLimit(2, 0);
321 $result = $this->db->query($query);
322 $data = $this->db->fetchAll($result);
324 $this->assertTrue(in_array($item, $data));
325 }
326
327 $this->assertEquals(2, $this->db->numRows($result));
328 }
$result
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
$query

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

◆ testSequences()

ilDatabaseImplementationBaseTest::testSequences ( )

@depends testConnection

Definition at line 379 of file ilDatabaseImplementationBaseTest.php.

380 {
381 if ($this->db->sequenceExists($this->getTableName())) {
382 $this->db->dropSequence($this->getTableName());
383 }
384 $this->db->createSequence($this->getTableName(), 10);
385 $this->assertEquals(10, $this->db->nextId($this->getTableName()));
386 $this->assertEquals(11, $this->db->nextId($this->getTableName()));
387 }

References getTableName().

+ Here is the call graph for this function:

◆ testTableColums()

ilDatabaseImplementationBaseTest::testTableColums ( )

@depends testConnection

Definition at line 364 of file ilDatabaseImplementationBaseTest.php.

365 {
366 $this->assertTrue($this->db->tableColumnExists($this->getTableName(), 'init_mob_id'));
367
368 $this->db->addTableColumn($this->getTableName(), "export", array( "type" => "text", "length" => 1024 ));
369 $this->assertTrue($this->db->tableColumnExists($this->getTableName(), 'export'));
370
371 $this->db->dropTableColumn($this->getTableName(), "export");
372 $this->assertFalse($this->db->tableColumnExists($this->getTableName(), 'export'));
373 }

References getTableName().

+ Here is the call graph for this function:

◆ testTransactions()

ilDatabaseImplementationBaseTest::testTransactions ( )

@depends testConnection

Definition at line 583 of file ilDatabaseImplementationBaseTest.php.

584 {
585 // PDO
586 // $this->db->beginTransaction();
587 // $this->db->insert($this->getTableName(), $this->mock->getInputArrayForTransaction());
588 // $this->db->rollback();
589 // $st = $this->db->query('SELECT * FROM ' . $this->getTableName() . ' WHERE id = ' . $this->db->quote(123456, 'integer'));
590 // $this->assertEquals(0, $this->db->numRows($st));
591 }

◆ testUpdateNative()

ilDatabaseImplementationBaseTest::testUpdateNative ( )

@depends testConnection

Definition at line 262 of file ilDatabaseImplementationBaseTest.php.

263 {
264 // With / without clob
265 $with_clob = $this->mock->getInputArray(2222, true);
266 $without_clob = $this->mock->getInputArray(2222, true, false);
267 $id = $with_clob['id'][1];
268
269 // PDO
270 $this->db->update($this->getTableName(), $with_clob, array( 'id' => array( 'integer', $id ) ));
271 $this->db->setLimit(1, 0);
272 $res_pdo = $this->db->query("SELECT * FROM " . $this->getTableName() . " WHERE id = $id ");
273 $data_pdo = $this->db->fetchAssoc($res_pdo);
275
276 $this->db->update($this->getTableName(), $without_clob, array( 'id' => array( 'integer', $id ) ));
277 $this->db->setLimit(1, 0);
278 $res_pdo = $this->db->query("SELECT * FROM " . $this->getTableName() . " WHERE id = $id ");
279 $data_pdo = $this->db->fetchAssoc($res_pdo);
281 }

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

+ 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: