summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruckelman <uckelman@nomic.net>2010-04-07 21:22:29 +0000
committeruckelman <uckelman@nomic.net>2010-04-07 21:22:29 +0000
commit27677e5f97454022d5418ad454aec1df3461f475 (patch)
tree4eb7b2e4042b76b96dc07560b0cdb372b6c90a32
parente3bd48067aa095865e4241eaa30ca2ffd9f3d7ae (diff)
Added test for Bridge::getDefaultForumId().
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6633 67b53d14-2c14-4ace-a08f-0dab2b34000c
-rw-r--r--test/BridgeTest.php32
1 files changed, 27 insertions, 5 deletions
diff --git a/test/BridgeTest.php b/test/BridgeTest.php
index b9f8e0d..c7f6f47 100644
--- a/test/BridgeTest.php
+++ b/test/BridgeTest.php
@@ -11,6 +11,9 @@ class BridgeTest extends PHPUnit_Framework_TestCase {
$this->db = new PDO('mysql:host=localhost;dbname=test');
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ //
+ // Build posts table
+ //
$this->db->exec('DROP TABLE IF EXISTS posts');
$this->db->exec(
@@ -32,6 +35,26 @@ class BridgeTest extends PHPUnit_Framework_TestCase {
'"<1267171317.m2f.17507@www.vassalengine.org> <1267473003.m2f.17543@www.vassalengine.org>"' .
')'
);
+
+ //
+ // Build forums table
+ //
+ $this->db->exec('DROP TABLE IF EXISTS forums');
+
+ $this->db->exec(
+ 'CREATE TABLE forums (' .
+ 'list_name VARCHAR(255) NOT NULL, ' .
+ 'forum_id MEDIUMINT UNSIGNED NOT NULL, ' .
+ 'PRIMARY KEY (list_name), ' .
+ 'INDEX (forum_id))'
+ );
+
+ $this->db->exec(
+ 'INSERT INTO forums (list_name, forum_id) ' .
+ 'VALUES (' .
+ '"messages@forums.vassalengine.org", 2' .
+ ')'
+ );
}
protected function tearDown() {
@@ -89,16 +112,15 @@ class BridgeTest extends PHPUnit_Framework_TestCase {
* @dataProvider providerGetDefaultForumId
*/
public function testGetDefaultForumId($list, $expected, $ex) {
- $this->markTestIncomplete();
-# if ($ex) $this->setExpectedException($ex);
-# $bridge = new Bridge($this->db);
-# $this->assertEquals($expected, $bridge->getDefaultForumId($list));
+ if ($ex) $this->setExpectedException($ex);
+ $bridge = new Bridge($this->db);
+ $this->assertEquals($expected, $bridge->getDefaultForumId($list));
}
public function providerGetDefaultForumId() {
return array(
array('bogus', null, 'PHPUnit_Framework_Error'),
-# array('messages@forums.vassalengine.org', 2, null),
+ array('messages@forums.vassalengine.org', 2, null),
);
}
}