From 36cc1d4510d4f28c463e9584cb7ce849a5e4e2ec Mon Sep 17 00:00:00 2001 From: uckelman Date: Tue, 20 Apr 2010 20:01:07 +0000 Subject: Added getAttachmentData(). git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6721 67b53d14-2c14-4ace-a08f-0dab2b34000c --- src/PhpBB3.php | 14 ++++++++++++++ test/PhpBB3Test.php | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/PhpBB3.php b/src/PhpBB3.php index 381c9a4..f5f0df9 100644 --- a/src/PhpBB3.php +++ b/src/PhpBB3.php @@ -120,6 +120,20 @@ class PhpBB3 { return $row ? $row['post_time'] : false; } + public function getAttachmentData($attachId) { + throw_if_null($attachId); + + global $db; + + $sql = 'SELECT physical_filename, real_filename, ' . + 'attach_comment, mimetype, filesize ' . + 'FROM ' . ATTACHMENTS_TABLE . + 'WHERE attach_id = ' . $attachId; + + $row = $this->get_exactly_one_row($sql); + return $row; + } + public function postMessage($postType, $forumId, $topicId, $msg) { throw_if_null($msg); diff --git a/test/PhpBB3Test.php b/test/PhpBB3Test.php index fbd68e2..99de765 100644 --- a/test/PhpBB3Test.php +++ b/test/PhpBB3Test.php @@ -132,4 +132,20 @@ EOF; return array( ); } + + /** + * @dataProvider providerGetAttachmentData + */ + public function testGetAttachmentData($attach_id, $expected, $ex) { + $this->markTestIncomplete(); + + if ($ex) $this->setExpectedException($ex); + $run = 'getAttachmentData(' . $attach_id . ')'; + $this->assertEquals($expected, $this->exec_kludge($run)); + } + + public function providerGetAttachmentData() { + return array( + ); + } } -- cgit v1.2.3