예제 #1
0
파일: test.php 프로젝트: uzura8/flockbird
 public static function setup_timeline($member_id, $body = null)
 {
     if (is_null($body)) {
         $body = 'This is test.';
     }
     return Site_Model::save_timeline($member_id, FBD_PUBLIC_FLAG_ALL, 'normal', null, null, $body);
 }
예제 #2
0
 /**
  * @dataProvider mention_provider
  */
 public function test_comment_mention($member_id_from, $mention_member_ids, $countup_nums_exp, $is_cahced_mention_member_ids_exp, $countup_nums_all_exp)
 {
     if (!is_enabled('notice')) {
         \Util_Develop::output_test_info(__FILE__, __LINE__);
         $this->markTestSkipped('notice module is disabled.');
     }
     // 事前準備
     $notice_count_all_before = \Notice\Model_Notice::get_count();
     // set cache
     $notice_counts_before = array();
     foreach ($mention_member_ids as $mention_member_id) {
         $notice_counts_before[$mention_member_id] = \Notice\Site_Util::get_unread_count($mention_member_id);
     }
     // timeline_comment save
     $body = \Site_Test::get_mention_body($mention_member_ids);
     $timeline = Site_Model::save_timeline($member_id_from, FBD_PUBLIC_FLAG_ALL, 'normal', null, null, $body);
     $timeline_id = $timeline->id;
     // check_cache
     if (self::$is_check_notice_cache) {
         foreach ($mention_member_ids as $mention_member_id) {
             if (in_array($mention_member_id, $is_cahced_mention_member_ids_exp)) {
                 $this->assertFalse(\Notice\Site_Test::check_no_cache4notice_unread($mention_member_id));
             } else {
                 $this->assertTrue(\Notice\Site_Test::check_no_cache4notice_unread($mention_member_id));
             }
         }
     }
     foreach ($mention_member_ids as $mention_member_id) {
         // notice count 取得
         $notice_count = \Notice\Site_Util::get_unread_count($mention_member_id);
         if (self::$is_check_notice_cache) {
             $this->assertFalse(\Notice\Site_Test::check_no_cache4notice_unread($mention_member_id));
         }
         // cache が生成されていることを確認
         // execute test
         $this->assertEquals($notice_counts_before[$mention_member_id] + $countup_nums_exp[$mention_member_id], $notice_count);
         // count up を確認
     }
     // Model_Notice
     // 件数
     $notice_count_all = \Notice\Model_Notice::get_count();
     $this->assertEquals($notice_count_all_before + $countup_nums_all_exp, $notice_count_all);
 }
예제 #3
0
 private static function set_timeline()
 {
     $timeline = Site_Model::save_timeline(self::$member_id, FBD_PUBLIC_FLAG_ALL, 'normal', null, null, 'This is test.');
     self::$timeline_id = $timeline->id;
 }