diff --git a/tests/main/inc/lib/notebook.lib.test.php b/tests/main/inc/lib/notebook.lib.test.php index 78aaec51a2..8132be5000 100644 --- a/tests/main/inc/lib/notebook.lib.test.php +++ b/tests/main/inc/lib/notebook.lib.test.php @@ -1,62 +1,64 @@ assertTrue(is_string($res)); - ob_end_clean(); - //var_dump($res); + public function testJavascriptNotebook() { + $res = NotebookManager::javascript_notebook(null); + $lang = get_lang("NoteConfirmDelete"); + $this->assertTrue(is_string($res)); + $this->assertPattern('/'.addslashes($lang).'/m',$res); } - function testSaveNote() { - ob_start(); - $values =array(); - $res = NotebookManager::save_note($values); + public function testSaveNote() { + $resNull = NotebookManager::save_note(null); + $this->assertFalse($resNull); + $resFalse = NotebookManager::save_note(-1); + $this->assertFalse($resFalse); + $res = NotebookManager::save_note(array()); $this->assertTrue(is_bool($res)); - ob_end_clean(); - //var_dump($res); } - function testGetNoteInformation() { - ob_start(); - $notebook_id=1; - $res = NotebookManager::get_note_information($notebook_id); - $this->assertTrue(!(bool)$res); - ob_end_clean(); - //var_dump($res); + public function testGetNoteInformation() { + $resNull = NotebookManager::get_note_information(null); + $this->assertFalse($resNull); + $resFalse = NotebookManager::get_note_information(-1); + $this->assertFalse($resFalse); + $res = NotebookManager::get_note_information(1); + $this->assertTrue(is_array($res)); } - function testUpdateNote() { - ob_start(); - $values=array(); - $res = NotebookManager::update_note($values); - $this->assertTrue(is_bool($res)); - ob_end_clean(); - //var_dump($res); + public function testUpdateNote() { + $resNull = NotebookManager::update_note(null); + $this->assertFalse($resNull); + $resFalse = NotebookManager::update_note('char'); + $this->assertFalse($resFalse); + $res = NotebookManager::update_note(array()); + $this->assertTrue(is_bool($res)); + + } - function testDisplayNotes() { + public function testDisplayNotes() { ob_start(); $res = NotebookManager::display_notes(); $this->assertTrue(is_null($res)); ob_end_clean(); - //var_dump($res); } - function testDeleteNote() { - ob_start(); - $notebook_id=1; - $res = NotebookManager::delete_note($notebook_id); + public function testDeleteNote() { + $resNull = NotebookManager::delete_note(null); + $this->assertFalse($resNull); + $resFalse = NotebookManager::delete_note(-1); + $this->assertFalse($resFalse); + $res = NotebookManager::delete_note(1); $this->assertTrue(is_bool($res)); - ob_end_clean(); - //var_dump($res); } - + public function __destruct() { + TestManager::delete_test_course('COURSENOTEBOOK'); + } } ?> \ No newline at end of file diff --git a/tests/test_manager.inc.php b/tests/test_manager.inc.php index 68e1ab5c72..d84bbab880 100644 --- a/tests/test_manager.inc.php +++ b/tests/test_manager.inc.php @@ -68,6 +68,7 @@ require_once $maindir.'gradebook/lib/be/result.class.php'; require_once $maindir.'gradebook/lib/be/forumthreadlink.class.php'; + /**Files inside '/../main/lib/' */ require_once $libdir.'urlmanager.lib.php'; require_once $libdir.'fileDisplay.lib.php'; @@ -80,6 +81,7 @@ require_once $libdir.'xmd.lib.php'; require_once $libdir.'formvalidator/FormValidator.class.php'; require_once $libdir.'exercise_show_functions.lib.php'; require_once $libdir.'fileManage.lib.php'; +require_once $libdir.'notebook.lib.php'; /**This files need be inside a buffering to clean the objects*/ ob_start(); diff --git a/tests/test_suite.php b/tests/test_suite.php index 1abdf7405e..5742b2a4f1 100755 --- a/tests/test_suite.php +++ b/tests/test_suite.php @@ -110,8 +110,8 @@ class TestsSuite extends TestSuite { $this->addFile(api_get_path(SYS_TEST_PATH).'/main/webservices/user_import/import.lib.test.php'); $this->addFile(api_get_path(SYS_TEST_PATH).'/main/work/work.lib.test.php'); $this->addFile(api_get_path(SYS_TEST_PATH).'/main/inc/lib/glossary.lib.test.php'); - $this->addFile(api_get_path(SYS_TEST_PATH).'/main/inc/lib/notebook.lib.test.php'); - $this->addFile(api_get_path(SYS_TEST_PATH).'/main/permissions/permissions_functions.inc.test.php'); + */$this->addFile(api_get_path(SYS_TEST_PATH).'/main/inc/lib/notebook.lib.test.php'); + /*$this->addFile(api_get_path(SYS_TEST_PATH).'/main/permissions/permissions_functions.inc.test.php'); $this->addFile(api_get_path(SYS_TEST_PATH).'/main/resourcelinker/resourcelinker.inc.test.php'); $this->addFile(api_get_path(SYS_TEST_PATH).'/main/survey/survey.lib.test.php'); $this->addFile(api_get_path(SYS_TEST_PATH).'/main/dropbox/dropbox_class.inc.test.php');