|
|
|
@ -17,7 +17,7 @@ class TestDatabase extends UnitTestCase { |
|
|
|
|
public function tearDown() { |
|
|
|
|
$this->dbase = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function testAffectedRows() { |
|
|
|
|
$res=$this->dbase->affected_rows(); |
|
|
|
|
$this->assertTrue(is_numeric($res)); |
|
|
|
@ -27,7 +27,7 @@ class TestDatabase extends UnitTestCase { |
|
|
|
|
$table='class'; |
|
|
|
|
$res=$this->dbase->count_rows($table); |
|
|
|
|
if(!is_string($res)){ |
|
|
|
|
$this->assertTrue(is_numeric($res)); |
|
|
|
|
$this->assertTrue(is_numeric($res)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -72,6 +72,7 @@ class TestDatabase extends UnitTestCase { |
|
|
|
|
$this->assertTrue(is_array($resu)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* // Contains a private unaccessible method, Database::fix_database_parameter(). |
|
|
|
|
function testFixDatabaseParameterEmpty() { |
|
|
|
|
$course_info = api_get_course_info(); |
|
|
|
|
$database_name= $course_info[""]; |
|
|
|
@ -81,27 +82,34 @@ class TestDatabase extends UnitTestCase { |
|
|
|
|
endif; |
|
|
|
|
//var_dump($res); |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
/* // Contains a private unaccessible method, Database::fix_database_parameter(). |
|
|
|
|
function testFixDatabaseParameterReturnString() { |
|
|
|
|
$course_info = api_get_course_info(); |
|
|
|
|
$database_name= $course_info["dbName"]; |
|
|
|
|
$res=$this->dbase->fix_database_parameter($course_info); |
|
|
|
|
$this->assertTrue(is_string($res)); |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
/* // Contains a private unaccessible method, Database::format_glued_course_table_name(). |
|
|
|
|
function testFormatGluedCourseTableName() { |
|
|
|
|
$database_name_with_glue=''; |
|
|
|
|
$table=''; |
|
|
|
|
$res=$this->dbase->format_glued_course_table_name($database_name_with_glue, $table); |
|
|
|
|
$this->assertTrue(is_string($res)); |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
/* // Contains a private unaccessible method, Database::format_table_name(). |
|
|
|
|
function testFormatTableName() { |
|
|
|
|
$database=''; |
|
|
|
|
$table=''; |
|
|
|
|
$res=$this->dbase->format_table_name($database, $table); |
|
|
|
|
$this->assertTrue(is_string($res)); |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
function testGenerateAbstractCourseFieldNames() { |
|
|
|
|
$result_array=''; |
|
|
|
@ -250,12 +258,14 @@ class TestDatabase extends UnitTestCase { |
|
|
|
|
$this->assertTrue($res); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* // Contains a private unaccessible method, Database::glue_course_database_name(). |
|
|
|
|
function testGlueCourseDatabaseName() { |
|
|
|
|
$database_name=''; |
|
|
|
|
$res=$this->dbase->glue_course_database_name($database_name); |
|
|
|
|
$this->assertTrue(is_string($res)); |
|
|
|
|
$this->assertTrue($res); |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
function testInsertId() { |
|
|
|
|
$res=$this->dbase->insert_id(); |
|
|
|
@ -264,7 +274,7 @@ class TestDatabase extends UnitTestCase { |
|
|
|
|
|
|
|
|
|
function testNumRows() { |
|
|
|
|
$sql= "SELECT * FROM chamilo_main.user"; |
|
|
|
|
$res = Database::query($sql); |
|
|
|
|
$res = Database::query($sql); |
|
|
|
|
$resul=Database::num_rows($res); |
|
|
|
|
$this->assertTrue(is_numeric($resul)); |
|
|
|
|
//var_Dump($res); |
|
|
|
|