ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 590 of file ilDatabaseImplementationBaseTest.php.

References $ilDB, and $ildb_backup.

Referenced by testModifyTableColumn(), and testRenameTableColumn().

590  {
591  global $ilDB;
592  $ilDB = $this->ildb_backup;
593  }
global $ilDB
+ Here is the caller graph for this function:

◆ changeGlobal()

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

Definition at line 583 of file ilDatabaseImplementationBaseTest.php.

References $ilDB.

Referenced by testModifyTableColumn(), and testRenameTableColumn().

583  {
584  global $ilDB;
585  $this->ildb_backup = $ilDB;
586  $ilDB = $ilDBInterface;
587  }
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 126 of file ilDatabaseImplementationBaseTest.php.

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

Referenced by setUp(), and testConnection().

126  {
127  require_once('./Services/Init/classes/class.ilIniFile.php');
128  require_once('./Services/Init/classes/class.ilErrorHandling.php');
129  $ilClientIniFile = new ilIniFile($this->getIniFile());
130  $ilClientIniFile->read();
131  $this->type = $ilClientIniFile->readVariable("db", "type");
132  if ($missing_ini) {
133  $ilClientIniFile = new ilIniFile('');
134  }
135  $ilDBInterface->initFromIniFile($ilClientIniFile);
136  $return = $ilDBInterface->connect($missing_ini);
137 
138  return $return;
139  }
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 145 of file ilDatabaseImplementationBaseTest.php.

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

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

◆ normalizeSQL()

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

Definition at line 600 of file ilDatabaseImplementationBaseTest.php.

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

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

◆ normalizetableName()

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

Definition at line 609 of file ilDatabaseImplementationBaseTest.php.

References getTableName().

609  {
610  return preg_replace("/" . $this->getTableName() . "|" . $this->getTableName() . "/", "table_name_replaced", $sql);
611  }
+ 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(), defined, getDBInstance(), ilDBConstants\TYPE_PDO_POSTGRE, and ilDBConstants\TYPE_POSTGRES.

73  {
74  if ($this->set_up) {
75  return;
76  }
77  // echo phpversion() . "\n";
78  $this->error_reporting_backup = error_reporting();
79  error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_WARNING & ~E_STRICT); // Due to PEAR Lib MDB2
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  }
Class ilDatabaseCommonTestMockData.
connect(ilDBInterface $ilDBInterface, $missing_ini=false)
Class ilDatabaseCommonTestMockData.
Class ilDatabaseCommonTestsDataOutputs.
global $ilDB
global $DIC
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
+ Here is the call graph for this function:

◆ tearDown()

ilDatabaseImplementationBaseTest::tearDown ( )
protected

Definition at line 150 of file ilDatabaseImplementationBaseTest.php.

References getDBInstance().

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

◆ testChangeTableName()

ilDatabaseImplementationBaseTest::testChangeTableName ( )

testConnection

Definition at line 484 of file ilDatabaseImplementationBaseTest.php.

References getTableName().

484  {
485  $this->db->dropTable($this->getTableName() . '_a', false);
486  $this->db->renameTable($this->getTableName(), $this->getTableName() . '_a');
487  $this->assertTrue($this->db->tableExists($this->getTableName() . '_a'));
488  $this->db->renameTable($this->getTableName() . '_a', $this->getTableName());
489  }
+ Here is the call graph for this function:

◆ testConnection()

ilDatabaseImplementationBaseTest::testConnection ( )

Definition at line 175 of file ilDatabaseImplementationBaseTest.php.

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

175  {
176  // $this->assertFalse($this->connect($this->getDBInstance(), true)); // Currently MDB2 Postgres doesn't check if connections possible
177  $this->assertTrue($this->connect($this->getDBInstance()));
178  if ($this->db->supportsEngineMigration()) {
179  // $this->db->migrateAllTablesToEngine($this->db->getStorageEngine());
180  }
181  }
connect(ilDBInterface $ilDBInterface, $missing_ini=false)
+ Here is the call graph for this function:

◆ testConstraints()

ilDatabaseImplementationBaseTest::testConstraints ( )

