template("[b]bold[/b][i]italic[/i]", "bolditalic");
}
public function testStacking() {
$this->template("[b]B[/b][i]I[/i][b]B[/b]", "BIB");
$this->template("[b]bold[i]bolditalic[/i]bold[/b]", "boldbolditalicbold");
}
public function testFailure() {
$this->template("[b]bold[i]italic", "[b]bold[i]italic");
}
public function testURL() {
$this->template(
"[url]http://shishnet.org[/url]",
"http://shishnet.org");
$this->template(
"[url=http://shishnet.org]ShishNet[/url]",
"ShishNet");
$this->template(
"[url=javascript:alert(\"owned\")]click to fail[/url]",
"[url=javascript:alert("owned")]click to fail[/url]");
}
private function template($in, $out) {
$bb = new BBCode();
$tfe = new TextFormattingEvent($in);
$bb->receive_event($tfe);
$this->assertEqual($tfe->formatted, $out);
}
}
?>