summaryrefslogtreecommitdiff
path: root/test/BBCodeParserTest.php
diff options
context:
space:
mode:
authoruckelman <uckelman@nomic.net>2010-04-25 16:35:25 +0000
committeruckelman <uckelman@nomic.net>2010-04-25 16:35:25 +0000
commitb05a9c8aee98fb75cb62a101c037b1d3646e0390 (patch)
treeed6ac6a546f141036045d72c797a7615788573c6 /test/BBCodeParserTest.php
parent97fda1bc5f653f4612833de518fe0c4a4fc52866 (diff)
Added BBCodeParser.
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6738 67b53d14-2c14-4ace-a08f-0dab2b34000c
Diffstat (limited to 'test/BBCodeParserTest.php')
-rw-r--r--test/BBCodeParserTest.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/BBCodeParserTest.php b/test/BBCodeParserTest.php
new file mode 100644
index 0000000..29c7eae
--- /dev/null
+++ b/test/BBCodeParserTest.php
@@ -0,0 +1,25 @@
+<?php
+
+require_once('PHPUnit/Framework.php');
+require_once('src/BBCodeParser.php');
+
+class BBCodeParserTest extends PHPUnit_Framework_TestCase {
+
+ /**
+ * @dataProvider providerParse
+ */
+ public function testGetPostId($in, $uid, $expected, $ex) {
+ if ($ex) $this->setExpectedException($ex);
+ $parser = new BBCodeParser();
+ $this->assertEquals($expected, $parser->parse($in, $uid));
+ }
+
+ public function providerGetPostId() {
+ return array(
+ array('', '3i2cqt66', '', null),
+ array('[b:3i2cqt66]This is a[/b:3i2cqt66] test of [i:3i2cqt66]the BBCode[/i:3i2cqt66] parser. Will [u:3i2cqt66][i:3i2cqt66]it[/i:3i2cqt66][/u:3i2cqt66] parse? Also, throw in some difficult characters: 1 &lt; 2 &lt; 4 &gt; 3.', '3i2cqt66', '__This is a__ test of _the BBCode_ parser. Will ___it___ parse? Also, throw in some difficult characters: 1 &lt; 2 &lt; 4 &gt; 3.', null)
+ );
+ };
+}
+
+?>