123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319 |
- <?php
- class TestDropbox extends UnitTestCase {
-
- public $ddropboxwork;
- public $ddropboxsentwork;
- public $dperson;
-
- public function TestDropbox() {
- $this->UnitTestCase('');
- }
-
- public function setUp() {
- global $dropbox_cnf;
- $dropbox_cnf['tbl_post'] = Database::get_course_table(TABLE_DROPBOX_POST);
- $dropbox_cnf['tbl_file'] = Database::get_course_table(TABLE_DROPBOX_FILE);
- $dropbox_cnf['tbl_person'] = Database::get_course_table(TABLE_DROPBOX_PERSON);
- $dropbox_cnf['tbl_intro'] = Database::get_course_table(TABLE_TOOL_INTRO);
- $dropbox_cnf['tbl_user'] = Database::get_main_table(TABLE_MAIN_USER);
- $dropbox_cnf['tbl_course_user'] = Database::get_main_table(TABLE_MAIN_COURSE_USER);
- $dropbox_cnf['tbl_category'] = Database::get_course_table(TABLE_DROPBOX_CATEGORY);
- $dropbox_cnf['tbl_feedback'] = Database::get_course_table(TABLE_DROPBOX_FEEDBACK);
- $this->ddropboxwork = new Dropbox_Work(1);
- $this->ddropboxsentwork = new Dropbox_SentWork(1);
- $this->dperson = new Dropbox_Person(1, 1, 1);
- }
-
- public function tearDown() {
- $this-> ddropboxwork = null;
- $this-> ddropboxsentwork = null;
- $this-> dperson = null;
- }
-
-
-
- function testDropbox_Work() {
- $arg1=1;
- $resu= $this->ddropboxwork->Dropbox_Work($arg1, $arg2=null, $arg3=null, $arg4=null, $arg5=null, $arg6=null);
- $this->assertTrue(is_null($resu));
-
- }
-
-
-
- function testCreateNewWork() {
- global $dropbox_cnf;
- $uploader_id=1;
- $title='test';
- $description = 'testing';
- $author= 'test';
- $filename='test.txt';
- $filesize=125;
- $resu= $this->ddropboxwork->_createNewWork($uploader_id, $title, $description, $author, $filename, $filesize);
- $this->assertTrue(is_null($resu));
-
- }
-
-
-
- function testCreateExistingWork() {
- global $dropbox_cnf;
- $dropbox_cnf['tbl_file'] = Database::get_course_table(TABLE_DROPBOX_FILE);
- $dropbox_cnf['tbl_feedback'] = Database::get_course_table(TABLE_DROPBOX_FEEDBACK);
- $id = 1;
- $resu= $this->ddropboxwork->_createExistingWork($id);
- $this->assertTrue(is_null($resu));
-
- }
-
-
-
-
- function testDropbox_SentWork() {
- $arg1 = 1;
- $resu= $this->ddropboxsentwork->Dropbox_SentWork($arg1, $arg2=null, $arg3=null, $arg4=null, $arg5=null, $arg6=null, $arg7=null);
- $this->assertTrue(is_null($resu));
- }
-
-
-
- function testCreateNewSentWork() {
- $recipient_ids = array(1,2);
- $uploader_id=1;
- $title='test';
- $description = 'testing';
- $author= 'test';
- $filename='test.txt';
- $filesize=125;
- $resu= $this->ddropboxsentwork->_createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids);
- $this->assertTrue(is_null($resu));
- }
-
-
-
- function testCreateExistingSentWork() {
- $id = 1;
- $resu= $this->ddropboxsentwork->_createExistingSentWork($id);
- $this->assertTrue(is_null($resu));
- }
-
-
-
-
- function testDropbox_Person() {
- $userId = 1;
- $isCourseAdmin = 1;
- $isCourseTutor = 1;
- $resu= $this->dperson->Dropbox_Person($userId, $isCourseAdmin, $isCourseTutor);
- $this->assertTrue(is_null($resu));
- }
-
-
-
- function testCmpWork() {
- $a = 1;
- $b = 1;
- $resu= $this->dperson->_cmpWork($a, $b);
- if(!is_numeric($resu)) {
- $this->assertTrue(is_null($resu));
- }
- }
-
-
-
- function testorderSentWork() {
- $sort = 1;
- $resu= $this->dperson->orderSentWork($sort);
- if(!is_numeric($resu)) {
- $this->assertTrue(is_null($resu));
- }
- }
-
-
-
- function testorderReceivedWork() {
- $sort = 1;
- $resu= $this->dperson->orderReceivedWork($sort);
- if(!is_numeric($resu)) {
- $this->assertTrue(is_null($resu));
- }
- }
-
-
-
- function testupdateFeedback() {
- $id = 1;
- $text = 'test';
- $resu= $this->dperson->updateFeedback($id, $text);
- if(!is_bool($resu)) {
- $this->assertTrue(is_null($resu));
- }
- }
-
-
-
- function testfilter_received_work() {
- $type = 1;
- $value = 1;
- $resu= $this->dperson->filter_received_work($type,$value);
- if(!is_bool($resu)) {
- $this->assertTrue(is_null($resu));
- }
- }
-
-
-
- function testdeleteAllReceivedWork() {
- $resu= $this->dperson->deleteAllReceivedWork();
- if(!is_numeric($resu)) {
- $this->assertTrue(is_null($resu));
- }
- }
-
-
-
- function testdeleteReceivedWorkFolder() {
- $id = 1;
- $resu= $this->dperson->deleteReceivedWorkFolder($id);
- if(!is_bool($resu)) {
- $this->assertTrue(is_null($resu));
- }
- }
-
-
-
- function testdeleteReceivedWork() {
- $id = 1;
- $resu= $this->dperson->deleteReceivedWork($id);
- if(!is_bool($resu)) {
- $this->assertTrue(is_null($resu));
- }
- }
-
-
-
- function testdeleteAllSentWork() {
- $resu= $this->dperson->deleteAllSentWork();
- if(!is_bool($resu)) {
- $this->assertTrue(is_null($resu));
- }
- }
-
-
-
- function testdeleteSentWork() {
- $id = 1;
- $resu= $this->dperson->deleteSentWork($id);
- if(!is_bool($resu)) {
- $this->assertTrue(is_null($resu));
- }
- }
- }
- ?>
|