From 27677e5f97454022d5418ad454aec1df3461f475 Mon Sep 17 00:00:00 2001 From: uckelman Date: Wed, 7 Apr 2010 21:22:29 +0000 Subject: Added test for Bridge::getDefaultForumId(). git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6633 67b53d14-2c14-4ace-a08f-0dab2b34000c --- test/BridgeTest.php | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'test/BridgeTest.php') 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), ); } } -- cgit v1.2.3