Definition at line 476 of file ilDatabaseImplementationBaseTest.php.

476  {
477 
478  }

◆ testCreateDatabase()

ilDatabaseImplementationBaseTest::testCreateDatabase ( )

testConnection

Definition at line 197 of file ilDatabaseImplementationBaseTest.php.

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

197  {
198  $fields = $this->mock->getDBFields();
199  $this->db->createTable($this->getTableName(), $fields, true);
200  $this->db->addPrimaryKey($this->getTableName(), array( 'id' ));
201  $this->assertTrue($this->db->tableExists($this->getTableName()));
202 
203  if (in_array($this->type, array( ilDBConstants::TYPE_PDO_POSTGRE, ilDBConstants::TYPE_POSTGRES ))) {
204  return; // SHOW CREATE TABLE CURRENTLY NOT SUPPORTED IN POSTGRES
205  }
206 
207  $res = $this->db->query('SHOW CREATE TABLE ' . $this->getTableName());
208  $data = $this->db->fetchAssoc($res);
209 
210  $data = array_change_key_case($data, CASE_LOWER);
211 
212  $create_table = $this->normalizeSQL($data[self::CREATE_TABLE_ARRAY_KEY]);
213  $create_table_mock = $this->normalizeSQL($this->mock->getTableCreateSQL($this->getTableName(), $this->db->getStorageEngine()));
214 
215  $this->assertEquals($create_table_mock, $create_table);
216  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ testDBAnalyser()

ilDatabaseImplementationBaseTest::testDBAnalyser ( )

testConnection

Definition at line 432 of file ilDatabaseImplementationBaseTest.php.

References array, getTableName(), and ilDBConstants\MODULE_REVERSE.

432  {
433  require_once('./Services/Database/classes/class.ilDBAnalyzer.php');
434  $analyzer = new ilDBAnalyzer($this->db);
435 
436  // Field info
437  // $this->assertEquals(ilDatabaseCommonTestsDataOutputs::$analyzer_field_info, $analyzer_pdo->getFieldInformation($this->getTableName())); // FSX
438 
439  // getBestDefinitionAlternative
440  $def = $this->db->loadModule(ilDBConstants::MODULE_REVERSE)->getTableFieldDefinition($this->getTableName(), 'comment_mob_id');
441  $this->assertEquals(0, $analyzer->getBestDefinitionAlternative($def)); // FSX
442 
443  // getAutoIncrementField
444  $this->assertEquals(false, $analyzer->getAutoIncrementField($this->getTableName()));
445 
446  // getPrimaryKeyInformation
447  $this->assertEquals($this->outputs->getPrimaryInfo($this->getTableName()), $analyzer->getPrimaryKeyInformation($this->getTableName()));
448 
449  // getIndicesInformation
450  if ($this->db->supportsFulltext()) {
451  $this->assertEquals($this->outputs->getIndexInfo(true, $this->getTableName()), $analyzer->getIndicesInformation($this->getTableName()));
452  } else {
453  $this->assertEquals($this->outputs->getIndexInfo(false, $this->getTableName()), $analyzer->getIndicesInformation($this->getTableName()));
454  }
455 
456  // getConstraintsInformation
457  $this->assertEquals(array(), $analyzer->getConstraintsInformation($this->getTableName())); // TODO
458 
459  // hasSequence
460  $this->assertEquals(59, $analyzer->hasSequence($this->getTableName()));
461  }
Create styles array
The data for the language used.
This class gives all kind of DB information using the MDB2 manager and reverse module.
+ Here is the call graph for this function:

◆ testDropSequence()

ilDatabaseImplementationBaseTest::testDropSequence ( )

testConnection

Definition at line 467 of file ilDatabaseImplementationBaseTest.php.

References getTableName().

467  {
468  $this->assertTrue($this->db->sequenceExists($this->getTableName()));
469  if ($this->db->sequenceExists($this->getTableName())) {
470  $this->db->dropSequence($this->getTableName());
471  }
472  $this->assertFalse($this->db->sequenceExists($this->getTableName()));
473  }
+ Here is the call graph for this function:

◆ testDropTable()

ilDatabaseImplementationBaseTest::testDropTable ( )

testConnection

Definition at line 571 of file ilDatabaseImplementationBaseTest.php.

References getTableName().

571  {
572  $this->db->dropTable($this->getTableName());
573  $this->assertTrue(!$this->db->tableExists($this->getTableName()));
574  }
+ Here is the call graph for this function:

◆ testIndices()

ilDatabaseImplementationBaseTest::testIndices ( )

testConnection

Definition at line 320 of file ilDatabaseImplementationBaseTest.php.

References array, and getTableName().

320  {
321  // Add index
322  $this->db->addIndex($this->getTableName(), array( 'init_mob_id' ), self::INDEX_NAME);
323  $this->assertTrue($this->db->indexExistsByFields($this->getTableName(), array( 'init_mob_id' )));
324 
325  // Drop index
326  $this->db->dropIndex($this->getTableName(), self::INDEX_NAME);
327  $this->assertFalse($this->db->indexExistsByFields($this->getTableName(), array( 'init_mob_id' )));
328 
329  // FullText
330  $this->db->addIndex($this->getTableName(), array( 'address' ), 'i2', true);
331  if ($this->db->supportsFulltext()) {
332  $this->assertTrue($this->db->indexExistsByFields($this->getTableName(), array( 'address' )));
333  } else {
334  $this->assertFalse($this->db->indexExistsByFields($this->getTableName(), array( 'address' )));
335  }
336 
337  // Drop By Fields
338  $this->db->addIndex($this->getTableName(), array( 'elevation' ), 'i3');
339  $this->assertTrue($this->db->indexExistsByFields($this->getTableName(), array( 'elevation' )));
340 
341  $this->db->dropIndexByFields($this->getTableName(), array( 'elevation' ));
342  $this->assertFalse($this->db->indexExistsByFields($this->getTableName(), array( 'elevation' )));
343  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ testInsertNative()

ilDatabaseImplementationBaseTest::testInsertNative ( )

testConnection

Definition at line 222 of file ilDatabaseImplementationBaseTest.php.

References ilDatabaseCommonTestsDataOutputs\$output_after_native_input, and getTableName().

222  {
223  $values = $this->mock->getInputArray(false, false);
224  $id = $values['id'][1];
225 
226  // PDO
227  $this->db->insert($this->getTableName(), $values);
228  $this->db->setLimit(1);
229  $res_pdo = $this->db->query("SELECT * FROM " . $this->getTableName() . " WHERE id = $id");
230  $data_pdo = $this->db->fetchAssoc($res_pdo);
231  $this->assertEquals(ilDatabaseCommonTestsDataOutputs::$output_after_native_input, $data_pdo);
232  }
+ Here is the call graph for this function:

◆ testInsertSQL()

ilDatabaseImplementationBaseTest::testInsertSQL ( )

testConnection

Definition at line 275 of file ilDatabaseImplementationBaseTest.php.

References ilDatabaseCommonTestsDataOutputs\$insert_sql_output, and getTableName().

275  {
276  // PDO
277  $this->db->manipulate($this->mock->getInsertQuery($this->getTableName()));
278  $this->db->setLimit(1, 0);
279  $res_pdo = $this->db->query("SELECT * FROM " . $this->getTableName() . " WHERE id = 58");
280  $data_pdo = $this->db->fetchObject($res_pdo);
281 
282  $this->assertEquals((object)ilDatabaseCommonTestsDataOutputs::$insert_sql_output, $data_pdo);
283  }
+ Here is the call graph for this function:

◆ testInstance()

ilDatabaseImplementationBaseTest::testInstance ( )

Test instance implements ilDBInterface and is ilDBInnoDB.

Definition at line 170 of file ilDatabaseImplementationBaseTest.php.

170  {
171  $this->assertTrue($this->db instanceof ilDBInterface);
172  }
Interface ilDBInterface.

◆ testLockTables()

ilDatabaseImplementationBaseTest::testLockTables ( )

testConnection

Definition at line 543 of file ilDatabaseImplementationBaseTest.php.

References array, and ilDBConstants\LOCK_WRITE.

543  {
544  $locks = array(
545  0 => array( 'name' => 'usr_data', 'type' => ilDBConstants::LOCK_WRITE ),
546  // 1 => array( 'name' => 'object_data', 'type' => ilDBConstants::LOCK_READ ),
547  );
548 
549  $this->db->lockTables($locks);
550  $this->db->manipulate('DELETE FROM usr_data WHERE usr_id = -1');
551  $this->db->unlockTables();
552  }
Create styles array
The data for the language used.

◆ testModifyTableColumn()

ilDatabaseImplementationBaseTest::testModifyTableColumn ( )

testConnection

Definition at line 515 of file ilDatabaseImplementationBaseTest.php.

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

515  {
516  $changes = array(
517  "type" => "text",
518  "length" => 250,
519  "notnull" => false,
520  'fixed' => false,
521  );
522 
523  $this->changeGlobal($this->db);
524 
525  $this->db->modifyTableColumn($this->getTableName(), 'comment_mob_id_altered', $changes);
526  if (in_array($this->type, array( ilDBConstants::TYPE_PDO_POSTGRE, ilDBConstants::TYPE_POSTGRES ))) {
527  return; // SHOW CREATE TABLE CURRENTLY NOT SUPPORTED IN POSTGRES
528  }
529  $res = $this->db->query('SHOW CREATE TABLE ' . $this->getTableName());
530  $data = $this->db->fetchAssoc($res);
531 
532  $data = array_change_key_case($data, CASE_LOWER);
533 
534  $this->changeBack();
535 
536  $this->assertEquals($this->normalizeSQL($this->mock->getTableCreateSQLAfterAlter($this->getTableName(), $this->db->getStorageEngine(), $this->db->supportsFulltext())), $this->normalizeSQL($data[self::CREATE_TABLE_ARRAY_KEY]));
537  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ testQueryUtils()

ilDatabaseImplementationBaseTest::testQueryUtils ( )

Definition at line 235 of file ilDatabaseImplementationBaseTest.php.

References array.

235  {
236  $this->assertEquals($this->mock->getLike(), $this->db->like('column', 'text', 22));
237 
238  $this->assertEquals($this->mock->getNow(), $this->db->now());
239 
240  $this->assertEquals($this->mock->getLocate(), $this->db->locate('needle', 'mystring', 5));
241 
242  $this->assertEquals($this->mock->getConcat(false), $this->db->concat(array( 'one', 'two', 'three' ), false));
243 
244  $this->assertEquals($this->mock->getConcat(true), $this->db->concat(array( 'one', 'two', 'three' ), true));
245  }
Create styles array
The data for the language used.

◆ testRenameTableColumn()

ilDatabaseImplementationBaseTest::testRenameTableColumn ( )

testConnection

Definition at line 495 of file ilDatabaseImplementationBaseTest.php.

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

495  {
496  $this->changeGlobal($this->db);
497 
498  $this->db->renameTableColumn($this->getTableName(), 'comment_mob_id', 'comment_mob_id_altered');
499  if (in_array($this->type, array( ilDBConstants::TYPE_PDO_POSTGRE, ilDBConstants::TYPE_POSTGRES ))) {
500  return; // SHOW CREATE TABLE CURRENTLY NOT SUPPORTED IN POSTGRES
501  }
502  $res = $this->db->query('SHOW CREATE TABLE ' . $this->getTableName());
503  $data = $this->db->fetchAssoc($res);
504  $data = array_change_key_case($data, CASE_LOWER);
505 
506  $this->assertEquals($this->normalizeSQL($this->mock->getTableCreateSQLAfterRename($this->getTableName(), $this->db->getStorageEngine(), $this->db->supportsFulltext())), $this->normalizeSQL($data[self::CREATE_TABLE_ARRAY_KEY]));
507 
508  $this->changeBack();
509  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ testSelectUsrData()

ilDatabaseImplementationBaseTest::testSelectUsrData ( )
Exceptions

Definition at line 290 of file ilDatabaseImplementationBaseTest.php.

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

290  {
292 
293  $query = 'SELECT usr_id, login, is_self_registered FROM usr_data WHERE usr_id = 6';
294  // PDO
295  $this->db->setLimit(1, 0);
296  $result = $this->db->query($query);
297  $data = $this->db->fetchObject($result);
298  $this->assertEquals($output, $data);
299 
300  $result = $this->db->queryF('SELECT usr_id, login, is_self_registered FROM usr_data WHERE usr_id = %s', array( ilDBPdoFieldDefinition::T_INTEGER ), array( 6 ));
301  $this->db->setLimit(1, 0);
302  $data = $this->db->fetchObject($result);
303  $this->assertEquals($output, $data);
304 
305  $query = 'SELECT usr_id, login, is_self_registered FROM usr_data WHERE ' . $this->db->in('usr_id', array( 6, 13 ), false, 'integer');
306  $this->db->setLimit(2, 0);
307  $result = $this->db->query($query);
308  $data = $this->db->fetchAll($result);
310  $this->assertTrue(in_array($item, $data));
311  }
312 
313  $this->assertEquals(2, $this->db->numRows($result));
314  }
$result
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate

◆ testSequences()

ilDatabaseImplementationBaseTest::testSequences ( )

testConnection

Definition at line 363 of file ilDatabaseImplementationBaseTest.php.

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

363  {
364  if ($this->db->sequenceExists($this->getTableName())) {
365  $this->db->dropSequence($this->getTableName());
366  }
367  $this->db->createSequence($this->getTableName(), 10);
368  $this->assertEquals(10, $this->db->nextId($this->getTableName()));
369  $this->assertEquals(11, $this->db->nextId($this->getTableName()));
370  }
+ Here is the call graph for this function:

◆ testTableColums()

ilDatabaseImplementationBaseTest::testTableColums ( )

testConnection

Definition at line 349 of file ilDatabaseImplementationBaseTest.php.

References array, and getTableName().

349  {
350  $this->assertTrue($this->db->tableColumnExists($this->getTableName(), 'init_mob_id'));
351 
352  $this->db->addTableColumn($this->getTableName(), "export", array( "type" => "text", "length" => 1024 ));
353  $this->assertTrue($this->db->tableColumnExists($this->getTableName(), 'export'));
354 
355  $this->db->dropTableColumn($this->getTableName(), "export");
356  $this->assertFalse($this->db->tableColumnExists($this->getTableName(), 'export'));
357  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ testTransactions()

ilDatabaseImplementationBaseTest::testTransactions ( )

testConnection

Definition at line 558 of file ilDatabaseImplementationBaseTest.php.

558  {
559  // PDO
560  // $this->db->beginTransaction();
561  // $this->db->insert($this->getTableName(), $this->mock->getInputArrayForTransaction());
562  // $this->db->rollback();
563  // $st = $this->db->query('SELECT * FROM ' . $this->getTableName() . ' WHERE id = ' . $this->db->quote(123456, 'integer'));
564  // $this->assertEquals(0, $this->db->numRows($st));
565  }

◆ testUpdateNative()

ilDatabaseImplementationBaseTest::testUpdateNative ( )

testConnection

Definition at line 251 of file ilDatabaseImplementationBaseTest.php.

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

251  {
252  // With / without clob
253  $with_clob = $this->mock->getInputArray(2222, true);
254  $without_clob = $this->mock->getInputArray(2222, true, false);
255  $id = $with_clob['id'][1];
256 
257  // PDO
258  $this->db->update($this->getTableName(), $with_clob, array( 'id' => array( 'integer', $id ) ));
259  $this->db->setLimit(1, 0);
260  $res_pdo = $this->db->query("SELECT * FROM " . $this->getTableName() . " WHERE id = $id ");
261  $data_pdo = $this->db->fetchAssoc($res_pdo);
263 
264  $this->db->update($this->getTableName(), $without_clob, array( 'id' => array( 'integer', $id ) ));
265  $this->db->setLimit(1, 0);
266  $res_pdo = $this->db->query("SELECT * FROM " . $this->getTableName() . " WHERE id = $id ");
267  $data_pdo = $this->db->fetchAssoc($res_pdo);
269  }
Create styles array
The data for the language used.
+ 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: