Esempio n. 1
0
 function index()
 {
     $action = $this->action_factory->check($this->action1_id);
     $this->unit->run($action->get_lang(), $this->action1_lang, '讀取action1的lang看看');
     $this->load->library('kals_resource/Webpage');
     $webpage = $this->webpage;
     $this->load->library('kals_resource/Domain');
     $domain = $this->domain;
     $this->unit->run($action->is_applicable($webpage), TRUE, '測試action2的is_applicable Webpage');
     $this->unit->run($action->is_applicable($domain), FALSE, '測試action2的is_applicable Domain');
     $action = $this->action_factory->check($this->action2_id);
     $this->unit->run($action->get_applicable_id(), $this->action2_type_id, '讀取action2的applicable_id看看');
     $action = $this->action_factory->check($this->action3_id);
     $this->unit->run($action->get_id(), $this->action3_id, '讀取action3的id看看');
     $this->unit->run($action->is_applicable($domain), TRUE, '測試action3的is_applicable Domain');
     $this->unit->run($action->is_applicable($webpage), FALSE, '測試action3的is_applicable Webpage');
     $actions = $this->action_factory->find_all();
     $this->unit->run(count($actions), 5, 'find_all');
     $actions = $this->action_factory->find_all($webpage);
     $this->unit->run(count($actions), 3, 'find_all webpage');
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     unit_test_report($this);
 }
Esempio n. 2
0
 function index()
 {
     $text = "而且NetBeans寫習慣之後,回頭用這RJ Text來寫PHP真是有夠痛苦的。";
     $text2 = "複雜的程式大概1天完成1支";
     $text3 = '這種天氣喝黑糖薑母茶真是有種爽快感
         ';
     $text3_fixed = '這種天氣喝黑糖薑母茶真是有種爽快感';
     $seg = '而且/C NetBeans/FW 寫/Vt 習慣/N 之後/POST ,/COMMACATEGORY 回頭/ADV 用/P 這/DET RJ/FW Text/FW 來/ADV 寫/Vt PHP/FW 真是/ADV 有夠/ADV 痛苦/Vi 的/T 。/PERIODCATEGORY';
     $query = '( 而且 ) | ( NetBeans ) | ( 寫 ) | ( 習慣 ) | ( 之後 ) | ( , ) | ( 回頭 ) | ( 用 ) | ( 這 ) | ( RJ ) | ( Text ) | ( 來 ) | ( 寫 ) | ( PHP ) | ( 真是 ) | ( 有夠 ) | ( 痛苦 ) | ( 的 ) | ( 。 )';
     $speech = '0 => C | 1 => FW | 2 => Vt | 3 => N | 4 => POST | 5 => COMMACATEGORY | 6 => ADV | 7 => P | 8 => DET | 9 => Vi | 10 => T | 11 => PERIODCATEGORY |';
     /**
      * @var Scope_anchor_text $at
      */
     $at = $this->scope_anchor_text->create_anchor_text($text);
     $at_id = $at->get_id();
     $this->unit->run(is_int($at->get_id()), TRUE, '真的有存入資料庫嗎?');
     $this->unit->run($at->get_text(), $text, '測試create()跟get_text()');
     $this->unit->run($at->get_segment(), $seg, '測試get_segment()');
     $this->unit->run($at->get_segment_query(), $query, '測試get_segment()');
     $this->unit->run(test_array($at->get_speechs()), $speech, '測試get_speechs()');
     $at2 = $this->scope_anchor_text->create_anchor_text($text);
     $at2_id = $at2->get_id();
     $this->unit->run($at_id, $at2_id, '測試Create看看是不是同一個ID');
     $at3 = $this->scope_anchor_text->create_anchor_text($text2);
     $at3_id = $at3->get_id();
     $this->unit->run_false($at_id, $at3_id, '測試Create不同$text,看看是不是同一個ID');
     $at3->set_field('text', $text3);
     $at3->update();
     $this->unit->run($at3->get_text(), $text3_fixed, '測試$at3 update()之後索引是否有更新?而且多餘的空行也有清除掉?');
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     unit_test_report($this);
 }
Esempio n. 3
0
 function index()
 {
     $url = 'http://www.plurk.com/p/6e8ya0#response-1797906026';
     $annotation = new Annotation(1017);
     $this->tip_speech->set_webpage($url);
     $this->tip_speech->set_annotation($annotation);
     $this->unit->run($this->tip_speech->match(), TRUE, 'tip_speech match()');
     $this->unit->run($this->tip_speech->get_tip_text(), 'is_string', 'tip_speech get_tip_text()');
     $this->tip_length->set_webpage($url);
     $this->tip_length->set_annotation($annotation);
     $this->unit->run($this->tip_length->match(), TRUE, 'tip_length match()');
     $this->unit->run($this->tip_length->get_tip_text(), 'is_string', 'tip_length get_tip_text()');
     $this->tip_location->set_webpage($url);
     $this->tip_location->set_annotation($annotation);
     $this->unit->run($this->tip_location->match(), TRUE, 'tip_location match()');
     $this->unit->run($this->tip_location->get_tip_text(), 'is_string', 'tip_location get_tip_text()');
     //-----------------------------------------
     $tip_coll = new Tip_collection();
     $tip_coll->set_webpage($url);
     $tip_coll->set_annotation($annotation);
     $matched = $tip_coll->has_matched();
     $this->unit->run($matched, TRUE, 'tip_collection has_matched()');
     $tip_texts = $tip_coll->get_tip_text_array();
     $this->unit->run(count($tip_texts), 3, 'tip_collection get_tip_text_array() count()');
     foreach ($tip_texts as $key => $text) {
         $this->unit->run($text, 'is_string', 'tip_collection get_tip_text_array() foreach' . $key . ' is_string');
     }
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     //context_complete();
     unit_test_report($this, __METHOD__);
 }
