From 5c781c0caa7d2bc573b278f3b9b2bea7d87016b6 Mon Sep 17 00:00:00 2001 From: Arthur Portugal Date: Fri, 4 Dec 2009 15:24:05 -0500 Subject: [PATCH] Fixed the file hot potatoes for all.test2.php CT#191 --- tests/main/exercice/hotpotatoes.lib.test.php | 49 ++++++++++++++++---- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/tests/main/exercice/hotpotatoes.lib.test.php b/tests/main/exercice/hotpotatoes.lib.test.php index 31a6631965..f296c6ded9 100755 --- a/tests/main/exercice/hotpotatoes.lib.test.php +++ b/tests/main/exercice/hotpotatoes.lib.test.php @@ -33,6 +33,8 @@ class TestHotpotatoes extends UnitTestCase { $res=GenerateHiddenList($imgparams); $this->assertTrue(is_string($res)); //var_dump($res); + + } function testGenerateHpFolder() { @@ -44,13 +46,40 @@ class TestHotpotatoes extends UnitTestCase { function testGetComment() { global $dbTable; - $path = 'test'; - $course_code='test'; - $query ="select comment from $dbTable where path='$path'"; - $res=GetComment($path,$course_code); - $this->assertTrue(is_string($res)); - //var_dump($res); - } + global $_configuration; + + require_once api_get_path(SYS_PATH).'tests/main/inc/lib/add_course.lib.inc.test.php'; + + // create a course + + $course_datos = array( + 'wanted_code'=> 'COD21', + 'title'=>'metodologia de calculo diferencial', + 'tutor_name'=>'R. J. Wolfagan', + 'category_code'=>'2121', + 'course_language'=>'english', + 'course_admin_id'=>'1211', + 'db_prefix'=> $_configuration['db_prefix'].'COD21', + 'db_prefix'=> $_configuration['db_prefix'].'COD21', + 'firstExpirationDelay'=>'112' + ); + $res = create_course($course_datos['wanted_code'], $course_datos['title'], + $course_datos['tutor_name'], $course_datos['category_code'], + $course_datos['course_language'],$course_datos['course_admin_id'], + $course_datos['db_prefix'], $course_datos['firstExpirationDelay']); + if ($res) { + $start = 0; + $end = 0; + $params=''; + $course_code = 'COD21'; + $path = 'exercice_submit.php'; + $query ="select comment from $dbTable where path='$path'"; + $res=GetComment($path,$course_code); + + $this->assertTrue(is_string($res)); + //var_dump($res); + } + } /* Deprecated function testGetFileName() { @@ -92,11 +121,13 @@ class TestHotpotatoes extends UnitTestCase { } function testGetQuizName() { + $course_code = 'COD21'; $fname='exercice_submit.php'; $fpath='main/exercice/exercice_submit.php'; $res=GetQuizName($fname,$fpath); + $this->assertTrue(is_string($res)); - //var_dump($e_contents); + //var_dump($res); } function testGetSrcName() { @@ -167,9 +198,11 @@ class TestHotpotatoes extends UnitTestCase { } function testWriteFileCont() { + $course_code = 'COD21'; $full_file_path='/main/exercice/'; $content='test test test'; $res=WriteFileCont($full_file_path,$content); + $resu = CourseManager::delete_course($course_code); $this->assertTrue(is_bool($res)); //var_dump($res); }