public static function setUpBeforeClass() { $query = Model_TimelineCache::query(); self::$total_count = $query->count(); $total_list = $query->get(); $total_first_obj = \Util_Array::get_first($total_list); self::$total_first_id = $total_first_obj->id; $total_last_obj = \Util_Array::get_last($total_list); self::$total_last_id = $total_last_obj->id; }
/** * @dataProvider insert_provider */ public function test_insert($public_flag, $timeline_public_flag_expected) { // timeline view cache 作成 if (self::$is_check_timeline_view_cache) { $timeline_view_cache_before = \Timeline\Site_Util::make_view_cache4foreign_table_and_foreign_id('album', $album->id, \Config::get('timeline.types.album_image')); } // insert self::$upload_file_path = self::setup_upload_file(); list($album_image, $file) = Model_AlbumImage::save_with_relations(self::$album->id, self::$member, $public_flag, self::$upload_file_path, 'album_image'); self::$add_count++; // 返り値の確認 $this->assertNotEmpty($album_image); $this->assertNotEmpty($file); // 件数 $this->assertEquals(self::$total_count + 1, \Util_Orm::get_count_all('\\Album\\Model_AlbumImage')); // 公開範囲 $this->assertEquals($public_flag, $album_image->public_flag); // timeline 関連 if (is_enabled('timeline')) { // 件数 $this->assertEquals(self::$timeline_count, \Util_Orm::get_count_all('\\Timeline\\Model_Timeline')); $this->assertEquals(self::$timeline_cache_count, \Util_Orm::get_count_all('\\Timeline\\Model_TimelineCache')); // timelines $timelines = \Timeline\Model_Timeline::get4foreign_table_and_foreign_ids('album', self::$album->id, \Config::get('timeline.types.album_image')); $this->assertCount(1, $timelines); $timeline = array_shift($timelines); // timeline_child_data $timeline_child_datas = \Timeline\Model_TimelineChildData::get4timeline_id($timeline->id); $this->assertCount(self::$add_count, $timeline_child_datas); $timeline_child_data = \Util_Array::get_last($timeline_child_datas); $this->assertEquals('album_image', $timeline_child_data->foreign_table); $this->assertEquals($album_image->id, $timeline_child_data->foreign_id); $this->assertEquals($timeline_public_flag_expected, $timeline->public_flag); $this->assertContains($timeline->sort_datetime, \Util_Date::get_datetime_list($album_image->created_at)); $this->assertTrue(\Util_Date::check_is_future($timeline->sort_datetime, self::$album->created_at)); // timeline view cache check if (self::$is_check_timeline_view_cache) { $this->assertEmpty(\Timeline\Site_Util::get_view_cache($timeline->id)); } } }
<?php $feed_options = array('link' => Uri::create($link_uri), 'caption' => strim(!empty($caption) ? $caption : FBD_SITE_DESCRIPTION, conf('service.facebook.shareDialog.caption.trimWidth'), null, false, true), 'name' => strim($name, conf('service.facebook.shareDialog.name.trimWidth'), null, false, true)); if (!empty($description)) { $feed_options['description'] = strim($description, conf('service.facebook.shareDialog.description.trimWidth'), null, false, true); } if (!empty($images)) { $image = Util_Array::get_last($images); if (empty($img_size_key)) { $img_size_key = 'thumbnail'; } $feed_options['picture'] = Uri::create(img_uri($image->get_image(), $img_size_key)); } echo btn('service.facebook.do_share', '#', 'js-facebook_feed', true, 'xs', 'primary', array('class' => 'mr10', 'data-options' => json_encode($feed_options)), null, null, null, false); ?> <span id="fb-root"></span>