Esempio n. 4
0
 function index()
 {
     $url = $this->url;
     $webpage = $this->webpage->create($url);
     $tutor = $webpage->get_tutor();
     $annotation = new Annotation(1017);
     $user = $annotation->get_user();
     $unread_count = $user->get_unread_notification_count();
     $this->unit->run($unread_count, 'is_int', '先看一下user的未讀通知有幾封');
     $tutor->setup_recommend($annotation);
     $recommend = $annotation->get_recommend();
     $this->unit->run($recommend->get_id(), 'is_int', '有取得建議');
     $recommend_annotation = $recommend->get_recommend_by();
     $this->unit->run($recommend_annotation, NULL, '沒有推薦標註');
     $tips = $recommend->get_tips_text_array();
     $this->unit->run_false(count($tips), 0, '有建議');
     //------------------------------------------------
     $recommend_annotation = new Annotation(783);
     $recommend_annotation->set_score(0, 3);
     $recommend_annotation->update();
     $scope = new Annotation_scope(129);
     $recommend_scope = new Annotation_scope_collection();
     $recommend_scope->add_scope($scope);
     $annotation->set_recommend_scopes($recommend_scope);
     $tutor->setup_recommend($annotation);
     $recommend->reload();
     $recommend_annotation = $recommend->get_recommend_by();
     $this->unit->run($recommend_annotation->get_id(), 783, '有找到推薦標註');
     $this->unit->run($user->get_unread_notification_count(TRUE), $unread_count + 2, '因為新增了兩次推薦,所以應該有兩封通知?');
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     //context_complete();
     unit_test_report($this, __METHOD__);
 }
Esempio n. 5
0
 function index()
 {
     $clustering = Clustering::get_clustering();
     $data = array(1, 3, 2, 5, 6, 2, 3, 1, 30, 36, 45, 3, 15, 17);
     $number = 3;
     $clustering->setup($data, $number);
     $result = $clustering->get_result();
     $positions = $clustering->get_result_positions();
     $this->unit->run(count($result), 3, '資料應該分成了3群');
     $this->unit->run(count($positions), 3, '中心點應該也有3個');
     $this->unit->run_false($result[0], array(), '第一群不是空陣列');
     $this->unit->run_false($result[1], array(), '第二群不是空陣列');
     $this->unit->run_false($result[2], array(), '第三群不是空陣列');
     $this->unit->run_false($positions, array(), '中心點不是空陣列');
     //-------------------------
     $clustering = Clustering::get_clustering();
     $data = array(1, 1, 1, 1, 1, 2, 20, 20, 20, 20);
     $number = 3;
     $clustering->setup($data, $number);
     $result = $clustering->get_result();
     $positions = $clustering->get_result_positions();
     $this->unit->run(count($result), 3, '資料應該分成了3群');
     $this->unit->run(count($positions), 3, '中心點應該也有3個');
     $this->unit->run_false($result[0], array(), '第一群不是空陣列');
     //
     $this->unit->run($result[1], array(), '第二群不是空陣列(這一個測試會故意錯誤,但這是因為k-means對偏離值影響很大。但KALS並不是要做很正確的分群,只是要個大概的中心點位置,所以重點在於下面的positions能有就好。)');
     $this->unit->run_false($result[2], array(), '第三群不是空陣列');
     $this->unit->run_false($positions, array(), '中心點不是空陣列');
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     //context_complete();
     unit_test_report($this, __METHOD__);
 }
Esempio n. 6
0
 function check_user()
 {
     $user = get_context_user();
     $this->unit->run(get_class($user), 'User', '登入之後測試get_context_user()');
     $this->unit->run($user->get_id(), 'is_int', '登入之後測試get_context_user()的id');
     $this->unit->run($user->get_email(), $this->email, '登入之後測試get_context_user()的email');
     unit_test_report($this);
 }
Esempio n. 7
0
 function index()
 {
     $segmentor_name1 = 'segmentor.scws';
     $segmentor_name2 = 'segmentor.ckip';
     $segmentor_name3 = 'segmentor.yahoo';
     $text = '今天今天繼續做昨天未完成的投影片。然後接續D11進度把Authorize Manager跟Context加入Domain跟Webpage中。';
     $test_eng = 'Since learning English is very popular in non-English speaking countries, developing modern assisted-learning tools that support effective English learning is a critical issue in the English-language education field.';
     $ex = '';
     //$ex = '';
     $text_scws1 = '今天 今天 繼續 做 昨天 未 完成 投影片 然後 接續 D11 進度 Authorize Manager 跟 Context 加入 Domain 跟 Webpage 中';
     $text_scws2 = '今天/n 今天/n 繼續/vn 做/v 昨天/n 未/d 完成/un 投影片/n 然後/d 接續/v D11/en 進度/n Authorize/en Manager/en 跟/v Context/en 加入/un Domain/en 跟/v Webpage/en 中/f';
     $text_ckip1 = '今天 今天 繼續 做 昨天 未 完成 的 投影片 。 然後 接續 D 11 進度 把 Authorize Manager 跟 Context 加入 Domain 跟 Webpage 中 。';
     $text_ckip2 = '今天/N 今天/N 繼續/Vt 做/Vt 昨天/N 未/ADV 完成/Vt 的/T 投影片/N 。/PERIODCATEGORY 然後/ADV 接續/Vt D/FW 11/DET 進度/N 把/P Authorize/FW Manager/FW 跟/P Context/FW 加入/Vt Domain/FW 跟/P Webpage/FW 中/N 。/PERIODCATEGORY';
     /*
             $segmentor = Segmentor_factory::create($segmentor_name1);
     
             $this->unit->run($segmentor->get_name()
                     , $segmentor_name1
                     , '測試Segmentor的get_name()');
     
             $this->unit->run($segmentor->ignore_stopword
                     , FALSE
                     , '測試Segmentor的ignore_stopword');
     
             $segmentor->set_ignore_stopword(TRUE);
             $this->unit->run($segmentor->ignore_stopword
                     , TRUE
                     , '測試Segmentor的set_ignore_stopword()');
     
             $this->unit->run($segmentor->text_to_segment($text, FALSE)
                     , $text_scws1.$ex
                     , '測試SCWS斷詞器');
     
             $this->unit->run($segmentor->text_to_segment($text, TRUE)
                     , $text_scws2.$ex
                     , '測試SCWS斷詞器,包含詞性');
     
             
             $segmentor = Segmentor_factory::create($segmentor_name2);
             $this->unit->run($segmentor->text_to_segment($text, FALSE)
                     , $text_ckip1.$ex
                     , '測試CKIP斷詞器');
     
             $this->unit->run($segmentor->text_to_segment($text, TRUE)
                     , $text_ckip2.$ex
                     , '測試CKIP斷詞器,包含詞性');
     */
     $segmentor = Segmentor_factory::create($segmentor_name3);
     $this->unit->run($segmentor->text_to_segment($text, FALSE), $text_ckip1 . $ex, '測試CKIP斷詞器');
     $this->unit->run($segmentor->text_to_segment($text, TRUE), $text_ckip2 . $ex, '測試CKIP斷詞器,包含詞性');
     $segmentor = Segmentor_factory::create('segmentor.disable');
     $this->unit->run($segmentor->text_to_segment($text, FALSE), NULL, '測試disable斷詞器');
     $this->unit->run($segmentor->text_to_segment($text, TRUE), NULL, '測試disable斷詞器,包含詞性');
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     unit_test_report($this);
 }
