Improve Scorm Test and create scormitem, scormOrganization and scormResource test CT#191

skala
Carlos Vargas 15 years ago
parent ea8f42eab2
commit b2ba012df2
  1. 286
      tests/main/newscorm/learnpath.class.test.php
  2. 2
      tests/main/newscorm/learnpathItem.class.test.php
  3. 34
      tests/main/newscorm/scorm.class.test.php
  4. 18
      tests/main/newscorm/scorm.lib.test.php
  5. 26
      tests/main/newscorm/scormItem.class.test.php
  6. 39
      tests/main/newscorm/scormOrganization.class.test.php
  7. 30
      tests/main/newscorm/scormResource.class.test.php

File diff suppressed because it is too large Load Diff

@ -3,7 +3,7 @@ require_once(api_get_path(SYS_CODE_PATH).'newscorm/learnpathItem.class.php');
require_once(api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php');
class TestScorm extends UnitTestCase {
class TestLearnpathItem extends UnitTestCase {
public function TestScorm() {

@ -2,9 +2,9 @@
require_once(api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php');
require_once(api_get_path(SYS_CODE_PATH).'newscorm/scorm.class.php');
class TestScorm extends UnitTestCase {
class TestScormClass extends UnitTestCase {
/*
function testScorm() {
public function testScorm() {
//ob_start();
$course_code = 'COURSETEST';
$resource_id = 1;
@ -16,7 +16,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}*/
function testOpen() {
public function testOpen() {
//ob_start();
$id = 1;
$res = scorm::open($id);
@ -25,7 +25,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}
function testParseManifest() {
public function testParseManifest() {
//ob_start();
$course_code = 'COURSETEST';
$resource_id = 1;
@ -37,7 +37,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}
function testImportManifest() {
public function testImportManifest() {
//ob_start();
$course_code = 'COURSETEST';
$resource_id = 1;
@ -49,7 +49,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}
/*
function testImportLocalPackage() {
public function testImportLocalPackage() {
//ob_start();
$course_code = 'COURSETEST';
$resource_id = 1;
@ -61,7 +61,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}
function testImportPackage() {
public function testImportPackage() {
//ob_start();
$course_code = 'COURSETEST';
$resource_id = 1;
@ -73,7 +73,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}*/
function testSetProximity() {
public function testSetProximity() {
//ob_start();
$course_code = 'COURSETEST';
$resource_id = 1;
@ -85,7 +85,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}
function testSetTheme() {
public function testSetTheme() {
//ob_start();
$course_code = 'COURSETEST';
$resource_id = 1;
@ -97,7 +97,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}
function testSetPreviewImage() {
public function testSetPreviewImage() {
//ob_start();
$course_code = 'COURSETEST';
$resource_id = 1;
@ -109,7 +109,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}
function testSetAuthor() {
public function testSetAuthor() {
//ob_start();
$course_code = 'COURSETEST';
$resource_id = 1;
@ -121,7 +121,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}
function testSetMaker() {
public function testSetMaker() {
//ob_start();
$course_code = 'COURSETEST';
$resource_id = 1;
@ -133,7 +133,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}
function testExportZip() {
public function testExportZip() {
//ob_start();
$course_code = 'COURSETEST';
$resource_id = 1;
@ -145,7 +145,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}
function testGetResPath() {
public function testGetResPath() {
//ob_start();
$res = scorm::get_res_path($id=1);
$this->assertTrue(is_string($res));
@ -153,7 +153,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}
function testGetResType() {
public function testGetResType() {
//ob_start();
$res = scorm::get_res_type($id = 1);
$this->assertTrue(is_string($res));
@ -161,7 +161,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}
function testGetTitle() {
public function testGetTitle() {
//ob_start();
$res = scorm::get_title();
$this->assertTrue(is_string($res));
@ -169,7 +169,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}
function testReimportManifest() {
public function testReimportManifest() {
ob_start();
$course_code = 'COURSETEST';
$resource_id = 1;

@ -1,16 +1,16 @@
<?php
require_once(api_get_path(SYS_CODE_PATH).'newscorm/scorm.lib.php');
class TestScorm extends UnitTestCase {
class TestScormLib extends UnitTestCase {
/**
* This function gets a list of scorm paths located in a given directory
* This public function gets a list of scorm paths located in a given directory
* @param string Base directory path
* @param string Current directory
* @param array Reference to a list of paths that exist in the database
* @return array Array(type=>array(),size=>array(),date=>array())
*/
function testget_scorm_paths_from_dir() {
public function testget_scorm_paths_from_dir() {
$basedir='';
$curdir='';
$attribute=array('abc');
@ -23,9 +23,9 @@ class TestScorm extends UnitTestCase {
* Detects the SCORM version from an imsmanifest.xml file
* @param string Path to imsmanifest.xml
* @return string SCORM version (1.0,1.1,1.2,1.3)
* @todo Implement this function
* @todo Implement this public function
*/
function testget_scorm_version() {
public function testget_scorm_version() {
$path_name = api_get_path(SYS_COURSE_PATH);
$path=$path_name.'scorm/';
$res=get_scorm_version($path);
@ -38,7 +38,7 @@ class TestScorm extends UnitTestCase {
* @param string Dir path
* @return boolean True on success, false otherwise
*/
function testremovescormDirFalse() {
public function testremovescormDirFalse() {
$path_name = api_get_path(SYS_COURSE_PATH);
$dir=$path_name.'scorm/';
$res=removescormDir($dir);
@ -46,7 +46,7 @@ class TestScorm extends UnitTestCase {
//var_dump($res);
}
function testremovescormDirTrue() {
public function testremovescormDirTrue() {
$path_name = api_get_path(SYS_COURSE_PATH);
$dir=$path_name.'scorm/';
$res=removescormDir($dir);
@ -55,12 +55,12 @@ class TestScorm extends UnitTestCase {
}
/**
* This function removes a directory if it exists
* This public function removes a directory if it exists
* @param string Dir path
* @return boolean True on success, false otherwise
* @uses removescormDir() to actually remove the directory
*/
function testscorm_delete() {
public function testscorm_delete() {
require_once(api_get_path(LIBRARY_PATH).'/fileManage.lib.php');
$path_name = api_get_path(SYS_COURSE_PATH);
$file=$path_name.'scorm/';

@ -0,0 +1,26 @@
<?php
require_once(api_get_path(SYS_CODE_PATH).'newscorm/scormItem.class.php');
require_once(api_get_path(SYS_CODE_PATH).'newscorm/learnpathItem.class.php');
class TestScormItem extends UnitTestCase {
public function testGetFlatList() {
//ob_start();
$obj = new scormItem($type='manifest',&$element);
$res = $obj->get_flat_list(&$list,&$abs_order,$rel_order=1,$level=0);
$this->assertTrue(is_null($res));
//ob_end_clean();
//var_dump($res);
}
/*
public function testSave() {
//ob_start();
$obj = new scormItem($type='manifest',&$element);
$res = $obj->save($from_outside=true,$prereqs_complete=false);
$this->assertTrue(is_null($res));
//ob_end_clean();
//var_dump($res);
}*/
}
?>

@ -0,0 +1,39 @@
<?php
require_once(api_get_path(SYS_CODE_PATH).'newscorm/scormOrganization.class.php');
class TestScormOrganization extends UnitTestCase {
public function testget_flat_items_list() {
//ob_start();
$obj = new scormOrganization($type='manifest',&$element,$scorm_charset='UTF-8');
$res = $obj->get_flat_items_list();
$this->assertTrue(is_array($res));
//ob_end_clean();
//var_dump($res);
}
public function testGetScormType() {
//ob_start();
$res = scormOrganization::get_name();
$this->assertTrue(is_string($res));
//ob_end_clean();
//var_dump($res);
}
public function testGetRef() {
//ob_start();
$res = scormOrganization::get_ref();
$this->assertTrue(is_string($res));
//ob_end_clean();
//var_dump($res);
}
public function testSetName() {
//ob_start();
$res = scormOrganization::set_name($title = 'Titulo');
$this->assertTrue(is_null($res));
//ob_end_clean();
//var_dump($res);
}
}
?>

@ -0,0 +1,30 @@
<?php
require_once(api_get_path(SYS_CODE_PATH).'newscorm/scormResource.class.php');
class TestScormResource extends UnitTestCase {
/*
function testScormResource() {
//ob_start();
$res = scormResource::scormResource($type='manifest',&$element);
$this->assertTrue(is_bool($res));
//ob_end_clean();
//var_dump($res);
}
*/
public function testGetPath() {
//ob_start();
$res = scormResource::get_path();
$this->assertTrue(is_string($res));
//ob_end_clean();
//var_dump($res);
}
public function testGetScormType() {
//ob_start();
$res = scormResource::get_scorm_type();
$this->assertTrue(is_string($res));
//ob_end_clean();
//var_dump($res);
}
}
?>
Loading…
Cancel
Save