a($substring); $text .= $substring; $substring = 'cba'; $msg->append($substring); $text .= $substring; $this->assertEquals($text, $msg->getRaw()); } function testBeautifilText() { $msg = new BotMsg('
This.
That!
'); $expect = '= Test ='."\n" .'_/This./_'."\n\n" .'*That!*'; $msg->setBeautiful(TRUE); $this->assertEquals($expect, $msg->getText()); $expect = 'Test'."\n" .'This.'."\n\n" .'That!'; $msg->setBeautiful(FALSE); $this->assertEquals($expect, $msg->getText()); } function testGetText() { $msg = new BotMsg('http://jacekk.info
'."\n"
.'Jacekk.info
Header 1 | Header 2 |
---|---|
Cell 1 | Cell 2 |
Test
'); $expect = '=== Test h3 ==='."\n" .'abc'."\n\n" .'Test'; $this->assertEquals($expect, $msg->getText()); } function testGetHTML() { $msg = new BotMsg('This.
'."\n" .'That!
'."\n" .''); $expect = 'This.
'."\n" .'That!
'."\n" .''; $this->assertEquals($expect, $msg->getHTML()); $this->assertEquals($expect, (string)$msg); } function testHTMLError() { $oldhandler = set_error_handler('errorToException'); $msg = new BotMsg(' ]]>'); $msg->getHTML(); set_error_handler($oldhandler); } function testSleep() { $msg = new BotMsg('This.
That!
'); $raw = $msg->getRaw(); $text = $msg->getText(); $html = $msg->getHTML(); $serialized = serialize($msg); $msg = unserialize($serialized); $this->assertEquals($raw, $msg->getRaw()); $this->assertEquals($text, $msg->getText()); $this->assertEquals($html, $msg->getHTML()); } }