Esempio n. 8
0
 function delete()
 {
     $url = $this->url;
     $title = $this->title;
     $webpage = $this->webpage->find('url', $url);
     $webpages = $this->webpage->find_all();
     $count_webpages = count($webpages);
     $this->unit->run($count_webpages, 'is_int', '刪除webpage之前,剩下的個數');
     $webpage->delete();
     $this->unit->run($webpage->get_id(), NULL, '刪除webpage之後,ID是否還在?');
     $webpage2 = $this->webpage->find('url', $url);
     $this->unit->run(is_object($webpage2), FALSE, '刪除webpage之後,是否還能找得到?');
     $webpages = $this->webpage->find_all();
     $this->unit->run(count($webpages), $count_webpages - 1, '刪除webpage之後,剩下的個數');
     unit_test_report($this);
 }
Esempio n. 9
0
 function index()
 {
     //        $url = 'http://www.lib.nccu.edu.tw/?m=1109&sn=54&id=92&mm=1101';
     //        $host = 'http://www.lib.nccu.edu.tw/';
     //        $title = '政治大學圖書館網站';
     $url = 'http://pulipuli.blogspot.com/2010/07/2010711.html';
     $host = 'http://pulipuli.blogspot.com/';
     $title = '布丁布丁吃?';
     //以下才是正是的測試開始
     create_context(TRUE);
     $this->load->library('kals_resource/Domain');
     $domain2 = new Domain();
     $domain2->set_field('url', $url);
     $domain2->update();
     $this->unit->run($domain2->get_field("url"), $host, '以new建立domain2,測試get_field("url")');
     $domain = $this->domain->create($url);
     $domain_id = $domain->get_id();
     $this->unit->run($domain_id, 'is_int', '用ctreate()來建立Domain,看看是否有id');
     $test_domain = $this->domain->create($url);
     $test_domain_id = $test_domain->get_id();
     //echo $test_domain_id;
     $this->unit->run($test_domain->get_field("url"), $host, '測試get_host');
     $this->unit->run($domain_id != NULL, TRUE, '測試test_domain是不是真的find到domain');
     $this->unit->run($domain_id, $test_domain_id, '測試test_domain是不是真的find到domain');
     $this->unit->run($test_domain->get_id(), $domain_id, '用ctreate()以同樣的url來建立Domain,看看是否有id');
     $this->unit->run($test_domain->get_field('title'), $title, '再建立時,是否就能找到title?');
     $id = $test_domain->get_id();
     $test_domain = new Domain($id);
     $this->unit->run($test_domain->get_id() != NULL, TRUE, '測試用id來find Domain');
     $this->unit->run($test_domain->get_field('url'), $host, '測試用id來find Domain 測試get_host');
     $this->unit->run($test_domain->get_field('title'), $title, '測試title');
     $domains = $this->domain->find_all();
     $this->unit->run(count($domains) > 0, TRUE, '測試find_all是否有找到東西');
     $domains = $this->domain->find_all(array('domain_id' => $id));
     $this->unit->run(count($domains), 1, '測試find_all加上條件,是否能找到測試時建立的domain');
     $this->unit->run($domains[0]->get_id(), $id, '測試find_all中能不能get_id()');
     $this->unit->run($domains[0]->get_host(), $host, '測試find_all中能不能get_host()');
     $test_domain->delete();
     $this->unit->run($test_domain->get_id(), NULL, '測試刪除之後,Domain ID還在不在這件事情');
     $domain_deleted = $this->domain->find($url);
     $this->unit->run($domain_deleted, NULL, '測試刪除之後,Domain還能不能找到這件事情');
     //context_complete();
     //context_abort();
     unit_test_report($this);
     //destory_context();
 }
Esempio n. 10
0
 function index()
 {
     //U* = (0.19*1 + 0.6*2 + 0.21*3) / (0.19 + 0.6 + 0.21)
     //   = 2.02 / 1
     //   = 1
     $coll = $this->coll;
     $this->unit->run($coll->length(), 3, '先看看有沒有三個變數');
     $this->unit->run($coll->get_membership(1), 0, '取得type_id=1的membership,沒設定之前預設為0');
     $coll->set_memberships(array(0.19, 0.6, 0.21));
     //$coll->set_membership(0, 0.19);
     $this->unit->run($coll->get_membership(0), 0.19, '設定type_id=1的membership並測試');
     //$coll->set_membership(1, 0.6);
     //$coll->set_membership(2, 0.21);
     $this->unit->run($coll->get_defuzzy_code(), 2.02, '測試重心法輸出fuzzy_code');
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     //context_complete();
     unit_test_report($this);
 }
Esempio n. 11
0
 function index()
 {
     $name = 'annotation.type.confusion';
     $type_id = 3;
     $type = $this->factory->create($name);
     $this->unit->run($type->get_name(), $name, '以$name create(),測試get_name()');
     $this->unit->run($type->get_type_id(), $type_id, '以$name create(),測試get_type_id()');
     $name = 'annotation.type.custom';
     $type_id = 7;
     $type = $this->factory->create($type_id);
     $this->unit->run($type->get_name(), $name, '以$type_id create(),測試get_name()');
     $this->unit->run($type->get_type_id(), $type_id, '以$type_id create(),測試get_type_id()');
     $types = $this->factory->get_total_types();
     $this->unit->run(count($types), 7, '測試get_total_types');
     $this->unit->run($types[1]->get_name(), 'annotation.type.importance', '測試get_total_types後的get_name()');
     $this->unit->run($types[2]->get_name(), 'annotation.type.question', '測試get_total_types後的get_name()');
     $this->unit->run($types[6]->get_type_id(), 6, '測試get_total_types後的get_type_id()');
     $this->unit->run($types[3]->get_type_id(), 3, '測試get_total_types後的$types[3] get_type_id()');
     $this->unit->run($types[5]->get_type_id(), 5, '測試get_total_types後的get_type_id()');
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     unit_test_report($this);
 }
