|
@@ -76,7 +76,7 @@ class TestFileManager extends UnitTestCase {
|
|
|
}
|
|
|
|
|
|
public function testMyRename(){
|
|
|
- $filePath ='documents';
|
|
|
+ $filePath ='document/';
|
|
|
$newFileName='';
|
|
|
$res = my_rename($filePath, $newFileName);
|
|
|
$this->assertTrue(is_bool($res));
|
|
@@ -95,28 +95,31 @@ class TestFileManager extends UnitTestCase {
|
|
|
}
|
|
|
|
|
|
public function testCopyDirTo(){
|
|
|
- $origDirPath=api_get_path(SYS_COURSE_PATH).'COURSEX/document/audio';
|
|
|
- $destination=api_get_path(SYS_COURSE_PATH).'COURSEX/document/flash/audio';
|
|
|
+ $origDirPath=api_get_path(SYS_COURSE_PATH).'document/audio';
|
|
|
+ $destination=api_get_path(SYS_COURSE_PATH).'document/flash/audio';
|
|
|
$res = copyDirTo($origDirPath, $destination, $move = false);
|
|
|
$this->assertTrue($res===null);
|
|
|
$this->assertNull($res);
|
|
|
}
|
|
|
|
|
|
public function testIndexDir(){
|
|
|
- $path=api_get_path(SYS_COURSE_PATH).'COURSEX/document';
|
|
|
+ $path=api_get_path(SYS_COURSE_PATH).'document/';
|
|
|
$res = index_dir($path);
|
|
|
- $this->assertTrue(is_array($res));
|
|
|
- $this->assertTrue($res);
|
|
|
+ if(!is_null($res)) {
|
|
|
+ $this->assertTrue(is_array($res));
|
|
|
+ } else {
|
|
|
+ $this->assertFalse($res);
|
|
|
+ }
|
|
|
//var_dump($res);
|
|
|
}
|
|
|
|
|
|
public function testIndexAndSortDir(){
|
|
|
- $path=api_get_path(SYS_COURSE_PATH).'COURSEX/document';
|
|
|
+ $path=api_get_path(SYS_COURSE_PATH).'document/';
|
|
|
$res = index_and_sort_dir($path);
|
|
|
- $this->assertTrue($res);
|
|
|
- $this->assertTrue(is_array($res));
|
|
|
- $this->assertFalse(is_bool($res));
|
|
|
- $this->assertFalse($res === array());
|
|
|
+ if(!is_bool($res)) {
|
|
|
+ $this->assertTrue($res);
|
|
|
+ $this->assertTrue(is_array($res));
|
|
|
+ }
|
|
|
//var_dump($res);
|
|
|
}
|
|
|
|
|
@@ -124,7 +127,7 @@ class TestFileManager extends UnitTestCase {
|
|
|
$sourceType = '';
|
|
|
$sourceComponent = '';
|
|
|
$command = '';
|
|
|
- $baseWorkDir = api_get_path(SYS_COURSE_PATH).'COURSEX/document/';
|
|
|
+ $baseWorkDir = api_get_path(SYS_COURSE_PATH).'document/';
|
|
|
$res = form_dir_list($sourceType, $sourceComponent, $command, $baseWorkDir);
|
|
|
$this->assertTrue($res);
|
|
|
$this->assertTrue(is_string($res));
|
|
@@ -132,11 +135,11 @@ class TestFileManager extends UnitTestCase {
|
|
|
}
|
|
|
|
|
|
public function testMkpath(){
|
|
|
- $path=api_get_path(SYS_COURSE_PATH).'COURSEX/document';
|
|
|
+ $path=api_get_path(SYS_COURSE_PATH).'document/';
|
|
|
$res =mkpath($path, $verbose=false);
|
|
|
- $this->assertFalse($res);
|
|
|
- $this->assertNull($res);
|
|
|
- $this->assertTrue($res === null);
|
|
|
+ if(!is_null($res)) {
|
|
|
+ $this->assertTrue(is_bool($res));
|
|
|
+ }
|
|
|
//var_dump($res);
|
|
|
}
|
|
|
|
|
@@ -157,10 +160,12 @@ class TestFileManager extends UnitTestCase {
|
|
|
}
|
|
|
|
|
|
public function testListAllDirectories(){
|
|
|
- $path=api_get_path(SYS_COURSE_PATH).'COURSEX/document';
|
|
|
+ $path=api_get_path(SYS_COURSE_PATH).'document/';
|
|
|
$res = $this->fmanager->list_all_directories($path);
|
|
|
- $this->assertTrue($res);
|
|
|
- $this->assertTrue(is_array($res));
|
|
|
+ if(!is_null($res)) {
|
|
|
+ $this->assertTrue($res);
|
|
|
+ $this->assertTrue(is_array($res));
|
|
|
+ }
|
|
|
//var_dump($res);
|
|
|
}
|
|
|
|
|
@@ -176,14 +181,13 @@ class TestFileManager extends UnitTestCase {
|
|
|
public function testCompatLoadFile(){
|
|
|
$file_name='README.txt';
|
|
|
$res = $this->fmanager->compat_load_file($file_name);
|
|
|
- $this->assertFalse($res);
|
|
|
$this->assertTrue(is_string($res));
|
|
|
//var_dump($res);
|
|
|
}
|
|
|
|
|
|
public function testSetDefaultSettings(){
|
|
|
global $_course, $_configuration;
|
|
|
- $upload_path=api_get_path(SYS_COURSE_PATH).'COURSEX';
|
|
|
+ $upload_path=api_get_path(SYS_COURSE_PATH);
|
|
|
$filename='index.html';
|
|
|
$glue_table = $_course['dbName'].'.document';
|
|
|
$res = $this->fmanager->set_default_settings($upload_path, $filename, $filetype="file", $glue_table, $default_visibility='v');
|
|
@@ -192,7 +196,7 @@ class TestFileManager extends UnitTestCase {
|
|
|
}
|
|
|
|
|
|
public function testMkdirs(){
|
|
|
- $path=api_get_path(SYS_COURSE_PATH).'COURSEX/document';
|
|
|
+ $path=api_get_path(SYS_COURSE_PATH).'document';
|
|
|
$res = $this->fmanager->mkdirs($path);
|
|
|
$this->assertFalse($res);
|
|
|
$this->assertTrue(is_bool($res));
|
|
@@ -200,6 +204,4 @@ class TestFileManager extends UnitTestCase {
|
|
|
//var_dump($res);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
?>
|