diff options
| author | uckelman <uckelman@nomic.net> | 2010-04-13 21:28:20 +0000 | 
|---|---|---|
| committer | uckelman <uckelman@nomic.net> | 2010-04-13 21:28:20 +0000 | 
| commit | 3f22dc639d43d3beda597bb8c41f034da9a1cfab (patch) | |
| tree | e42d00f8dc78c722e36d0a92ff820c6ac49bd12c | |
| parent | ff6734201fb07bca69eb90ffadc310ab279479be (diff) | |
Added getFirstPostId().
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6705 67b53d14-2c14-4ace-a08f-0dab2b34000c
| -rw-r--r-- | src/PhpBB3.php | 12 | ||||
| -rw-r--r-- | test/PhpBB3Test.php | 16 | 
2 files changed, 28 insertions, 0 deletions
diff --git a/src/PhpBB3.php b/src/PhpBB3.php index 48361a6..ca75c24 100644 --- a/src/PhpBB3.php +++ b/src/PhpBB3.php @@ -120,6 +120,18 @@ class PhpBB3 {      return $row ? $row['post_time'] : false;    } +  public function getFirstPostId($topicId) { +    throw_if_null($topicId); + +    global $db; + +    $sql = 'SELECT topic_first_post_id FROM ' . TOPICS_TABLE . ' ' . +           'WHERE topic_id = ' . $topicId; + +    $row = $this->get_exactly_one_row($sql); +    return $row ? $row['topic_first_post_id'] : false; +  } +    public function postMessage($postType, $forumId, $topicId, $msg) {      throw_if_null($msg); diff --git a/test/PhpBB3Test.php b/test/PhpBB3Test.php index fbd68e2..ee9246a 100644 --- a/test/PhpBB3Test.php +++ b/test/PhpBB3Test.php @@ -132,4 +132,20 @@ EOF;      return array(      );    } + +  /** +   * @dataProvider providerGetFirstPostId +   */ +  public function testGetFirstPostId($topic_id, $expected, $ex) { +    $this->markTestIncomplete(); + +    if ($ex) $this->setExpectedException($ex); +    $run = 'getFirstPostId(' . $topic_id . ')'; +    $this->assertEquals($expected, $this->exec_kludge($run)); +  } + +  public function providerGetFirstPostId() { +    return array( +    ); +  }  }  | 