Esempio n. 12
0
 function index()
 {
     $url = 'http://www.plurk.com/p/666n0u#response-1725369556';
     $from_index = 2;
     $to_index = 18;
     $from_index2 = 3;
     $to_index2 = 19;
     $text = '[CODING D15] 嗯,今天乖乖地集中在一串。';
     $seg = '[/PARENTHESISCATEGORY CODING/FW D/FW 15/DET ]/PARENTHESISCATEGORY 嗯/T ,/COMMACATEGORY 今天/N 乖乖/Vi 地/T 集中/Vt 在/P 一/DET 串/M 。/PERIODCATEGORY';
     $scope = $this->annotation_scope->create_scope($from_index, $to_index, $text, $url);
     $scope_id = $scope->get_id();
     $this->unit->run($scope_id, 'is_int', '測試create_scope()是否有正確地建立');
     $index = $scope->get_index();
     $this->unit->run($index['from'], $from_index, '測試get_index()的from');
     $this->unit->run($index['to'], $to_index, '測試get_index()的to');
     $at = $scope->get_anchor_text();
     $at_id = $at->get_id();
     $this->unit->run(is_int($at_id), TRUE, '測試get_anchor_text()是否有正確地建立');
     $this->unit->run($at->get_text(), $text, '測試get_anchor_text()的text是否正確');
     $this->unit->run($at->get_segment(), $seg, '測試get_anchor_text()的segment是否正確');
     $scope2 = $this->annotation_scope->create_scope($from_index, $to_index, $text, $url);
     $this->unit->run($scope2->get_id(), $scope_id, '測試create_scope() 同樣資料是否能建立相同的ID');
     $scope3 = $this->annotation_scope->create_scope($to_index, $from_index, $text, $url);
     $this->unit->run($scope3->get_id(), $scope_id, '測試create_scope() index相反是否能建立相同的ID');
     $index = $scope3->get_index();
     $this->unit->run($index['from'], $from_index, '測試scope3 get_index()的from');
     $scope4 = $this->annotation_scope->create_scope($to_index2, $from_index2, $text, $url);
     $this->unit->run_false($scope4->get_id(), $scope_id, 'scope4 測試create_scope() index不同且相反是否能建立不相同的ID');
     $index = $scope4->get_index();
     $this->unit->run($index['from'], $from_index2, '測試scope4 get_index()的from');
     $this->unit->run($index['to'], $to_index2, '測試scope4 get_index()的to');
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     unit_test_report($this);
 }
Esempio n. 13
0
 function index()
 {
     create_context(TRUE);
     $del_user = array();
     //建立$group1
     $group1 = $this->group->create_group($this->url, $this->group_name1);
     //[R]$group1->get_name()
     $this->unit->run($group1->get_name(), $this->group_name1, '建立$group1 [R]$group1->get_name()');
     //$group1find = find by name
     $group1finds = $this->group->find_groups($this->url, $this->group_name1);
     $group1find = $group1finds[0];
     //$group1find->get_domain()
     $domain1 = $group1find->get_domain();
     //[R]取得domain的host
     $this->unit->run($domain1->get_host(), $this->host, '$group1find = find by name get_domain() [R]取得domain的host');
     //建立$user1
     //把$user1加入$group1中
     $user1 = $this->user->create_user($this->url, $this->user_name1);
     $group1->add_actor($user1);
     //$group1->get_users()
     $users = $group1->get_users();
     //[R]測試get_users()數量是否為1
     $this->unit->run(count($users), 1, '把$user1加入$group1中 $group1->get_users() [R]測試get_users()數量是否為1');
     //記得$group1_id
     //$group1find = find by id
     $group1_id = $group1->get_id();
     //$group1find = $this->group->find('id', $group1_id);
     $group1find = new Group($group1_id);
     //$group1find->get_users()
     //[R]測試users[0]的名字是否符合
     $users = $group1find->get_users();
     $this->unit->run($users[0]->get_email(), $this->user_name1, '$group1find = find by id | $group1find->get_users() | [R]測試users[0]的名字是否符合' . $users[0]->get_id());
     //從$group1中移除$user1
     //[R]$group1看看是否數量為0
     $group1->remove_actor($users[0]);
     $users = $group1->get_users();
     $this->unit->run(count($users), 0, '從$group1中移除$user1 | [R]$group1看看是否數量為0');
     //$group1find = find by id
     //[R] 看看get_users數量是否為0
     //$group1find = $this->group->find(array('group_id'=> $group1_id));
     $group1find = new Group($group1_id);
     $users = $group1find->get_users();
     $this->unit->run(count($users), 0, '$group1find = find by id | [R] 看看get_users數量是否為0');
     //建立$group2
     //把$group2加入$group1中
     $group2 = $this->group->create_group($this->url, $this->group_name2);
     $group1->add_actor($group2);
     //從$group1中get_group
     //[R]檢查groups[0]是否跟$group2->equals()
     $groups = $group1->get_groups();
     $this->unit->run($group2->equals($groups[0]), TRUE, '從$group1中get_group | [R]檢查groups[0]是否跟$group2->equals()');
     //建立$user2
     //把$user2加入$group2中
     //取得$user2->get_parent_groups()
     //[R] 檢查數量是否有2個
     $user2 = $this->user->create_user($this->url, $this->user_name2);
     $group2->add_actor($user2);
     $groups = $user2->get_parent_groups();
     $this->unit->run(count($groups), 2, '建立$user2 | 把$user2加入$group2中 | 取得$user2->get_parent_groups() | [R] 檢查數量是否有2個');
     //[R] 檢查第一個是否equals $group1
     $this->unit->run($groups[0]->equals($group2), TRUE, '[R] 檢查第一個是否equals $group2');
     //[R] 檢查第二個是否跟$group2的名稱一樣
     $this->unit->run($group1->equals($groups[1]), TRUE, '[R] 檢查第二個是否跟$group1的名稱一樣');
     //刪除$group1
     $group1->delete();
     //取得$user2的get_parent_groups
     //[R] 數量是否為1
     $groups = $user2->get_parent_groups();
     $this->unit->run(count($groups), 1, '取得$user2的get_parent_groups | [R] 數量是否為1');
     //[R] 是否equals $group2
     $this->unit->run($groups[0]->equals($group2), TRUE, '[R] 是否equals $group2');
     //刪除$group2
     $group2->delete();
     //[R] 確認$group2的名稱消失
     $this->unit->run($group2->get_name(), NULL, '刪除$group2 | [R] 確認$group2的名稱消失');
     //用id去找尋$group1
     //[R] 確認找不到
     //$group1find = $this->group->find('group_id', $group1_id);
     $group1find = new Group($group1_id);
     $this->unit->run($group1find->get_name(), NULL, '用id去找尋$group1 | [R] 確認get_name取不到名字');
     //刪除$user1 $user2
     //用資料庫刪除
     //        $user1_id = $user1->get_id();
     //        $user2_id = $user2->get_id();
     //        $user1->delete();
     //        $user2->delete();
     //        $this->db->delete('domain2user', array('user_id'=>$user1_id));
     //        $this->db->delete('domain2user', array('user_id'=>$user2_id));
     //        $this->db->delete('user', array('user_id'=>$user1_id));
     //        $this->db->delete('user', array('user_id'=>$user2_id));
     //        $this->unit->run($test_result,
     //                $expected_result,
     //                $test_name);
     unit_test_report($this);
 }
