parent
3dd25788c2
commit
6434532b89
@ -1,62 +1,64 @@ |
|||||||
<?php |
<?php |
||||||
require_once(api_get_path(LIBRARY_PATH).'notebook.lib.php'); |
|
||||||
|
|
||||||
//require_once api_get_path(SYS_CODE_PATH).'inc/global.inc.php'; |
|
||||||
class TestNotebook extends UnitTestCase { |
class TestNotebook extends UnitTestCase { |
||||||
|
|
||||||
|
public function __construct() { |
||||||
|
TestManager::create_test_course('COURSENOTEBOOK'); |
||||||
|
} |
||||||
|
|
||||||
function testJavascriptNotebook() { |
public function testJavascriptNotebook() { |
||||||
ob_start(); |
$res = NotebookManager::javascript_notebook(null); |
||||||
$values =array(); |
$lang = get_lang("NoteConfirmDelete"); |
||||||
$res = NotebookManager::javascript_notebook($values); |
$this->assertTrue(is_string($res)); |
||||||
$this->assertTrue(is_string($res)); |
$this->assertPattern('/'.addslashes($lang).'/m',$res); |
||||||
ob_end_clean(); |
|
||||||
//var_dump($res); |
|
||||||
} |
} |
||||||
|
|
||||||
function testSaveNote() { |
public function testSaveNote() { |
||||||
ob_start(); |
$resNull = NotebookManager::save_note(null); |
||||||
$values =array(); |
$this->assertFalse($resNull); |
||||||
$res = NotebookManager::save_note($values); |
$resFalse = NotebookManager::save_note(-1); |
||||||
|
$this->assertFalse($resFalse); |
||||||
|
$res = NotebookManager::save_note(array()); |
||||||
$this->assertTrue(is_bool($res)); |
$this->assertTrue(is_bool($res)); |
||||||
ob_end_clean(); |
|
||||||
//var_dump($res); |
|
||||||
} |
} |
||||||
|
|
||||||
function testGetNoteInformation() { |
public function testGetNoteInformation() { |
||||||
ob_start(); |
$resNull = NotebookManager::get_note_information(null); |
||||||
$notebook_id=1; |
$this->assertFalse($resNull); |
||||||
$res = NotebookManager::get_note_information($notebook_id); |
$resFalse = NotebookManager::get_note_information(-1); |
||||||
$this->assertTrue(!(bool)$res); |
$this->assertFalse($resFalse); |
||||||
ob_end_clean(); |
$res = NotebookManager::get_note_information(1); |
||||||
//var_dump($res); |
$this->assertTrue(is_array($res)); |
||||||
} |
} |
||||||
|
|
||||||
function testUpdateNote() { |
public function testUpdateNote() { |
||||||
ob_start(); |
$resNull = NotebookManager::update_note(null); |
||||||
$values=array(); |
$this->assertFalse($resNull); |
||||||
$res = NotebookManager::update_note($values); |
$resFalse = NotebookManager::update_note('char'); |
||||||
$this->assertTrue(is_bool($res)); |
$this->assertFalse($resFalse); |
||||||
ob_end_clean(); |
$res = NotebookManager::update_note(array()); |
||||||
//var_dump($res); |
$this->assertTrue(is_bool($res)); |
||||||
|
|
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
function testDisplayNotes() { |
public function testDisplayNotes() { |
||||||
ob_start(); |
ob_start(); |
||||||
$res = NotebookManager::display_notes(); |
$res = NotebookManager::display_notes(); |
||||||
$this->assertTrue(is_null($res)); |
$this->assertTrue(is_null($res)); |
||||||
ob_end_clean(); |
ob_end_clean(); |
||||||
//var_dump($res); |
|
||||||
} |
} |
||||||
|
|
||||||
function testDeleteNote() { |
public function testDeleteNote() { |
||||||
ob_start(); |
$resNull = NotebookManager::delete_note(null); |
||||||
$notebook_id=1; |
$this->assertFalse($resNull); |
||||||
$res = NotebookManager::delete_note($notebook_id); |
$resFalse = NotebookManager::delete_note(-1); |
||||||
|
$this->assertFalse($resFalse); |
||||||
|
$res = NotebookManager::delete_note(1); |
||||||
$this->assertTrue(is_bool($res)); |
$this->assertTrue(is_bool($res)); |
||||||
ob_end_clean(); |
|
||||||
//var_dump($res); |
|
||||||
} |
} |
||||||
|
|
||||||
|
public function __destruct() { |
||||||
|
TestManager::delete_test_course('COURSENOTEBOOK'); |
||||||
|
} |
||||||
} |
} |
||||||
?> |
?> |
Loading…
Reference in new issue