test spoiler code

This commit is contained in:
Shish 2009-09-19 20:23:48 +01:00
parent d7038a0098
commit 846801b76d

View File

@ -38,6 +38,18 @@ class BBCodeUnitTest extends UnitTestCase {
"<ul><li>a<ul><li>a<li>b</ul><li>b</ul>"); "<ul><li>a<ul><li>a<li>b</ul><li>b</ul>");
} }
public function testSpoiler() {
$this->assertEqual(
$this->filter("[spoiler]ShishNet[/spoiler]"),
"<span style=\"background-color:#000; color:#000;\">ShishNet</span>");
$this->assertEqual(
$this->strip("[spoiler]ShishNet[/spoiler]"),
"FuvfuArg");
#$this->assertEqual(
# $this->filter("[spoiler]ShishNet"),
# "[spoiler]ShishNet");
}
public function testURL() { public function testURL() {
$this->assertEqual( $this->assertEqual(
$this->filter("[url]http://shishnet.org[/url]"), $this->filter("[url]http://shishnet.org[/url]"),
@ -56,5 +68,12 @@ class BBCodeUnitTest extends UnitTestCase {
$bb->receive_event($tfe); $bb->receive_event($tfe);
return $tfe->formatted; return $tfe->formatted;
} }
private function strip($in) {
$bb = new BBCode();
$tfe = new TextFormattingEvent($in);
$bb->receive_event($tfe);
return $tfe->stripped;
}
} }
?> ?>