Esempio n. 14
0
 public function not_accept()
 {
     $url = 'http://www.plurk.com/p/6esun8#response-1799208331';
     $annotation = $this->annotation->find('annotation_id', 1017);
     $annotation = new Annotation(1017);
     $original_annotation_id = $annotation->get_id();
     $recommend = new Annotation_recommend();
     $recommend->set_webpage($url);
     $recommend->set_recommended($annotation);
     $recommend->update();
     $annotation = new Annotation(1017);
     $recommend = $annotation->get_recommend();
     //-----------------------------------------------
     $length = $annotation->get_scope_length();
     $recommend = $annotation->get_recommend();
     $annotation = $recommend->set_accept(FALSE);
     $length = $annotation->get_scope_length();
     $this->unit->run($annotation->get_scope_length(), $length, '拒絕推薦之後,由於並沒有改變標註,所以長度還是一樣');
     $this->unit->run($annotation->get_id(), $original_annotation_id, '拒絕推薦之後,這個標註應該跟上面的一樣');
     $recommend = $annotation->get_recommend();
     $this->unit->run($recommend, NULL, '拒絕推薦之後,標註就沒有推薦了');
     $annotation = $this->annotation->find('annotation_id', 1017);
     $this->unit->run($annotation->get_id(), 'is_int', '拒絕推薦之後,原本的標註仍在');
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     //context_complete();
     unit_test_report($this, __METHOD__);
 }
Esempio n. 15
0
 function index()
 {
     $annotation = $this->create_annotation();
     $this->association_user = $annotation->get_user();
     $email2 = '*****@*****.**';
     $this->trigger_user = $this->user->create_user($this->url, $email2);
     //以上是準備!
     //--------------------------------------
     //以下正式開始!
     $this->unit->run($this->association_user->get_unread_notification_count(), 0, 'association_user 有沒有未讀的,應該沒有');
     $this->unit->run($this->liked->get_template(), NULL, 'liked什麼都沒set 然後 get_template()');
     $this->unit->run($this->liked->get_id(), NULL, '看看liked的id,未存入之前應該沒有東西才是');
     //$this->liked->set_trigger_resource($annotation);
     //$this->liked->set_trigger_actor($this->trigger_user);
     $this->liked = $this->liked->create_notification($annotation->get_user(), $annotation, $this->trigger_user);
     $this->unit->run($this->liked->get_template(), 'is_string', 'set liked 然後 get_template()');
     //$this->liked->update();
     $this->unit->run($this->liked->get_id(), 'is_int', 'update liked,有存入嗎?');
     $this->unit->run($this->liked->get_template(), 'is_string', 'update liked 然後 get_template()');
     $this->unit->run($this->association_user->get_unread_notification_count(), 1, '再association_user 有沒有未讀的,應該有1個');
     //--------------------------------------------
     $this->unit->run($this->responded->get_template(), NULL, 'responded什麼都沒set 然後 get_template()');
     //$this->responded->set_trigger_resource($annotation);
     //$this->responded->set_trigger_actor($this->trigger_user);
     $this->responded = $this->responded->create_notification($annotation->get_user(), $annotation, $this->trigger_user);
     $this->unit->run($this->responded->get_template(), 'is_string', 'set responded 然後 get_template()');
     //$this->responded->update();
     $this->unit->run($this->responded->get_id(), 'is_int', 'update responded,有存入嗎?');
     $this->unit->run($this->association_user->get_unread_notification_count(), 2, '再association_user 有沒有未讀的,應該有2個');
     //--------------------------------------------------------------
     $this->unit->run($this->recommended->get_template(), NULL, 'recommend什麼都沒set 然後 get_template()');
     //$this->recommended->set_trigger_resource($annotation);
     //$this->recommended->set_trigger_actor($this->trigger_user);
     $this->recommended = $this->recommended->create_notification($annotation->get_user(), $annotation, $this->trigger_user);
     $this->unit->run($this->recommended->get_template(), 'is_string', 'set recommended 然後 get_template()');
     //$this->recommended->update();
     $this->unit->run($this->recommended->get_id(), 'is_int', 'update recommended,有存入嗎?');
     $this->unit->run_false($this->recommended->get_id(), $this->liked->get_id(), 'recommend跟liked的id應該不同');
     $count = $this->db->count_all_results('notification');
     $this->unit->run($count, 'is_int', '資料表notification裡面應該有資料');
     $this->unit->run($count >= 3, TRUE, '資料表notification裡面資料應該>=3');
     $this->unit->run($this->association_user->get_unread_notification_count(), 3, '再association_user 有沒有未讀的,應該有3個');
     //---------------------------------------------------------------
     //$another_liked = new Notification_liked();
     //$another_liked->set_trigger_resource($annotation);
     //$another_liked->set_trigger_actor($this->trigger_user);
     //$another_liked->update();
     $another_liked = $this->liked->create_notification($annotation->get_user(), $annotation, $this->trigger_user);
     $this->unit->run($another_liked->get_id(), $this->liked->get_id(), '同樣資料下的notification,ID應該會相同');
     $this->unit->run($this->association_user->get_unread_notification_count(), 3, '再association_user 有沒有未讀的,應該依然是3個');
     //----------------------------------------------
     //接下來檢查notification
     $unread_coll = $this->association_user->get_unread_notification_coll();
     $id_list = array($this->liked->get_id(), $this->recommended->get_id(), $this->responded->get_id());
     foreach ($unread_coll as $unread) {
         $this->unit->run(in_array($unread->get_id(), $id_list), TRUE, '用foreach檢查每一個unread (' . $unread->get_id() . '),應該都符合剛剛建立的那幾個');
     }
     $this->association_user->set_notification_read($id_list[0]);
     $this->unit->run($this->association_user->get_unread_notification_count(), 2, '設定讀過1個之後,再association_user 有沒有未讀的,應該有2個');
     $this->association_user->set_notification_read($id_list[1]);
     $this->unit->run($this->association_user->get_unread_notification_count(), 1, '設定讀過2個之後,再association_user 有沒有未讀的,應該有1個');
     $unread_coll = $this->association_user->get_unread_notification_coll(NULL, NULL, TRUE);
     $this->unit->run($unread_coll->length(), 1, '取得unread_coll,看一下length,應該只剩下1個');
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     //context_complete();
     unit_test_report($this);
 }
