/** * Test getTopics() */ public function testGetTopics() { list($count, $topics) = KunenaForumTopicHelper::getLatestTopics(false, 0, 20); $topicusers = KunenaForumTopicUserHelper::getTopics($topics); foreach ($topics as $topic) { $this->assertTrue(isset($topicusers[$topic->id])); $this->assertEquals($topic->id, $topicusers[$topic->id]->topic_id); } }
/** * Returns KunenaForumTopicUser object * * @access public * @param identifier The user topic to load - Can be only an integer. * @return KunenaForumTopicUser The user topic object. * @since 1.7 */ static public function get($topic = null, $user = null, $reload = false) { if ($topic instanceof KunenaForumTopic) { $topic = $topic->id; } $topic = intval ( $topic ); $user = KunenaUserHelper::get($user); if ($topic < 1) return new KunenaForumTopicUser (null, $user); if ($reload || empty ( self::$_instances [$user->userid][$topic] )) { self::$_instances [$user->userid][$topic] = self::$_topics [$topic][$user->userid] = array_pop(KunenaForumTopicUserHelper::getTopics ( $topic, $user )); } return self::$_instances [$user->userid][$topic]; }
/** * @param mixed $ids * @param mixed $user * * @return KunenaForumTopicUser[] */ public static function getUserTopics($ids = false, $user = null) { if ($ids === false) { $ids = array_keys(self::$_instances); } return KunenaForumTopicUserHelper::getTopics($ids, $user); }