a($substring); $text .= $substring; $substring = 'cba'; $msg->append($substring); $text .= $substring; $this->assertEquals($text, $msg->getRaw()); } function testBeautifilText() { $msg = new BotMsg('

Test

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('

Test

'."\n" .'

Test h3

'."\n" .'

http://jacekk.info
'."\n" .'Jacekk.info

'); $expect = '== Test =='."\n" .'=== Test h3 ==='."\n" .'http://jacekk.info'."\n" .'Jacekk.info (http://jacekk.info)'; $this->assertEquals($expect, $msg->getText()); $msg = new BotMsg(''."\n" .''."\n" .''."\n" .'
Header 1 Header 2
Cell 1 Cell 2
'); $expect = '*Header 1* *Header 2*'."\n" .'Cell 1 Cell 2'; $this->assertEquals($expect, $msg->getText()); $msg = new BotMsg('

Test h3

abc

Test

'); $expect = '=== Test h3 ==='."\n" .'abc'."\n\n" .'Test'; $this->assertEquals($expect, $msg->getText()); } function testGetHTML() { $msg = new BotMsg('

Test

'."\n" .'

This.

'."\n" .'

That!

'."\n" .'

http://jacekk.info

'); $expect = '

Test

'."\n" .'

This.

'."\n" .'

That!

'."\n" .'

http://jacekk.info

'; $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('

Test

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()); } }