Esempio n. 16
0
 function index()
 {
     create_context();
     //初始設定開始!
     //先建立$webpage
     //建立$user1
     //建立$group1
     $webpage = $this->webpage->create($this->url);
     $user = $this->user->create_user($this->url, $this->user_email);
     $group1 = $this->group->create_group($this->url, $this->group1_name);
     $group2 = $this->group->create_group($this->url, $this->group2_name);
     $group1->add_actor($user);
     $auth = $this->authorize_manager;
     $auth->set_resource($webpage);
     $auth->set_actor($group1);
     $auth->set_throw_exception(FALSE);
     //初始設定結束!
     //-------------------------------------------------------
     //Round 1 測試尚未設定Policy之前
     //        test_msg('Round 1 測試尚未設定Policy之前');
     $this->unit->run($auth->has_policy($this->action_webpage_admin), FALSE, '測試尚未設定Policy之前,$webpage是否有設定過$action_webpage_adming的權限');
     $this->unit->run($auth->allow($this->action_webpage_admin), FALSE, '測試尚未設定Policy之前,任意人士是否允許管理Webpage');
     $this->unit->run($auth->has_policy($this->action_webpage_admin), FALSE, '測試尚未設定Policy之前,$webpage是否有設定過action_webpage_read的權限?');
     $this->unit->run($auth->allow($this->action_webpage_read), TRUE, '測試尚未設定Policy之前,任意人士是否允許讀取');
     $this->unit->run($auth->has_policy($this->action_webpage_admin), FALSE, '測試尚未設定Policy之前,$webpage是否有設定過action_domain_admin的權限?');
     $this->unit->run($auth->allow($this->action_domain_admin), FALSE, '測試尚未設定Policy之前,輸入適用對象錯誤的Action看看');
     //--------------------------------------------------------
     //Round 2 設定Policy之後
     //        test_msg('Round 2 設定Policy之後');
     $auth->policy_add_actor($this->action_webpage_admin);
     $this->unit->run($auth->has_policy($this->action_webpage_admin), TRUE, '設定Policy之後,$webpage是否有設定過$action_webpage_adming的權限');
     $this->unit->run($auth->allow($this->action_webpage_admin), TRUE, '設定Policy之後,$group1是否允許管理Webpage');
     //------------------------------------------------------------
     //Round 3 設定不相干人士看看
     //        test_msg('Round 3 設定不相干人士看看');
     $auth->set_actor($group2);
     $this->unit->run($auth->has_policy($this->action_webpage_admin), TRUE, '設定不相干人士看看,$webpage是否有設定過action_webpage_admin的權限?');
     $this->unit->run($auth->allow($this->action_webpage_admin), FALSE, '設定不相干人士看看,$group2是否允許管理Webpage');
     //------------------------------------------------------------
     //Round 4 設定子成員看看
     //        test_msg('Round 4 設定子成員看看');
     $auth->set_actor($user);
     $this->unit->run($auth->has_policy($this->action_webpage_admin), TRUE, '設定子成員看看,$webpage是否有設定過action_webpage_admin的權限?');
     $this->unit->run($auth->allow($this->action_webpage_admin), TRUE, '設定子成員看看,$user是否允許管理Webpage');
     //------------------------------------------------------------
     //Round 5 加入$group2看看
     //        test_msg('Round 5 加入$group2看看');
     $auth->policy_add_actor($this->action_webpage_admin, $group2);
     $this->unit->run($auth->has_policy($this->action_webpage_admin), TRUE, '加入$group2看看,$webpage是否有設定過action_webpage_admin的權限?');
     $this->unit->run($auth->allow($this->action_webpage_admin), TRUE, '加入$group2看看,$group2是否允許管理Webpage');
     //------------------------------------------------------------
     //Round 6 測試policy
     //        test_msg('Round 6 測試policy');
     $policy = $auth->get_policy($this->action_webpage_admin);
     $actors = $policy->get_actors();
     $this->unit->run(count($actors), 2, '測試policy的get_actors()數量,應該是有$group1跟$group2');
     $passed = FALSE;
     foreach ($actors as $a) {
         if ($a->equals($group1)) {
             $passed = TRUE;
             break;
         }
     }
     $this->unit->run($passed, TRUE, '測試policy的get_actors(),用foreach $actors[0]->equals($group1)看看');
     $passed = FALSE;
     foreach ($actors as $a) {
         if ($a->equals($group2)) {
             $passed = TRUE;
             break;
         }
     }
     $this->unit->run($passed, TRUE, '測試policy的get_actors(),用$actors[0]->equals($group2)看看');
     $passed = FALSE;
     foreach ($actors as $a) {
         if ($a->equals($user)) {
             $passed = TRUE;
             break;
         }
     }
     $this->unit->run($passed, FALSE, '測試policy的get_actors(),應該是沒有$user');
     //----------------------------------------------------------
     //Round 7 測試get_polices()
     //        test_msg('Round 7 測試get_polices()');
     $auth->policy_add_actor($this->action_webpage_read, $user);
     $polices = $auth->get_policies();
     $this->unit->run(count($polices), 2, '測試get_polices(),應該有兩個policy');
     $policy_id = $policy->get_id();
     $polices_ids = array();
     foreach ($polices as $p) {
         $polices_ids[] = $p->get_id();
     }
     $this->unit->run(in_array($policy_id, $polices_ids), TRUE, '測試get_polices(),應該包含了policy的ID在裡面');
     //----------------------------------------------------------
     //Round 8 測試is_admin
     //        test_msg('Round 8 測試is_admin');
     $this->unit->run($auth->is_admin($user), TRUE, '測試is_admin,$user可以管理$webpage嗎?');
     $this->unit->run($auth->is_admin($group1), TRUE, '測試is_admin,$group1可以管理$webpage嗎?');
     $auth->policy_remove_actor($this->action_webpage_admin, $group2);
     $this->unit->run($auth->is_admin($group2), FALSE, '測試is_admin,$group2可以管理$webpage嗎?');
     //----------------------------------------------------------
     //Round 9 測試remove_entrie_policy()
     //        test_msg('Round 9 測試remove_entrie_policy()');
     $count = count($auth->get_actors($this->action_webpage_read));
     $auth->policy_remove_actor($this->action_webpage_read, $group2);
     $this->unit->run($auth->has_policy($this->action_webpage_read), TRUE, '測試remove_entrie_policy(),移除不相干的人看看會怎樣');
     $this->unit->run(count($auth->get_actors($this->action_webpage_read)), $count, '測試remove_entrie_policy(),移除不相干的人之後,count應該還是一樣吧?');
     $auth->policy_remove_actor($this->action_webpage_read, $user);
     $this->unit->run($auth->has_policy($this->action_webpage_read), FALSE, '測試remove_entrie_policy(),移除相干的人看看會怎樣');
     $polices = $auth->get_policies();
     $this->unit->run(count($polices), 1, '測試remove_entrie_policy(),應該只剩下1個');
     $this->unit->run($polices[0]->get_id(), $policy_id, '測試remove_entrie_policy(),應該只剩下action_webpage_admin了');
     //----------------------------------------------------------
     //Round 10 remove_entrie_policy()不指定actor
     //        test_msg('Round 10 remove_entrie_policy()不指定actor');
     $auth->remove_entrie_policy($this->action_webpage_admin);
     $this->unit->run($auth->has_policy($this->action_webpage_admin), FALSE, 'remove_entrie_policy()不指定actor');
     $polices = $auth->get_policies();
     $this->unit->run(count($polices), 0, 'remove_entrie_policy()不指定actor,應該只剩下0個');
     //        //最後要回收不用到的物件
     //        $webpage->delete();
     //        $group->delete();
     //
     //        $user_id = $user->get_id();
     //        $user->delete();
     //        $this->db->delete(array('domain2user', 'user'), array('user_id' => $user_id));
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     unit_test_report($this);
 }
Esempio n. 17
0
 public function stat()
 {
     // 1. 載入library
     // 2. Mock
     $this->load->library('kals_actor/User_statistic');
     $this->load->library('kals_resource/Webpage');
     // Test.1 Url -> Webpage
     // Webpage->filter_webpage_object
     $user = new User(2002);
     $webpage = new Webpage(1575);
     // Test.2 Type(Int String) -> Annotation_type
     // new Annotation_type($type)
     $user1 = $this->user->create_user($this->url, $this->user_email);
     //檢查user1的name
     $this->unit->run($user1->get_name(), 'puddingchen.35', '檢查user1的name');
     //----------------------------------------------
     //檢查get_topic_types_count
     /* $this->unit->run($this->user_statistic->get_respond_to_other_types_count($user, $webpage),
        2,
        '檢查自己使用importance回應別人的標註數量');*/
     // ----------------------------------------------
     unit_test_report($this, __METHOD__);
 }
Esempio n. 18
0
 public function check_auth()
 {
     create_context(TRUE);
     $url = 'http://www.plurk.com/p/6dhwp7';
     $email = '*****@*****.**';
     $group_name = 'check_auth';
     $user = $this->user->create_user($url, $email);
     $group = $this->group->create_group($url, $group_name);
     $group->add_actor($user);
     $annotation = new Annotation(784);
     $this->authorize_manager->set_resource($annotation);
     $this->authorize_manager->policy_add_actor(5, $group);
     clear_context_user();
     $search = new Search_annotation_collection();
     $count = $search->length();
     $this->unit->run($count, 'is_int', '先找看看有沒有,應該是有的');
     set_context_user($user);
     $search = new Search_annotation_collection();
     $this->unit->run($search->length(), $count + 1, '設定權限之後,應該能找到被設定的那一個項目');
     unit_test_report($this);
 }
Esempio n. 19
0
 public function friend()
 {
     //先建立scope
     $url = 'http://www.plurk.com/p/6bk0s3#response-1771001736';
     $this->load->library('scope/Annotation_scope');
     $scope = new Annotation_scope();
     $scope->set_index(48, 19);
     $scope->set_anchor_text('頭髮越來越長了……等系統做完回家再剪。所以頭髮越長就表示系統作越久 >_<');
     $scope->set_webpage($url);
     //$scope->update();
     //建立user_author user1 user2
     $email_author = '*****@*****.**';
     $email1 = '*****@*****.**';
     $email2 = '*****@*****.**';
     $user_author = $this->user->create_user($url, $email_author);
     $user1 = $this->user->create_user($url, $email1);
     $user2 = $this->user->create_user($url, $email2);
     //檢查一下是否大家都有ID
     $this->unit->run(NULL !== $user_author->get_id() && NULL !== $user1->get_id() && NULL !== $user2->get_id(), TRUE, '檢查一下是否大家都有ID');
     $friend_count = $user_author->get_friends(TRUE)->length();
     $this->unit->run($friend_count, 'is_int', '檢查一下user_author的friend數量');
     //建立Annotation
     $this->load->library('kals_resource/Annotation');
     $annotation = $this->annotation->create_annotation($user_author, $scope);
     $this->unit->run($user_author->get_friends(TRUE)->length(), $friend_count, '檢查一下user_author的friend數量,建立annotation之後');
     //加入權限
     $this->load->library('policy/Authorize_manager');
     $this->load->library('policy/Action_annotation_read');
     $action = new Action_annotation_read();
     $this->authorize_manager->set_resource($annotation)->policy_add_actor($action, $user1);
     $this->unit->run($user_author->get_friends(TRUE)->length(), $friend_count + 1, '檢查一下user_author的friend數量,加入$user1');
     $this->authorize_manager->policy_add_actor($action, $user2);
     $this->unit->run($user_author->get_friends(TRUE)->length(), $friend_count + 2, '檢查一下user_author的friend數量,加入user2');
     $this->authorize_manager->policy_remove_actor($action, $user1);
     $this->unit->run($user_author->get_friends(TRUE)->length(), $friend_count + 1, '檢查一下user_author的friend數量,移除user1');
     $match = FALSE;
     foreach ($user_author->get_friends() as $friends) {
         if ($friends->get_id() == $user2->get_id()) {
             $match = TRUE;
             break;
         }
     }
     $this->unit->run($match, TRUE, '檢查一下user_author的friend中,應該只剩下user1');
     unit_test_report($this, __METHOD__);
 }
Esempio n. 20
0
    function webpage()
    {
        $scope1 = $this->scope->create_scope(0, 2);
        $scope2 = $this->scope->create_scope(6, 9);
        $url = 'http://www.plurk.com/p/6cz3zb';
        $text = '雖然感覺上70/182的進度大有嶄進,但是之前寫好的一些仍有問題,要想辦法做測試才行。
';
        $scope_another = $this->scope->create_scope(1, 7, $text, $url);
        $coll = new Annotation_scope_collection();
        $coll->add_scope($scope1);
        $this->unit->run($coll->get_scope_length(), 3, "set_scopes 0~2之後測試get_scope_length()");
        $coll->add_scope($scope2);
        $this->unit->run($coll->get_scope_length(), 7, "set_scopes 6~9之後測試get_scope_length()");
        $coll->add_scope($scope_another);
        $this->unit->run($coll->get_scope_length(), 14, "set_scopes 1~7 another webpage之後測試get_scope_length()");
        $this->unit->run($coll->length(), 3, "set_scopes 1~7 another webpage之後測試length()");
        unit_test_report($this);
    }
Esempio n. 21
0
 public function stat()
 {
     // 1. 載入library
     // 2. Mock
     // Test.1 Url -> Webpage
     // Webpage->filter_webpage_object
     // Test.2 Type(Int String) -> Annotation_type
     // new Annotation_type($type)
     $user1 = $this->user->create_user($this->url, $this->user_email);
     //檢查user1的name
     $this->unit->run($user1->get_name(), 'puddingchen.35', '檢查user1的name');
     // ----------------------------------------------
     unit_test_report($this, __METHOD__);
 }
Esempio n. 22
0
 public function calculator()
 {
     $url = $this->url;
     $this->create_annotation();
     $webpage = $this->webpage->create($url);
     $annotation = $this->annotation;
     $annotation3 = $this->annotation3;
     $this->unit->run($annotation->get_score(0)->get_score(), NULL, '先看看$annotation是否有分數?');
     $this->unit->run($annotation3->get_score(0)->get_score(), NULL, '先看看$annotation3是否有分數?');
     //----------------------------------
     //$this->annotation_score_calculator->set_webpage($url);
     $annotation_score_calculator = $webpage->get_score_calculator();
     //$annotation_score_calculator->set_annotation($annotation);
     //$annotation_score_calculator->set_annotation_scores();
     //
     //        $scores = $annotation_score_calculator->calculate_scores($annotation);
     //        $annotation->set_scores($scores);
     //        $annotation->update();
     $annotation_score_calculator->setup_annotation_scores($annotation);
     $annotation_id = $annotation->get_id();
     //annotation3要重新讀取,才能取得分數
     $annotation3 = new Annotation($annotation3->get_id());
     $this->unit->run($annotation->get_score(0)->get_score(), 'is_float', '看一下是否有存入資料庫?');
     $this->unit->run($annotation3->get_score(0)->get_score(), 'is_float', '看一下共識範圍的是否也一併有了分數?');
     $score_coll = $annotation->get_score_coll();
     $this->unit->run($score_coll->length(), 7, '看一下是否有取得正確7個分數?');
     $scores_array = $score_coll->get_scores_array();
     $annotation_new = new Annotation($annotation_id);
     $this->unit->run($annotation_new->get_score(0)->get_score(), 'is_float', 'find之後,看一下是否有存入資料庫?');
     $score_coll = $annotation_new->get_score_coll();
     $this->unit->run($score_coll->length(), 7, 'find之後,看一下是否有取得正確7個分數?');
     $this->unit->run($score_coll->get_scores_array(), $scores_array, 'find之後,比對一下是否跟儲存之前的分數一樣?');
     unit_test_report($this, __METHOD__);
 }
Esempio n. 23
0
 function json()
 {
     $annotation = new Annotation(1017);
     $user = $annotation->get_user();
     $this->unit->run($user->export_json(), 'is_string', '測試user->export_json()');
     $this->unit->run($annotation->export_json(), 'is_string', '測試annotation->export_json()');
     unit_test_report($this, __METHOD__);
 }
Esempio n. 24
0
 function index()
 {
     $name = "test";
     $type = $this->type->create('name', $name);
     $this->unit->run($type->get_name(), 'test', '有存進去?');
     $this->unit->run(is_int($type->get_id()), true, '有ID?');
     $type2 = $this->type->create('name', $name);
     $this->unit->run($type->get_id(), $type2->get_id(), '相同ID?');
     $type3 = $this->type->create_type("中文可以接受嗎?");
     $this->unit->run(is_int($type3->get_id()), true, '有ID?');
     $this->unit->run($type3->get_name(), "中文可以接受嗎?", "中文可以接受嗎?");
     /*
             $name = 'annotation.type.confusion';
             $type_id = 3;
     
             $type = $this->factory->create($name);
             $this->unit->run($type->get_name()
                     , $name
                     , '以$name create(),測試get_name()');
             $this->unit->run($type->get_type_id()
                     , $type_id
                     , '以$name create(),測試get_type_id()');
     
             $name = 'annotation.type.custom';
             $type_id = 7;
     
             $type = $this->factory->create($type_id);
             $this->unit->run($type->get_name()
                     , $name
                     , '以$type_id create(),測試get_name()');
             $this->unit->run($type->get_type_id()
                     , $type_id
                     , '以$type_id create(),測試get_type_id()');
     
             $types = $this->factory->get_total_types();
             $this->unit->run(count($types)
                     , 7
                     , '測試get_total_types');
             $this->unit->run($types[1]->get_name()
                     , 'annotation.type.importance'
                     , '測試get_total_types後的get_name()');
             $this->unit->run($types[2]->get_name()
                     , 'annotation.type.question'
                     , '測試get_total_types後的get_name()');
             $this->unit->run($types[6]->get_type_id()
                     , 6
                     , '測試get_total_types後的get_type_id()');
             $this->unit->run($types[3]->get_type_id()
                     , 3
                     , '測試get_total_types後的$types[3] get_type_id()');
             $this->unit->run($types[5]->get_type_id()
                     , 5
                     , '測試get_total_types後的get_type_id()');
     
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     
              * */
     unit_test_report($this);
 }